@socialrouter/mcp
v0.11.2
Published
MCP server for SocialRouter, let LLM agents extract social media data
Maintainers
Readme
SocialRouter MCP Server
An MCP server that exposes the SocialRouter API to LLM agents. Plug it into Claude Desktop, Claude Code, Cursor, or any MCP-compatible client to let the agent fetch social media data through a single unified API.
Supported platforms include LinkedIn, Instagram, X, Reddit, Facebook, TikTok, YouTube, Pinterest, Bluesky, Snapchat, and Google Maps.
Configuration
Get an API key at socialrouter.io, then wire the server into your client. Step-by-step guides, with the config paths and the verification step for each host:
| Client | Guide | | --- | --- | | Claude Code | docs.socialrouter.io/mcp/claude-code | | Claude Desktop | docs.socialrouter.io/mcp/claude-desktop | | Cursor | docs.socialrouter.io/mcp/cursor | | Codex CLI | docs.socialrouter.io/mcp/codex | | VS Code | docs.socialrouter.io/mcp/vscode | | Gemini CLI | docs.socialrouter.io/mcp/gemini-cli | | Anything else | docs.socialrouter.io/mcp/other-clients |
Claude Code
claude mcp add socialrouter --scope user \
--env SOCIALROUTER_API_KEY=sr_live_xxxxxxxxxxxxx \
-- npx -y @socialrouter/mcpClaude Desktop
Open the Claude menu in the system menu bar → Settings… → Developer
→ Edit Config. That opens (or creates) claude_desktop_config.json:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"socialrouter": {
"command": "npx",
"args": ["-y", "@socialrouter/mcp"],
"env": {
"SOCIALROUTER_API_KEY": "sr_live_xxxxxxxxxxxxx"
}
}
}
}Quit Claude Desktop completely and reopen it, then check the + button in the chat box → Connectors → Manage connectors.
Cursor
Add the same mcpServers block to ~/.cursor/mcp.json (or .cursor/mcp.json
in a project), then enable the server from Cursor's MCP settings.
How it works
The server is a thin, stateless wrapper over the API, built around services
of the form <platform>/<service> (e.g. linkedin/profile.info,
reddit/subreddit.posts). The agent discovers what exists with
list_services, then calls run with the chosen service and its inputs. The
MCP does no URL detection and no routing — picking the right service is the
agent's job, and the catalog gives it everything it needs: the input kind
(URLs or free-text queries), the accepted URL shapes with concrete examples,
the typed options, and the offers behind the service with their price and
batch cap.
Which offer serves a run (apify/harshmaur, brightdata/reddit…) is the
router's call: it walks the failover chain, cheapest first, and the response's
served_by says which one answered. An agent can pin one with provider, but
pinning disables failover — omitting it is the better default.
Every call is validated against the live catalog (GET /v1/services)
before the request is sent:
- the
serviceparameter is an enum of the services live at startup, so the agent cannot invent one; - at call time the service is re-checked against the refreshed catalog (5-minute TTL), the batch size against the relevant cap (the pinned offer's, or the largest in the chain), and a pinned offer against the ones that actually serve that service;
- validation failures return corrective errors listing the valid alternatives instead of a bare 4xx.
The catalog is fetched once at startup — if it cannot be loaded the server exits, since an unreachable catalog means the API itself is unreachable — and refreshed lazily afterwards; if a refresh fails, the last known catalog keeps being served.
Tools
| Tool | Description |
|---|---|
| list_services | One row per live <platform>/<service>: input kind, accepted input shapes with examples, typed options, and the offers behind it (failover order, price per record, batch cap). Filter by platform and/or service. |
| run | Run a service over one or more inputs (URLs or queries, per the service's input kind). |
| get_extraction | Retrieve a past run by ID. |
| get_account | Credit balance, usage summary (by offer and platform) over the last N days (max 365), and the billing mode: own provider keys vs SocialRouter credits, per source. Read-only — provider keys are registered in the dashboard or with socialrouter credentials set, never through the MCP, so a token never passes through the agent's context. |
run parameters
| Param | Description |
|---|---|
| service | Required. <platform>/<service> slug from list_services, e.g. reddit/subreddit.posts. |
| inputs | Required. URLs (url-kind services) or search queries (query-kind services), all for the service's platform. |
| provider | Optional, advanced. Pin one offer, e.g. apify/harshmaur. Disables failover. |
| limit | Optional. Max records to return (default 100, max 250). |
| options | Optional, unless the service declares a required option (e.g. location on linkedin/job.search). Typed options declared by the service (see options in list_services). Unknown keys are rejected with a corrective error. |
Typical flow
list_serviceswithplatform: "linkedin"→ see what LinkedIn data is available, in what shape, and at what price.runwithservice: "linkedin/profile.info"andinputs: ["https://www.linkedin.com/in/..."].- Read
served_byin the result to know which offer answered, andbilled_asto know who paid.
When the API refuses a call, the tool error carries its message plus the structured fields that fix it (valid_options, allowed_values, invalid_inputs, did_you_mean…), the id of a failed run, and on a rate limit how many seconds to wait.
Environment Variables
| Variable | Required | Default |
|---|---|---|
| SOCIALROUTER_API_KEY | yes | — |
| SOCIALROUTER_BASE_URL | no | https://api.socialrouter.io |
Create a key at socialrouter.io/dashboard/keys. If the key is missing, invalid or revoked, the server says so and points there — at startup on stderr, and in the tool result if the key is rejected while running.
License
MIT
