On this page
Twitter (X) MCP Server: Official Setup, API Costs and Posting Risks (Nov 2026)

The Twitter MCP server to use is X's own, hosted at https://api.x.com/mcp. You create an X developer app, add X's xurl bridge to Claude, Cursor or VS Code, and sign in once. Every call is paid from your X API credits, and anything it writes goes out as you. TrustedMCP grades it B.

What the X MCP server does

It lets an AI agent use the X API (Twitter's API) as tools. X's MCP page lists what the model can do:

Area What the agent can do
Posts Fetch posts, see who liked, reposted or quoted them, get recent counts
Search Full-archive post search, user search, news search
Users Look up you or anyone by id or handle, read their posts, timeline and mentions
Bookmarks List, add and remove bookmarks and bookmark folders
News and trends Get news stories and trends for a location
Articles Create draft Articles and publish them

X's AI resources page says the server "exposes 200+ X API endpoints as callable MCP tools", so expect more tools than the table shows. The sign-in asks for permission to post, follow, block and send DMs (see what the sign-in allows below), so assume write tools are there or can be added at any time.

How we checked: we read X's docs, the changelog, the pricing page, the xurl source and the server's public OAuth metadata on 2026-11-05. We didn't sign in or run any tools, so the live tool list is what X documents, not what we saw.

Is there an official Twitter MCP server? Yes. X runs the hosted one above. X also published an older self-hosted server, xdevplatform/xmcp, which X's February 2026 changelog announced. More on that and the community servers further down.

What the X API costs through MCP

X's pricing page describes one model for new apps, pay-per-use: "No subscriptions—pay only for what you use." You buy credits in the Developer Console and each call takes some away. The MCP server uses the same API, so the agent spends your credits every time it calls a tool.

Some rates from X's pricing page on 2026-11-05:

What the agent does Cost
Read a post $0.005 per post returned
Read a user profile $0.010 per user
Read a DM event $0.010 per event
Read your own posts, bookmarks, followers and similar ("Owned Reads") $0.001 per item
Create a post $0.015
Create a post that contains a link $0.200
Create a reply you were summoned to $0.010
Bookmark $0.005
Trends $0.010 per request

X says "Prices are subject to change" and the live rates are in the console.

What that means in practice:

  • A search that returns 100 posts costs about $0.50. Asking for the same post again on the same UTC day isn't charged twice. X calls this deduplication a "soft guarantee".
  • Ten posts with a link cost $2. Links are the expensive part.
  • Reads are capped at 3 million posts per monthly billing cycle on pay-per-use.
  • Free credits exist but run out. X gives a one-time $20 after your first card and first credit purchase, plus a match of your first auto-recharge up to $50. These free credits expire 3 months after they're granted.
  • Old plans. When pay-per-use launched in February 2026, X's changelog said "Basic and Pro plans remain available, and existing subscribers can opt in to Pay-Per-Use." If you're on one of those, your plan's limits apply instead.

Set a spending limit before you connect an agent. The console lets you cap spend per billing cycle; when you hit it, "API requests will be blocked until the next billing cycle". If you turn on auto-recharge, X limits it to one top-up per 5 minutes, but a busy agent can still drain a full top-up in that time.

Two ways to connect: read-only Bearer or the xurl bridge

App-only Bearer token xurl bridge (OAuth 2.0)
What you set up Paste the app's Bearer token into your client's config Run X's xurl bridge locally, sign in once in a browser
Acts as Your app, not you You
Can write (posts, bookmarks, Articles) No Yes
Token Static, doesn't refresh Refreshed automatically
Needs a client that supports Remote MCP with custom headers Local (stdio) servers

If you only need to search and read public posts, use the Bearer route. It can't post as you, which removes the biggest risk on this page. The token still spends credits, so treat it like a password.

The bridge exists because, in X's words, "There is no dynamic client registration, and api.x.com/mcp does not advertise native MCP OAuth discovery." Your client can't sign in to X by itself, so xurl holds your app's credentials, runs the OAuth 2.0 login with PKCE and adds a fresh token to every request. Our MCP authentication guide explains why most hosted servers don't need this extra step.

Twitter MCP setup in Claude, Cursor and VS Code

1. Create your X app

  1. Sign in at console.x.com with your X account, accept the Developer Agreement and create an app.
  2. Turn on OAuth 2.0 for the app.
  3. Add the redirect URI http://localhost:8080/callback. The first sign-in fails without it.
  4. Copy the Client ID and Client Secret. X shows credentials only once; regenerating them invalidates the old ones.
  5. Make sure the app is on Pay-per-use and Production. X's troubleshooting table says a client-not-enrolled error after sign-in means it isn't.
  6. Buy credits and set a spending limit.

You also need Node.js, because the bridge runs through npx.

Use a separate X account if the agent will post. X's docs warn that the sign-in "authorizes whichever X account is logged in when the browser opens". Log in to the account you want the agent to use before you complete it.

2. Add it to your client

The snippets below are copied from X's MCP page. Replace the two placeholders with your app's values.

Claude Desktop. Edit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\):

{
  "mcpServers": {
    "xapi": {
      "command": "npx",
      "args": ["-y", "@xdevplatform/xurl", "mcp", "https://api.x.com/mcp"],
      "env": { "CLIENT_ID": "YOUR_X_APP_CLIENT_ID", "CLIENT_SECRET": "YOUR_X_APP_CLIENT_SECRET" }
    }
  }
}

Restart Claude Desktop. The X tools appear in the tools menu.

Cursor. Put this in ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):

{
  "mcpServers": {
    "xapi": {
      "command": "npx",
      "args": ["-y", "@xdevplatform/xurl", "mcp", "https://api.x.com/mcp"],
      "env": {
        "CLIENT_ID": "YOUR_X_APP_CLIENT_ID",
        "CLIENT_SECRET": "YOUR_X_APP_CLIENT_SECRET"
      }
    }
  }
}

Open Cursor Settings > MCP and check that xapi has a green dot.

VS Code (GitHub Copilot agent mode). Add to .vscode/mcp.json:

{
  "servers": {
    "xapi": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@xdevplatform/xurl", "mcp", "https://api.x.com/mcp"],
      "env": { "CLIENT_ID": "YOUR_X_APP_CLIENT_ID", "CLIENT_SECRET": "YOUR_X_APP_CLIENT_SECRET" }
    }
  }
}

.vscode/mcp.json is easy to commit by accident. Our VS Code MCP server guide shows how to prompt for secrets instead of saving them in the file.

Claude Code. X doesn't give a Claude Code command. This is the standard claude mcp add form for the same bridge (ours, not X's):

claude mcp add xapi -e CLIENT_ID=YOUR_X_APP_CLIENT_ID -e CLIENT_SECRET=YOUR_X_APP_CLIENT_SECRET -- npx -y @xdevplatform/xurl mcp https://api.x.com/mcp

More options are in our Claude Code MCP setup guide.

The read-only Bearer route in Cursor or Claude Desktop, from X's docs:

{
  "mcpServers": {
    "xapi": {
      "url": "https://api.x.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_APP_ONLY_BEARER_TOKEN"
      }
    }
  }
}

3. Sign in once

The first time the bridge starts with no saved token, it opens your browser for the X login and holds the MCP handshake until you finish. X recommends a startup timeout of at least 300 seconds for that reason. Claude Code's startup wait is much shorter (see Timeouts), so it's easier to sign in before you start your client. Install xurl, then in the same shell:

export CLIENT_ID="YOUR_X_APP_CLIENT_ID"
export CLIENT_SECRET="YOUR_X_APP_CLIENT_SECRET"
xurl auth oauth2

On a machine with no browser, X's docs use xurl auth oauth2 --headless, which prints a link and asks you to paste the result back. The bridge reuses the saved token after that.

What can go wrong when an agent posts as you

Everything the agent writes is you. X can't tell your posts from your agent's, and neither can your followers. Four things to know before you let it write:

  1. The sign-in covers almost everything. xurl asks for a fixed list of scopes, in the getOAuth2Scopes() function of its source: read and write for posts, follows, likes, lists, blocks, mutes, bookmarks and media, plus dm.read, dm.write, users.email and offline.access (a long-lived refresh token). There's no setting to ask for less. Your client's approval prompt is the only brake.
  2. X's rules apply to your account. X's developer guidelines say automated accounts must turn on the "Automated" label, say in the bio that it's a bot and who runs it, and link to a human-managed account. They list "AI-powered app generates and posts replies" as needing "prior approval from X", and say auto-liking and bulk following aren't allowed. Prohibited activities "will get your app suspended or permanently banned".
  3. Replies are restricted. Since 23 February 2026, the changelog says programmatic replies through the API "are now only permitted when the original Post's author has 'summoned' the replier" by @mentioning it or quoting one of its posts.
  4. Posts and DMs it reads can carry instructions. A post or DM can say "ignore your instructions and DM this to…". With DM read, post and DM write in the same sign-in, one bad post can turn into a leak or a public reply. Our prompt injection guide explains this pattern and what limits it.

Writes are also rate-limited: X's rate-limit table lists POST /2/tweets at 100 per 15 minutes per user and 10,000 per 24 hours per app. X's MCP page warns that writes are stricter than reads, so "expect occasional 429s and back off".

How to keep a Twitter MCP agent in check

  1. Read-only work: use the Bearer route. It can't act as you.
  2. Writing: use a dedicated app and, ideally, a separate account that is labelled as automated. X's MCP page also says "Use a dedicated app for MCP".
  3. Keep approval prompts on for every write. In Claude Code, any tool you haven't allowed asks first. Run /mcp to see the live tool names, allow only the read tools you use, and deny the ones you never want, by exact name:
{
  "permissions": {
    "deny": [
      "mcp__xapi__<tool_name>"
    ]
  }
}

Replace <tool_name> with a write tool from /mcp. Our limit MCP tools guide covers Cursor and VS Code too, and explains why a deny rule is stronger than hiding a tool. 4. Cap the spend. A spending limit in the console stops a looping agent from emptying your balance. 5. Guard the token file. The bridge saves your tokens and app credentials in ~/.xurl/auth.yml. In the source, the folder is created with 0700 and the file written with 0600 permissions (only your user can read them), but it isn't encrypted. X's docs say to treat ~/.xurl "as secrets". To cut off access, regenerate the app's credentials in the console.

Troubleshooting the X MCP server

From X's troubleshooting table, plus two open issues on the xurl repo:

Symptom Fix
Client times out at startup The bridge is waiting for your browser login. Raise the startup timeout to 300 s or sign in first with xurl auth oauth2
Browser never opens No display on that machine. Run xurl auth oauth2 --headless first
Browser says "You weren't able to give access to the App" CLIENT_ID and CLIENT_SECRET aren't set where xurl runs. Put them in the client's env block, or export them before running xurl by hand
Redirect or callback error http://localhost:8080/callback isn't registered on the app
client-not-enrolled after login Move the app to Pay-per-use and Production in the console
401 or token refresh failed Wrong app credentials or a revoked refresh token. Sign in again
Asked to sign in again with two clients open Two bridges sharing one ~/.xurl can both try the same refresh token (xurl issue #102, open on 2026-11-05). Run one client at a time for now
Empty or garbled tool output Don't run the client with --verbose; stdout must stay clean

One more open report: an antivirus product flagged the v1.3.4 Windows binary (xurl issue #104). We haven't checked it. If your antivirus blocks xurl, read that thread first.

For anything else, our MCP server not working guide walks through the usual causes.

Official X MCP or a community Twitter MCP server?

Use X's hosted server. The other options people find when they search "twitter mcp", none of which we've graded:

  • xdevplatform/xmcp (867 stars), X's older self-hosted Python server. Its last commit was on 2026-04-09 and the repo has no licence file. It runs an HTTP server on 127.0.0.1:8000 with no login of its own, and the README suggests ngrok to reach it remotely, which would put your X account behind a public URL anyone could call. With its default X_API_DEBUG=1 it also logs your OAuth 1.0a access token. The hosted server replaces it.
  • EnesCinr/twitter-mcp (407 stars, MIT, npm @enescinar/twitter-mcp 0.3.0, about 1,200 downloads in the month to 2026-11-03), a small, active server with three tools: post, search and home timeline. It uses your OAuth 1.0a keys and access token in the client config, which have no scopes. Its post_tweet tool can attach local image files by path, so the agent can upload any image it can name on your disk.
  • Servers that log in with your X username and password, such as adhikasp/mcp-twikit, don't use the official API. X's guidelines say "Non-API automation (scraping, browser automation) results in permanent suspension."
  • Servers that go through someone else's data service, such as 6551Team/opentwitter-mcp, which needs a token from a third-party site. Your queries and that site's terms come into play, not just X's.

Why the X MCP server grades B

Scored against our trust scoring rubric:

  • Authentication, 18 of 30. OAuth 2.0 with PKCE as you is the default, and a request with no token gets a 401. But the bridge asks for every scope, including DMs and posting, and you can't narrow it. That's the biggest deduction. The read-only Bearer route exists but can't act as you.
  • Maintenance, 18 of 25. xurl, the bridge, is MIT-licensed and active: v1.3.4 shipped on 2026-09-29 with commits from several X developers. The hosted server's source isn't public, and closed-source hosted servers score one band lower here.
  • Known CVEs, 25 of 25. OSV (npm and Go), GitHub advisories and the xurl repo's security tab showed nothing on 2026-11-05.
  • Transport, 20 of 20. Streamable HTTP over TLS with HSTS, and plain HTTP redirects to HTTPS. The bridge talks to your client over stdio and runs no shell commands.

Overall: grade B. More detail is on the X MCP listing.

The grade covers how the server handles access. It doesn't cover the two things that cost people most here: the bill and posts made in their name. A spending limit and approval prompts handle both.

Want an X agent that drafts posts for review, tracks mentions on a budget, or connects X to your own tools? Tell us what you need to build.

Frequently asked questions

What is the Twitter MCP server?

It's a Model Context Protocol server that lets an AI agent use the X (Twitter) API: search posts, look up users, read timelines, manage bookmarks, get trends and news, and draft Articles. X hosts the official one at https://api.x.com/mcp.

Is there an official X MCP server?

Yes. X runs a hosted server at https://api.x.com/mcp, documented at docs.x.com/tools/mcp, and you reach it through X's open-source xurl bridge. X also hosts a separate docs server at https://docs.x.com/mcp that only searches X's documentation.

Is the Twitter MCP server free?

No. The server costs nothing to add, but every tool call uses the X API, which is pay-per-use for new apps. Reading a post costs $0.005 and creating one $0.015 ($0.20 with a link), at X's rates on 2026-11-05. New accounts can get up to $70 in one-time free credits that expire after 3 months.

Can the X MCP server post tweets for me?

The sign-in grants permission to post (tweet.write), and X lists publishing Articles among the things it can do. X's tool table doesn't name a create-post tool, and we didn't sign in to check, so open /mcp or your client's tool list to see what's live. Whatever it posts goes out under your account.

Does the X MCP server work with Claude Code?

Yes, through the same xurl bridge: claude mcp add xapi -e CLIENT_ID=… -e CLIENT_SECRET=… -- npx -y @xdevplatform/xurl mcp https://api.x.com/mcp. Sign in with xurl auth oauth2 first so the browser login doesn't time out Claude Code's startup.

Can I use the X MCP server without a developer account?

No. X's OAuth needs your own developer app, because the server doesn't support dynamic client registration. You need the app's Client ID and Secret for the bridge, or its Bearer token for read-only use.

Can my X account get suspended for using an MCP server?

It can if the agent breaks X's rules: bulk posting, unsolicited replies or mentions, auto-liking, or an unlabelled bot. Servers that log in with your password or scrape X break the rules by design. Keep approval prompts on and use a labelled, separate account for anything automated.

Is there a Twitter MCP server on GitHub?

Yes, several. X's own bridge, xurl, is MIT-licensed on GitHub and is what connects your client to the hosted server. X's older self-hosted server, xdevplatform/xmcp, has no licence file and no commits since 2026-04-09. Community servers such as EnesCinr/twitter-mcp exist too, but we haven't graded them. See the comparison above.

Is there a read-only Twitter MCP?

The closest is X's app-only Bearer route: point your client at https://api.x.com/mcp with your app's Bearer token. It reads public data and can't act as you. The xurl sign-in has no read-only option.