PostMCP AI Model Context Protocol (MCP) Server is the official MCP server from PostMCP, used to connect social media publishing pipelines to AI assistants, desktop applications, IDE workflows, and web environments such as Claude Desktop, Claude.ai, Cursor, and ChatGPT custom GPTs. The project is distributed under the MIT License.
[Purpose] Let AI assistants and development tools directly operate the social media publishing process, including account connection status, posting queue, pre-publish checks, scheduling, publishing, and analytics.
[Supported platforms] LinkedIn, X (Twitter), Facebook, Instagram, Threads, Bluesky, and YouTube Shorts.
[Main capabilities]
- 20 built-in tools: workspaces, connected accounts and their token health, posting queue, pre-publish checks, create/schedule/reschedule/publish/retry/delete posts, single-post and single-page analytics, media upload, image generation, and bulk operations.
- Carousels and image galleries: via mediaUrls, you can publish carousels on Instagram and Threads, multi-image posts on Facebook and LinkedIn, and four-image galleries on X and Bluesky; a single call pre-checks the limits of each network.
- Dual transport modes: native Stdio mode (for local desktop applications and IDEs) and Streamable HTTP mode (for web services, Claude.ai, and remote connectors).
- Flexible authentication: API keys can be automatically detected from environment variables (POSTMCPAI_API_KEY), URL query parameters (?apikey=YOUR_KEY), or HTTP authorization headers (x-api-key, Bearer token).
- Multi-workspace awareness: an API key carries its own workspace and works with the key alone; to operate on other workspaces, each tool can accept an optional workspaceId, or it can be set per connection (?projectId=..., x-project-id) or per process (POSTMCPAI_PROJECT_ID).
- ChatGPT Actions compatible: built-in OpenAPI 3.0 specification generator (/openapi.json) and REST endpoint (/api/tools/:name), for ChatGPT custom GPT integration.
- Supports OAuth PKCE and RFC 9728: provides per-user consent, persistent encrypted authorization, rotating tokens, and DCR for ChatGPT/Codex; production setup in OAUTH.md is required, and API key clients are still supported.
- Installable plugins: provides account onboarding, publishing, scheduling, and analytics workflows, see PLUGIN.md for details, and can be packaged via npm run package:plugin.
[How to use]
- Claude Desktop (Stdio mode): add the configuration to the Claude Desktop configuration file. The macOS path is ~/Library/Application Support/Claude/claude_desktop_config.json; the Windows path is %APPDATA%\Claude\claude_desktop_config.json.
- Cursor: open Cursor settings -> Features -> MCP, click + Add New MCP Server, and fill in: Name as postmcpai, Type as command, Command as npx -y @postmcpai/server; in Environment Variables, add POSTMCPAI_API_KEY = pmcp_sec_your_secret_api_key_here.
- Claude.ai and remote web connectors (Streamable HTTP / SSE mode): host the server on any cloud service (Render, Railway, Fly.io, Vercel) or use ngrok to tunnel your local machine, then provide a public MCP URL with an API key, such as https://your-hosted-domain.com/mcp?apikey=pmcp_sec_your_secret_api_key_here。Claude.ai will discover tool capabilities and authenticate via /mcp. To point to a different workspace, append &projectId=YOUR_WORKSPACE_ID or send the x-project-id header; a single tool call can still override it with workspaceId.
- ChatGPT custom GPT (REST Actions): when configuring a Custom GPT Action, specify the server URL (such as https://your-hosted-domain.com),从 https://your-hosted-domain.com/openapi.json Import the OpenAPI schema and set authentication to API Key (Bearer Authorization or custom x-api-key). This is a GPT Actions integration, not an OAuth plugin; for plugins, use OAUTH.md.
- Node.js library usage: @postmcpai/server can be used as a library in your own Node.js backend.
[MCP Tool Reference] Each tool accepts an optional workspaceId (from list_workspaces) to operate on a specified workspace.
Local file upload flow:
- Call create_media_upload_url with fileName, contentType (MIME type), and fileSize (in bytes), for example { "fileName": "launch.png", "contentType": "image/png", "fileSize": 245760 }.
- Use the returned headers to PUT the raw file bytes to the returned uploadUrl. Do not send the PostMCP API key to storage. The URL expires after expiresIn seconds (usually 900); after expiration, you must request a new one. Creating the URL alone does not upload the file.
- After a successful PUT, call complete_media_upload with the returned publicUrl as url, the returned key, and the same file metadata. Both tools use the same workspaceId. This step registers the file; it does not transfer or verify the bytes.
- Use the returned mediaUrl in create_post or update_post, or collect multiple URLs into mediaUrls to form a carousel.
For existing public files, call import_media_from_url with { "url": "https://example.com/launch.png" }, and the backend downloads it and returns the stored mediaUrl in a single call. The URL must serve the file directly without authentication; the backend rejects private network URLs.
Storage supports PNG, JPEG, GIF, WebP, AVIF, HEIC, MP4, MOV, WebM, and M4V, with an image limit of 25 MiB and a video limit of 512 MiB. Each social platform has stricter publishing requirements; use preflight_post before publishing. File bytes and base64 are not transferred through MCP JSON requests. If library registration fails after successful storage, the result will include librarySaved: false and a warning, while retaining a usable mediaUrl.
Batch call replies include one record per call—{ id, tool, ok, result } or { id, tool, ok: false, error }—plus counts, and any calls skipped when the batch stopped due to a failure.
mediaUrls is an ordered collection of attachments. One URL is a regular media post; two or more will publish as a multi-media post on every network except YouTube, with the first URL as the cover. Only Instagram and Threads allow mixing video into a carousel; elsewhere, multiple files must all be images, and videos must be published separately. create_post will reject a collection the target does not accept before spending any quota, and will specify the account and rule. Using preflight_post on the same mediaUrls will report the same information plus a mediaSetLimits map, so check first when one carousel is sent to multiple networks.
An account can carry its own mediaUrls in its targetAccounts entry (or in variants as { "twitter": { "mediaUrls": [...] } }) to replace the shared collection—for example, giving X and Bluesky four slices of a long carousel. Each slice is copied to PostMCP's own storage at write time, just like a single attachment, so the host letting the link expire later will not break a scheduled post. If one slice fails at publish time, that account's post fails rather than publishing a shorter carousel; publish_post_now can retry.
update_post with mediaUrls replaces the entire collection (Add, delete, or reorder slices); an empty array removes all media. Each post returned by list_posts / get_post carries mediaUrls alongside mediaUrl.
[Client notes]
- Target pages, not platforms. targetAccounts sends only to the specified pages; platforms fans out to all connected pages on each platform.
- One post per page. create_post stores a separate post for each target page, so each can be edited, retried, or canceled independently. Per-page copy can be provided via targetAccounts[].content or a variants mapping.
- Always pass timezone when wall-clock time matters. The backend defaults to UTC, so a 9:00 IST post without a specified timezone will go out at 14:30 IST.
- Quota is billed per page delivered (X/Twitter costs 5, others 1), plus a one-time 50-quota surcharge when the copy contains a link. preflight_post reports this before submission.
- Analytics are read on demand, never run in the background. list_posts and get_connected_accounts carry the content stored from the last read for free. get_post_analytics (a single post, covering each network it was published to) and get_profile_analytics (a single connected page: followers, posts, views) read the network immediately when refresh: true, each costing 1 quota; without it, they use stored readings for free. engagements is likes + comments + shares on each network, so it can be compared across platforms. null means the network does not report that metric (Bluesky has no views); an error indicating reconnect means the account predates insights permission and its owner must reconnect; unavailable: true means the network never responds to this type of post (LinkedIn personal pages).
[Environment configuration and repository architecture] The official documentation includes the section titles Environment Configuration and Repository Architecture, but the specific content is not yet provided in the supplied materials.