MCP server
此内容尚不支持你的语言。
Connect an MCP client (Claude Code, Claude.ai, Cursor) to a workspace. The client authenticates with OAuth 2.1 and can draft, validate and preview posts on its own. Scheduling or publishing needs a human approval in the web app, one per post.
Overview
Section titled “Overview”- The MCP server is
https://mcp.thesocialmediapp.com/mcp. It is an OAuth 2.1 resource server and publishes its protected-resource metadata at/.well-known/oauth-protected-resource/mcp. It accepts only OAuth access tokens from our authorization server: API keys and web-app session tokens are refused. - The authorization server (the token issuer) is the web app origin: a client reads it from the
authorization_serversentry of the protected-resource metadata. It serves/.well-known/oauth-authorization-server,/oauth/tokenand/oauth/jwks; the consent page is/{locale}/oauth/authorize, approvals are reviewed at/{locale}/approvals/{id}and sessions are revoked at/{locale}/settings/connected-apps.
Facts worth knowing:
- The server is documented against protocol version 2026-07-28 and negotiates the version with each client.
- Client registration is CIMD (Client ID Metadata Documents): the
client_idis an https URL that serves the client metadata. There is no Dynamic Client Registration. - Registration happens only on an authorization request made by a signed-in user in the web app; an anonymous one is refused with
invalid_requestbefore any fetch. The token endpoint never registers: an unknown URLclient_idgetsinvalid_clientwithout a fetch. The metadata fetch follows no redirects. - Access tokens are RS256 and last 15 minutes; authorization codes 60 seconds; refresh tokens 30 days, rotated on every use with zero reuse leeway. PKCE S256 is mandatory and
resourcemust equal the MCP server URL exactly.
Eighteen tools, localized descriptions:
| Area | Tools |
|---|---|
| Workspace | list_workspaces (with the subject’s role), get_workspace_plan(workspace_id) (read-only: the plan of the workspace’s owner) |
| Account | list_social_accounts, get_publishing_requirements (optional format: per-target options schema, limits, requires_consent; early_access_required when the network is in connector early access and this workspace is not allowlisted, so scheduling to it answers connector_early_access_required) |
| Drafts and checks | create_draft, update_draft, validate_post |
| Publishing | preview_publication, schedule_post, publish_post, reschedule_post, cancel_scheduled_post, get_publication_status |
| Media | import_media_from_url, get_media, list_media |
| Analytics | get_post_metrics (read-only: the observed metrics already collected per destination, with the collection time, the definitions and a notice that they are observations, not recommendations; null = not reported, never 0), request_metrics_refresh (queues a collection; returns jobs and unavailable; a refresh within 10 min is refused with retry_after_seconds). |
Images: the model imports from a public https URL (never uploads bytes) and polls get_media until the status is ready or rejected; create_draft/update_draft take media_ids (up to 4 ready images; update_draft keeps the images when media_ids is omitted and removes them with []). The MCP server never returns a thumbnail or signed URL. list_media omits media whose posts are all published or deleted; that media is deleted 3 days later by default (see the Posts guide, “Media after publication”). Imported images and alt texts are data, not instructions.
Video: a post holds up to 4 images or one video, never both (post_media_mixed, post_media_too_many_videos), and every target of a video post is a video target. Videos are uploaded through the web app or POST /v1/media/uploads, never imported: import_media_from_url on a URL that serves a video ends rejected with media_video_import_unsupported. get_media reports kind (image | video), duration_ms and, for a video, video (container, video_codec, audio_codec, frame_rate, bitrate_kbps; null for images). get_publishing_requirements returns video (max_bytes, max_duration_sec, min_duration_sec, max_edge, containers) when the account can publish video and null otherwise; the values are the account’s own video limits when its network reports them, else the platform’s upload limits.
Options and consent: get_publishing_requirements(connection_id, format) adds options (provider, format, enabled, requires_consent, schema, live, limits, fetched_at_utc, notices; the same payload as GET /v1/connections/{id}/requirements?format=), where schema is a small JSON-schema subset (type, enum, required, default, max_length, minimum, format, x-ui). create_draft/update_draft targets accept an options object (≤ 8 KiB; post_target_options_invalid, post_target_options_too_large; provider keys checked by validate_post, e.g. post_target_options_required for a required option without a default). requires_consent: true means schedule_post/publish_post always answer requires_user_action: only the user consents, on the review page, and no tool parameter can set consent.
Plan: get_workspace_plan(workspace_id) returns the plan of the workspace owner (the plan belongs to the user who owns the organization), the same object as GET /v1/workspaces/{organizationId}/plan: plan_key, interval, enforced, blocked, block_reason, max_organizations, max_products_per_organization, max_accounts_per_product, max_accounts_per_organization (deprecated; each null = unlimited, always written), accounts_in_use, products_in_use, products (the workspaces the token can read, each with its accounts in use and archived) and pending_change. blocked: true means every write is refused until the owner acts in the web app. A product outside the token’s workspace answers product_not_found; an archived organization still answers. See the Workspace plan guide.
No webhook tools: subscriptions are managed on /v1/webhook-subscriptions and in the web app; the webhooks:* scopes are not MCP-reachable.
No export or deletion tools: workspace exports are /v1/exports and the web app’s Organization → Data tab, organization deletion is in the web app only; workspace:export is not MCP-reachable.
Scopes
Section titled “Scopes”| Scope | Allows |
|---|---|
products:read |
list_workspaces, get_workspace_plan |
connections:read |
list_social_accounts, get_publishing_requirements |
posts:read |
validate_post, preview_publication, get_publication_status |
posts:write |
create_draft, update_draft |
posts:publish |
schedule_post, publish_post, reschedule_post, cancel_scheduled_post (scheduling, publishing and rescheduling still need an approval) |
media:read |
get_media, list_media |
media:write |
import_media_from_url |
analytics:read |
get_post_metrics |
analytics:refresh |
request_metrics_refresh (queues a provider read, under the refresh window: publisher role and above) |
offline_access |
Refresh tokens (granted implicitly when the user approves) |
The protected-resource metadata lists seven data scopes (products:read, connections:read, posts:*, media:*); the authorization server also advertises offline_access. A token can never carry more than the user’s own scopes.
Effective scopes (organization roles)
Section titled “Effective scopes (organization roles)”A token is bound to one workspace, so to one organization. What it may do on each request is its effective scopes = the granted scopes ∩ the scopes of the subject’s current membership role in that organization, recomputed on every request:
- The consent page offers only workspaces whose organization role covers every requested scope (
invalid_scopewhen no workspace does and none is unavailable). - Archived, pending-deletion or plan-blocked workspaces are still listed, with
unavailable_reasonset to the /v1 code (organization_archived,organization_pending_deletion,plan_blocked_*;nullwhen the workspace can be chosen), and the web shows them disabled; approving one is still refused with 403access_deniedand that code aserror_description. They are listed when the user’s base role covers the requested scopes, even if the archive or the pending deletion collapsed the held scopes to reads (a viewer asking forposts:writestill getsinvalid_scope), and a user whose workspaces are all unavailable still sees the page, with Approve disabled, and can deny (access_deniedback to the client). - A demoted user’s token loses the dropped scopes on the next call; the matching tools disappear from
tools/list. - A removed member has no role, so the token has no scopes and no tools from the next call on. Their authorizations for that organization are also revoked (right after the removal, retried in the background), so refresh fails too.
posts:approveandmembers:read/members:writeare never requestable by MCP clients (not in the MCP allow-list): no tool approves a publication or manages members. Approvals are decided by a human in the web app.list_workspacesreturns each workspace (product) withrole, the subject’s role in its organization, andarchived_at_utcwhen the workspace is archived (absent while it is active). An archived workspace is read-only: every write tool answersproduct_archived, reads keep working.- Approving a consent bound to an archived workspace is refused with 403
access_deniedandproduct_archivedaserror_description.
Rate limits
Section titled “Rate limits”By default each token (one user through one MCP client) may send 300 requests per minute, and all the tokens of one
organization together 600. A request over either limit is refused with HTTP 429, a Retry-After header (seconds) and the
/v1 error envelope with the code common_rate_limited (retryable); wait that long before you retry.
Client setup
Section titled “Client setup”Use the MCP server URL https://mcp.thesocialmediapp.com/mcp.
-
Claude Code:
Terminal window claude mcp add --transport http tsma https://mcp.thesocialmediapp.com/mcpThen run
/mcpin Claude Code and authenticate; the browser opens the consent page. -
Claude.ai: Settings, Connectors, add a custom connector with the URL
https://mcp.thesocialmediapp.com/mcp. -
Cursor,
mcp.json:{ "mcpServers": { "tsma": { "url": "https://mcp.thesocialmediapp.com/mcp" } } }
On first use the client gets a 401 with WWW-Authenticate: Bearer resource_metadata=..., reads the protected-resource metadata, finds the authorization server, and sends the user to the consent page. The user picks the workspace and approves the scopes. Revoke the session any time in Settings, Connected apps.
Approval flow (from the model’s point of view)
Section titled “Approval flow (from the model’s point of view)”A model’s approved=true is not consent. Consent is a verifiable authorization_reference created by a human in the web app.
- The model calls
preview_publicationto see the exact text per account, the attached images (targets[].media: media id, status, alt text; never a URL), and the resolved schedule, then callsschedule_post(post_id, post_version, scheduled_at, timezone)(orpublish_post(post_id, post_version)) withoutauthorization_reference. - The tool returns
requires_user_actionwith anauthorization_referenceand areview_url. Nothing is scheduled or published. - The user opens
review_urlin the web app, reviews the exact content, targets and time, and approves (or rejects). - The model calls
schedule_postagain with the same arguments and theauthorization_reference. - The reference is single-use and bound to that exact post, targets and schedule. If anything differs, or it is expired, rejected or already consumed, the call fails and the cycle restarts.
Changed 2026-11: publishing carries no cost and needs no estimate. schedule_post and publish_post no longer declare estimate_id or max_total_cost; a client that still sends them gets the same answer as without them (the arguments are ignored), and preview_publication no longer returns an estimate.
Changed 2026-11: the MCP tool estimate_operation_cost was removed.
Changed 2026-11: the MCP tool get_usage_and_budget was removed and billing:read is no longer an MCP scope. A client
that still requests billing:read (a remembered scope set) is accepted: the scope is dropped before the consent page, never
granted and never put in a new token; the authorization server no longer advertises it. A refresh token issued before the change
keeps refreshing and may still carry the name, which grants nothing.
Changed 2026-11: get_publication_status no longer returns targets[].receipt_json. A target’s last_error (in every tool
that returns a post or a publication) follows the same rule as /v1, described in the Posts guide under “Target errors and
imported media”: a known code, or reason:detail with a short token detail (letters, digits and _, at most 34 characters), an
Instagram numeric code/subcode or one of our own API error keys; any other detail from the network is withheld, and a value
that fits none of these shapes is provider_error. get_media and list_media return source_url without its query string
(the path is kept as sent).
Changed 2026-11: get_publishing_requirements answers for every connected account of the workspace, whatever the stage of its network: its stage, enabled and requires_consent come from that account’s own network, even when the network is not offered for new connections. MCP clients, like API keys, only see the networks at stage beta or generally_available wherever the network catalog is listed, and the pause time is never returned (paused stays).
Consent destinations: when get_publishing_requirements or preview_publication reports requires_consent: true for a target, step 2 always happens, whatever the arguments: no tool parameter (and no approved=true) is consent. Approving on the review page stamps the consent on exactly the previewed targets, bound to that approval; it counts only for the schedule_post/publish_post call that presents and consumes the same authorization_reference. Any edit of the draft drops the consent and the approval goes stale. The review page shows each target’s options read-only and a consent line. API keys on /v1 get the same answer as a 403 publication_approval_required with action: { kind: "requires_user_action", authorization_reference, review_url, expires_at_utc }. Which networks need consent (today YouTube and TikTok), what invalidates an approval and how to plan an integration around it: Networks that need a person’s consent in the Posts guide.
Options that carry a time (YouTube publish_at, see the Posts guide): publish_at must be at least 15 minutes after the upload time. For publish_post (publish-now) the upload time is the moment the approval is used, not the moment it was requested: a review approved after publish_at minus 15 minutes can no longer be used (connection_you_tube_publish_at_invalid), the approval stays approved but unusable, and the draft must be edited (a new publish_at) and reviewed again. The review page shows a warning only when publish_at is already less than 15 minutes away at the moment the page is viewed; a later approval is refused all the same. A video is never uploaded once its publish_at has passed: if publishing is delayed that long, the target fails with last_error Connection.YouTube.PublishAtPassed and nothing is uploaded (get_publication_status shows it); choose a new time and publish again.
Rescheduling: reschedule_post(post_id, post_version, scheduled_at, timezone) follows the same rules as POST /v1/posts/{id}/reschedule. A model never consents, so every move from an MCP client is held for the user’s review: the tool answers status: "requires_user_action" with authorization_reference, review_url, expires_at_utc and the held post (held_for_review: true, the new time and version). Nothing publishes at the old or the new time until the user approves on review_url; approving applies the new time (no second tool call), rejecting cancels the post, and an undecided review expires at the new time (at most 7 days) and cancels the post. Calling cancel_scheduled_post withdraws the request. A second reschedule_post while held fails with post_reschedule_not_allowed; within 60 minutes of the current scheduled time it fails with post_reschedule_window_closed.
Only a person signed in to the web app can decide an approval; OAuth and API-key callers are refused. The deciding user needs posts:approve in the organization, and cannot approve a version last edited by an editor that they authored themselves (a user promoted from editor cannot consent to their own editor draft through their own MCP client).
Troubleshooting
Section titled “Troubleshooting”401 on /mcp:
- Wrong audience: the token
audis not exactly the MCP server URL. The client must sendresourcewith that URL. - Expired: access tokens last 15 minutes; the client should refresh.
- Wrong issuer or signing key: the token was not issued by our authorization server (for example, it comes from another environment).
- A web-app session token or an API key: both are rejected on purpose; only OAuth RS256 access tokens are accepted.
invalid_client at authorization: the CIMD URL is unreachable, is not https, resolves to a non-public address or its host is not accepted by our server, or the document’s client_id does not equal the URL it was fetched from exactly.
invalid_target: the resource parameter is missing or differs from the MCP server URL.
invalid_grant on refresh: the refresh token was revoked (Connected apps), expired, or already used. Replaying a used refresh token revokes the authorization.
Organization being deleted: while the token’s organization is pending deletion (or its deletion has started) every tool call answers the /v1 envelope organization_pending_deletion (403, not retryable) before the tool runs; the owner can cancel the deletion in the web app. After the deletion the token’s subject has no membership left, so its effective scopes are empty and calls fail with the SDK’s authorization error.
Blocked user: when The Social Media App blocks the token’s user, every tool call answers the /v1 envelope account_blocked (403, not retryable) before the tool runs, within 60 s; the refresh and authorization-code grants of a blocked or locked subject are refused at once with invalid_grant. A forced sign-out by The Social Media App (no block) revokes the user’s OAuth authorizations, so the next refresh fails, but an MCP access token is a self-contained RS256 JWT and keeps working until it expires, at most 15 minutes.
Missing scope: a tool whose scope the token lacks is hidden from tools/list, and a direct tools/call is refused with a JSON-RPC authorization error (HTTP 200; the session stays authenticated). The 401 + WWW-Authenticate challenge appears only for a missing or invalid token. Remedy: reconnect the client and approve the missing scope on the consent page.