Connect Claude Desktop, Claude Code, Cursor or Codex to BetterPost so an AI agent can connect accounts, publish, schedule and track posts.
BetterPost runs a Model Context Protocol server, so AI agents can use the API as tools. The tools call the same code as the REST API: same validation, credits, sandbox triggers and webhooks.
| Endpoint | https://mcp.betterpost.dev/mcp |
| Transport | Streamable HTTP (stateless) |
| Auth | Authorization: Bearer <your API key> (an x-access-key header also works) |
Use a normal sk_test_ API key from Dashboard → API keys. Dashboard → MCP server shows these snippets with
your endpoint filled in. Replace sk_test_YOUR_KEY below with your key.
Add to claude_desktop_config.json (Settings, Developer, Edit config), then restart Claude Desktop. Claude Desktop
reaches remote servers through the mcp-remote bridge:
{
"mcpServers": {
"betterpost": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mcp.betterpost.dev/mcp",
"--header",
"Authorization:${BETTERPOST_AUTH}"
],
"env": {
"BETTERPOST_AUTH": "Bearer sk_test_YOUR_KEY"
}
}
}
}Run once in your terminal:
claude mcp add --transport http betterpost https://mcp.betterpost.dev/mcp \
--header "Authorization: Bearer sk_test_YOUR_KEY"Add to .cursor/mcp.json in your project, or ~/.cursor/mcp.json for all projects:
{
"mcpServers": {
"betterpost": {
"url": "https://mcp.betterpost.dev/mcp",
"headers": {
"Authorization": "Bearer sk_test_YOUR_KEY"
}
}
}
}Add to ~/.codex/config.toml and export the key in your shell:
[mcp_servers.betterpost]
url = "https://mcp.betterpost.dev/mcp"
bearer_token_env_var = "BETTERPOST_API_KEY"
# in your shell profile:
# export BETTERPOST_API_KEY=sk_test_YOUR_KEY| Tool | What it does | REST equivalent |
|---|---|---|
list_platforms | The four supported platforms. | GET /v1/platforms |
list_accounts | Connected accounts; filter by platform, profileId (or "null"), q. Call this first: its ids are the accountIds posts need. | GET /v1/connect/integrations |
list_profiles | Profiles, with page, limit, name. | GET /v1/profiles |
create_profile | Create a profile (name, description). | POST /v1/profiles |
get_connect_url | A URL the user opens to connect an account (platform, profileId, redirectUri). | GET /v1/connect/{platform} |
create_post | Publish now, schedule (scheduledFor + timezone) or save a draft; same body as the REST call, including idempotencyKey. | POST /v1/posts |
get_post | A post and its per-platform results. | GET /v1/posts/{id} |
list_posts | Posts with the REST filters. | GET /v1/posts |
list_scheduled_posts | Scheduled posts, soonest first. | GET /v1/posts/scheduled |
retry_post | Re-publish failed platforms, now or at scheduledFor. | POST /v1/posts/{id}/retry |
reschedule_post | Move a scheduled post. | PATCH /v1/posts/scheduled/{id} |
edit_scheduled_post | Replace a scheduled post's content, targets and media. | PUT /v1/posts/scheduled/{id} |
cancel_scheduled_post | Cancel a scheduled post (back to draft, refunded). | DELETE /v1/posts/scheduled/{id} |
delete_post | Delete a post. | DELETE /v1/posts/{id} |
upload_media_from_url | Copy a public https image or video (up to 25 MB, no redirects) into BetterPost storage and return its publicUrl. Agents use this instead of presigned uploads. | None (REST clients use POST /v1/media/upload) |
get_usage | Credit usage and balance; filters profileId, integrationId, from, to. | GET /v1/usage |
Each tool returns two text parts: a one-line summary (for example Post post_... is published.) and the same
JSON the REST endpoint returns. Errors come back as tool errors with the REST error message, followed by any field
problems in parentheses.
Tool calls count toward the project's 120 requests per minute and appear in Dashboard → Logs as mcp:<tool>.
Connect my X account, then post "Testing BetterPost from Claude" to it and tell me the link.
The agent calls get_connect_url (you open the link and authorize), then list_accounts, then create_post, and
reads platformPostUrl from the result. In the sandbox the link opens a preview page.
When you run BetterPost locally, the MCP endpoint is
http://localhost:3000/api/mcp/mcp. Use it in place of https://mcp.betterpost.dev/mcp in the snippets above.