buttondown mcp
Enables AI and LLM systems to interact with the Buttondown newsletter service, supporting email drafting, scheduling, analytics retrieval, and list management through a Model Context Protocol interface.
Enables AI and LLM systems to interact with the Buttondown newsletter service, supporting email drafting, scheduling, analytics retrieval, and list management through a Model Context Protocol interface.
A comprehensive TypeScript integration for the Buttondown newsletter service, providing both a CLI interface and a Model Context Protocol (MCP) server for managing newsletters, drafts, and analytics.
Multiple Interfaces:
Command Line Interface (CLI) for direct interaction
Programmatic TypeScript API for custom integrations
Core Functionality:
Email draft management (create, update, delete)
Tag management
Security:
1Password integration for API key management
Secure credential handling
Developer Experience:
# Install using pnpm (recommended)
pnpm install
# Or using npm
npm install
# Or using yarn
yarn install
The API key can be provided in two ways:
export BUTTONDOWN_API_KEY=your_api_key
op://Development/Buttondown API/notesPlain
# List all emails
buttondown emails list
# Create a new draft
buttondown draft create <file>
# Schedule an email
buttondown schedule set <draft-id> <relative-time>
# Get analytics
buttondown analytics get <draft-id>
pnpm mcp:start
pnpm mcp:inspect
Available MCP tools:
list_emails
: List all emails with optional status filtering{
"status": "draft" // Optional: "draft", "scheduled", "sent"
}
create_draft
: Create a new email draft{
"content": "Email content in markdown",
"title": "Optional email subject"
}
get_analytics
: Get analytics for a specific email{
"draftId": "email-id-here"
}
schedule_draft
: Schedule an email for sending
{
"draftId": "email-id-here",
"scheduledTime": "2024-03-27T10:00:00Z"
}
import { ButtondownAPI } from "api-integrator";
// Initialize the client
const api = new ButtondownAPI(); // Will use 1Password or env var
// List drafts
const drafts = await api.getDrafts();
// Create a draft
const draft = await api.createEmail({
subject: "My Newsletter",
body: "Content here",
status: "draft",
});
// Schedule an email
const scheduled = await api.scheduleEmail(draft.id, "2024-03-27T10:00:00Z");
// Get analytics
const analytics = await api.getEmailStats(draft.id);
# Build the project
pnpm build
# Run tests
pnpm test
# Start MCP server in development mode
pnpm mcp:inspect
# Build MCP server
pnpm mcp:build
The project includes several types of tests:
Run tests with:
pnpm test
.
├── src/
│ ├── api/ # Core API client
│ ├── cli/ # CLI implementation
│ ├── mcp/ # MCP server
│ ├── types/ # TypeScript definitions
│ └── utils/ # Shared utilities
├── tests/ # Test files
├── api-responses/ # Cached API responses
└── memory-bank/ # Project documentation
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)ISC License - See LICENSE for details