x-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@x-mcpWhat's my account pulse and are there any unanswered mentions?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
x-mcp
An opinionated MCP server for running an X account with an agent.
It is not a wrapper around the X API. It is a small operator that knows four things the API does not tell you:
How For You ranks — the weights, gates and filters from X's open-sourced algorithm (xai-org/x-algorithm) are built into every tool as guardrails and advice: reply weight 5→20 for mutuals, copy-link share 20, like 0.5; strictly >10s video; ≤1 @-mention; no engagement bait; ≥4h between originals; the first favorite opens the out-of-network corpus; sub-1k-follower cold-start lift; 24h/48h windows.
What the pay-per-use API actually allows — since 2026 X rejects un-summoned replies and removed follows, likes and quote posts from self-serve. The tools do everything that is allowed and hand the human a one-tap intent link for the rest, then auto-reconcile what the human did from $0.001 owned reads.
What every call costs — a local ledger mirrors X's per-resource pricing (with the 24h dedup), enforces a monthly budget, and warns you before the $0.20 "post with URL".
What a business keeps — a relationship ledger of everyone who engaged (and who to follow back), a calendar that learns your best hours, a brand book every session shares, an idea pipeline, and an insights/report loop so the agent steers on its own numbers instead of vibes.
Built on the MCP TypeScript SDK v2. stdio by default, Streamable HTTP optional. Zero runtime dependencies beyond the SDK and zod.
Tools
Tool | What it does | Cost |
| One-call briefing: follower delta, your recent posts with velocity + algorithm milestones, unanswered mentions, human queue, spend | ~$0.02–0.05 |
| Refresh metrics, compute velocity, explain each post's state (in OON corpus? cold-start live? next re-index at N likes? ages out at 48h) | $0.001/post |
| Mentions/replies to you, prioritised (on your post > mutual > large account), all API-replyable | $0.001/item |
| Read a thread before answering | $0.005/post |
| Search the niche and rank posts as opportunities (author band, freshness, question, activity) with intent links; capped + dedup'd | $0.005/post |
| Account lookup: band, relationship (mutual = +15 reply weight), pinned post | $0.01 |
| Original post / self-thread / community / poll, with chunked v2 media upload; rules engine + spacing + video gate + budget; | $0.015 ($0.20 with URL) |
| Reply to posts that summoned you; one reply per interaction; copypasta guard; throttle; hands off cold replies with an intent link | $0.01 |
| Repost (informational, throttled 10/day) | $0.015 |
| Delete your post | $0.01 |
| DM only after the recipient DM'd you (policy) | $0.015 |
| Human queue: quote / follow / like / cold reply / manual post → x.com/intent links; | $0.001 on reconcile |
| "What should I do now?" — ranked next calls from local state: unanswered inbound, due calendar, open spacing window at a best hour, follow-backs, stale metrics, human queue, goal pace | free |
| Relationship ledger (CRM) auto-built from every mention/reply: top engagers, notes/tags, | free |
| Content calendar: | free |
| What works: OON-entry rate (first like within 24h), engagement@24h, reply rate on inbound, by kind/tag/hour, top posts, follower deltas, spend per engagement, goal progress, advice | free |
| Brand book: lane, voice rules, banned words (enforced in | free |
| Idea bank → | free |
| Owner digest in markdown (also | free |
| Score a draft (and variants) against the For You rules + the brand book | free |
| Ledger: month-to-date, by op, by tool, price table | free |
| Auth, scopes, config, rate limits, API boundary | free |
| Approval-mode queue (list/reject; approving is CLI-only) | free |
Resources: x://playbook (the rules), x://boundary (what the API allows), x://handoff (live human queue). Prompt: operate (the working loop).
Related MCP server: X(Twitter) V2 MCP Server
Setup
Create an app at https://console.x.com → enable OAuth 2.0 → app type Native App (public, PKCE) or Automated App/Bot (confidential, gives a client secret) → add redirect URI
http://127.0.0.1:8477/callback→ copy the Client ID (and secret if confidential). Load some credits (pay-per-use).Configure — env vars are read from the environment or from
~/.x-mcp/.env(never from the current directory, so a hostile repo's.envcan't redirect your token):cd x-mcp && npm install && npm run build mkdir -p ~/.x-mcp/media && cp .env.example ~/.x-mcp/.env # set X_CLIENT_ID (+ X_CLIENT_SECRET if confidential)Media the agent may upload must live under
~/.x-mcp/media(or the dirs inX_MCP_MEDIA_ROOT) — drop your demo video there.Log in once (opens a browser, stores tokens in
~/.x-mcp/tokens.json, mode 0600):node dist/bin.js loginAttach to your agent.
Hermes (
~/.hermes/config.yaml):mcp_servers: x: command: node args: ["/absolute/path/to/x-mcp/dist/bin.js"] env: X_CLIENT_ID: "…" X_CLIENT_SECRET: "…" # confidential apps only X_MCP_MONTHLY_BUDGET_USD: "25" X_MCP_REQUIRE_APPROVAL: "true" # default; keep until you have X's AI-reply approval timeout: 180Claude Code:
claude mcp add x -e X_CLIENT_ID=… -e X_MCP_REQUIRE_APPROVAL=true -- node /absolute/path/to/x-mcp/dist/bin.jsHTTP instead of stdio:
X_MCP_HTTP_TOKEN=SECRET node dist/bin.js --http --port 8478→url: http://127.0.0.1:8478/mcp, headerAuthorization: Bearer SECRET. A token is always required (one is generated and printed if you don't set it); Host/Origin are checked against localhost.Run the loop. Ask the agent to use the
operateprompt (or paste it). Checknode dist/bin.js queuefor anything waiting on you;node dist/bin.js approve --allexecutes queued API actions; tap the intent links for the human-only actions and runhandoff(reconcile)(or let the agent do it) so the queue clears itself.Put
tickon a timer (every 15 min is plenty) so scheduled posts go out, handoffs reconcile, and metrics get snapshotted forinsights:*/15 * * * * cd /absolute/path/to/x-mcp && node dist/bin.js tick >> ~/.x-mcp/tick.log 2>&1(Hermes users: a cron job that calls
schedule(run_due)+handoff(reconcile)+post_performancedoes the same.)
Configuration (env)
Var | Default | Meaning |
| — | required |
| — | confidential apps only |
|
| must match the app settings |
|
| tokens, ledger, state, |
|
| comma-separated dirs the agent may upload from (realpath-checked; dotfiles, URLs and symlink escapes refused) |
|
| hard stop |
|
| warn at 80% |
|
| park writes for |
|
| author-diversity / cold-start spacing |
|
| throttles (ledger-based) |
|
| Jaccard on word bigrams |
|
| cap on $0.005 reads per tool call |
|
| per-request timeout |
| auto | ffprobe path (falls back to parsing the MP4 header) |
| unset | required to honour a non-default |
What it will refuse, and why
Two or more @-mentions in a post → routed into real-time LLM spam scoring by X. Put credits in a reply.
"Like if / RT for / tag someone" →
SpamHighRecall, no exemption for anyone.A video ≤10.0s → video head is 0 and the post is excluded from every video corpus.
Video + image in one post → disqualified from the video corpora.
A second original within 4h → ×0.625 in shared slates; the cold-start lift picks one post per request.
Same reply text twice → copypasta clustering.
Replying to a post that did not @mention you → X rejects it; you get an intent link instead.
Any spend past the monthly budget.
Everything soft can be overridden with force: true — which always routes the action to the human approval queue; media roots, the budget and X's own limits cannot be overridden.
Security model (short)
Tokens/state live in
~/.x-mcp(0700 dir, 0600 files); the server and thex-mcp approveCLI share them safely (reload-before-write, never overwrite a newer token set).The agent cannot read arbitrary files:
media_pathsmust resolve under the media roots; IDs are validated as numeric snowflakes (no../path smuggling into other endpoints).Irreversible or policy-sensitive actions (
delete_post, anyforce, DMs, approval mode) require a human tap in the CLI.delete_postonly accepts posts this server knows as yours.Third-party text in tool outputs is labelled as data, not instructions. HTTP mode needs a bearer token and validates Host/Origin.
Policy notes you should read
X's automation rules (April 2026) require prior written approval for AI reply bots, one automated reply per user interaction, no duplicate posts, no bulk follows/likes/DMs, and the Automated account label (Settings → Your account → Account information → Automation). This server enforces the mechanical parts; the approval and the label are yours to get and set.
The developer-agreement use case you submitted should describe what the agent does (posting, own-metrics reads, niche research).
Development
npm test # rules engine + full server through an in-memory MCP client against a mock X API
npm run typecheck
npm run buildSources: X API docs (docs.x.com, read 2026-08-19: pricing, manage-posts restrictions, changelog, media v2, OAuth 2.0), and xai-org/x-algorithm@11a71f8 (home-mixer/params/param.rs, scorers/, filters/, visibility-filtering/, phoenix/, grox/). See docs/FOR_YOU_PLAYBOOK.md in the x-algorithm clone for the full research with file:line citations.
MIT.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityDmaintenanceAn MCP server that provides AI agents with full access to the X (Twitter) API for posting, searching, and managing engagement through natural language. It supports comprehensive tools for tweet management, media uploads, and account analytics across multiple MCP-compatible clients.1550
- Alicense-qualityDmaintenanceAn MCP server for interacting with the Twitter/X API v2, enabling AI assistants to retrieve tweets, post content, reply, quote, and more programmatically.1,29913MIT
- Alicense-qualityBmaintenanceAn MCP server that enables AI agents to automate actions on X (Twitter) through a real browser session, including posting, engaging, and reading via over 40 tools. It supports self-hosting and provides a panel for API key management.37MIT

X API FastMCP Serverofficial
Flicense-qualityFmaintenanceA local MCP server that exposes the X API (formerly Twitter API) as tools, enabling operations like posting, searching, user management, and more via natural language commands.851
Related MCP Connectors
FastMCP server for posting formatted content to X (Twitter) — Tollbooth-monetized, DPYC-native
Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.
Remote MCP server for The Colony — a social network for AI agents (posts, DMs, search, marketplace).
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rthomas24/x-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server