1. Conduid
  2. Developer Tools
  3. X MCP
MCP server · Developer Tools

X MCP

MCP server for the X (Twitter) API -- give AI agents the ability to post, search, read, and engage on X

Unclaimed last commit 7 months ago devtools
56Fair

Scored 6 days ago · breakdown

About X MCP

X MCP is an MCP server published by Infatoshi in the Developer Tools category: mCP server for the X (Twitter) API -- give AI agents the ability to post, search, read, and engage on X.

The repository has 57 stars and 16 forks, with the last commit 7 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/Infatoshi/x-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Tools (19)

bookmark_tweetBookmark a post on X.

Parameters not published.

delete_tweetDelete a post on X by its ID.

Parameters not published.

get_bookmarksFetch the authenticated user

Parameters not published.

get_followersList followers of a user by their numeric user ID.

Parameters not published.

get_followingList who a user follows by their numeric user ID.

Parameters not published.

get_mentionsFetch recent mentions of the authenticated user.

Parameters not published.

get_metricsGet engagement metrics for a specific post (impressions, likes, retweets, replies, quotes, bookmarks). Requires the tweet to be authored by the authenticated user for non-public metrics.

Parameters not published.

get_timelineFetch a user

Parameters not published.

get_tweetFetch a tweet and its metadata by ID or URL. Returns author info, metrics, and referenced tweets.

Parameters not published.

get_userLook up a user profile by username or user ID. Returns bio, metrics, verification status, etc.

Parameters not published.

Show all 19 tools
like_tweetLike a post on X. NOTE: As of Aug 2025, this endpoint was removed from the Free API tier. Only works on paid tiers (Basic, Pro, Enterprise).

Parameters not published.

post_tweetCreate a new post on X (Twitter). Supports text, polls, and media attachments.

Parameters not published.

quote_tweetQuote retweet a post on X. Adds your commentary above the quoted post.

Parameters not published.

reply_to_tweetReply to an existing post on X. Provide the tweet ID or URL to reply to. NOTE: As of Feb 2026, X restricts programmatic replies on all self-serve tiers (Free, Basic, Pro, Pay-Per-Use) -- you can only reply if the original author @mentions you or quotes your post. Otherwise the API will return an error. Enterprise is exempt. Consider using quote_tweet as an alternative.

Parameters not published.

retweetRetweet a post on X.

Parameters not published.

search_tweetsSearch recent tweets by query. Supports keywords, hashtags, from:user, to:user, is:reply, has:media, etc. Uses the recent search endpoint (last 7 days).

Parameters not published.

setup_oauth2One-time setup: Authorize OAuth 2.0 for bookmark access. Opens a browser for X login. Required before using get_bookmarks, bookmark_tweet, or unbookmark_tweet.

Parameters not published.

unbookmark_tweetRemove a bookmark from a post on X.

Parameters not published.

upload_mediaUpload an image or video to X. Returns a media_id that can be attached to posts. Provide the file as base64-encoded data.

Parameters not published.

Ask AI

✦

Ask AI about X MCP

Powered by Claude · Grounded in docs

I know everything about X MCP. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 5 days ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • !License declaredNo license file. Legally you have no right to use it in a product.
  • !Tests presentNo tests found. Behaviour changes may go unnoticed between versions.
  • ✓Dependencies pinnedA lockfile pins dependency versions.
  • !No dynamic code executionSource scan found eval or shell execution. Review how tool inputs reach it before granting credentials.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

README

x-mcp

An MCP (Model Context Protocol) server that gives AI agents full access to the X (Twitter) API. Post tweets, search, read timelines, like, retweet, upload media -- all through natural language.

Works with Claude Code, Claude Desktop, OpenAI Codex, Cursor, Windsurf, Cline, and any other MCP-compatible client.

If you're an LLM/AI agent helping a user set up this project, read LLMs.md for step-by-step instructions you can walk the user through.


What Can It Do?

Category Tools What You Can Say Status
Post post_tweet, quote_tweet, delete_tweet "Post 'hello world' on X" OK
Read get_tweet, search_tweets, get_timeline, get_mentions "Show me @elonmusk's latest posts" OK
Users get_user, get_followers, get_following "Look up @openai" / "Who does this user follow?" OK
Engage retweet "Retweet this" OK
Media upload_media "Upload this image and post it with the caption..." OK
Analytics get_metrics "How many impressions did my last post get?" OK
Bookmarks get_bookmarks, bookmark_tweet, unbookmark_tweet "Show my bookmarks" Requires Basic+ tier
Reply reply_to_tweet "Reply to this tweet saying thanks" Restricted (see below)
Like like_tweet "Like that tweet" Removed on Free tier (see below)

Accepts tweet URLs or IDs interchangeably -- paste https://x.com/user/status/123 or just 123.


Setup

1. Clone and build

git clone https://github.com/INFATOSHI/x-mcp.git
cd x-mcp
npm install
npm run build

2. Get your X API credentials

You need 5 credentials from the X Developer Portal. Here's exactly how to get them:

a) Create an app

  1. Go to the X Developer Portal
  2. Sign in with your X account
  3. Go to Apps in the left sidebar
  4. Click Create App (you may need to sign up for a developer account first)
  5. Give it a name (e.g., my-x-mcp)
  6. You'll immediately see your Consumer Key (API Key), Secret Key (API Secret), and Bearer Token
  7. Save all three now -- the secret won't be shown again

b) Enable write permissions

By default, new apps only have Read permissions. You need Read and Write to post tweets, like, retweet, etc.

  1. In your app's page, scroll down to User authentication settings
  2. Click Set up
  3. Set App permissions to Read and write
  4. Set Type of App to Web App, Automated App or Bot
  5. Set Callback URI / Redirect URL to https://localhost (required but won't be used)
  6. Set Website URL to any valid URL (e.g., https://x.com)
  7. Click Save

c) Generate access tokens (with write permissions)

After enabling write permissions, you need to generate (or regenerate) your Access Token and Secret so they carry the new permissions:

  1. Go back to your app's Keys and Tokens page
  2. Under Access Token and Secret, click Regenerate
  3. Save both the Access Token and Access Token Secret

If you skip step (b) before generating tokens, your tokens will be Read-only and posting will fail with a 403 error.

3. Configure credentials

Copy the example env file and fill in your 5 credentials:

cp .env.example .env

Edit .env:

X_API_KEY=your_consumer_key
X_API_SECRET=your_secret_key
X_BEARER_TOKEN=your_bearer_token
X_ACCESS_TOKEN=your_access_token
X_ACCESS_TOKEN_SECRET=your_access_token_secret

Connect to Your Client

Pick your client below. You only need to follow one section.

Claude Code

claude mcp add --scope user x-twitter -- node /ABSOLUTE/PATH/TO/x-mcp/dist/index.js

Replace /ABSOLUTE/PATH/TO/x-mcp with the actual path where you cloned the repo. Then restart Claude Code.

Claude Desktop

Add to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "x-twitter": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/x-mcp/dist/index.js"],
      "env": {
        "X_API_KEY": "your_consumer_key",
        "X_API_SECRET": "your_secret_key",
        "X_ACCESS_TOKEN": "your_access_token",
        "X_ACCESS_TOKEN_SECRET": "your_access_token_secret",
        "X_BEARER_TOKEN": "your_bearer_token"
      }
    }
  }
}

Cursor

Add to your Cursor MCP config:

  • Global (all projects): ~/.cursor/mcp.json
  • Project-scoped: .cursor/mcp.json in your project root
{
  "mcpServers": {
    "x-twitter": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/x-mcp/dist/index.js"],
      "env": {
        "X_API_KEY": "your_consumer_key",
        "X_API_SECRET": "your_secret_key",
        "X_ACCESS_TOKEN": "your_access_token",
        "X_ACCESS_TOKEN_SECRET": "your_access_token_secret",
        "X_BEARER_TOKEN": "your_bearer_token"
      }
    }
  }
}

You can also verify the connection in Cursor Settings > MCP Servers.

OpenAI Codex

Option A: CLI

codex mcp add x-twitter --env X_API_KEY=your_consumer_key --env X_API_SECRET=your_secret_key --env X_ACCESS_TOKEN=your_access_token --env X_ACCESS_TOKEN_SECRET=your_access_token_secret --env X_BEARER_TOKEN=your_bearer_token -- node /ABSOLUTE/PATH/TO/x-mcp/dist/index.js

Option B: config.toml

Add to ~/.codex/config.toml (global) or .codex/config.toml (project-scoped):

[mcp_servers.x-twitter]
command = "node"
args = ["/ABSOLUTE/PATH/TO/x-mcp/dist/index.js"]

[mcp_servers.x-twitter.env]
X_API_KEY = "your_consumer_key"
X_API_SECRET = "your_secret_key"
X_ACCESS_TOKEN = "your_access_token"
X_ACCESS_TOKEN_SECRET = "your_access_token_secret"
X_BEARER_TOKEN = "your_bearer_token"

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "x-twitter": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/x-mcp/dist/index.js"],
      "env": {
        "X_API_KEY": "your_consumer_key",
        "X_API_SECRET": "your_secret_key",
        "X_ACCESS_TOKEN": "your_access_token",
        "X_ACCESS_TOKEN_SECRET": "your_access_token_secret",
        "X_BEARER_TOKEN": "your_bearer_token"
      }
    }
  }
}

You can also add it from Windsurf Settings > Cascade > MCP Servers.

Cline (VS Code)

Open Cline's MCP settings (click the MCP Servers icon in Cline's top nav > Configure), then add to cline_mcp_settings.json:

{
  "mcpServers": {
    "x-twitter": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/x-mcp/dist/index.js"],
      "env": {
        "X_API_KEY": "your_consumer_key",
        "X_API_SECRET": "your_secret_key",
        "X_ACCESS_TOKEN": "your_access_token",
        "X_ACCESS_TOKEN_SECRET": "your_access_token_secret",
        "X_BEARER_TOKEN": "your_bearer_token"
      },
      "alwaysAllow": [],
      "disabled": false
    }
  }
}

Other MCP Clients

This is a standard stdio MCP server. For any MCP-compatible client, point it at:

node /ABSOLUTE/PATH/TO/x-mcp/dist/index.js

With these environment variables: X_API_KEY, X_API_SECRET, X_ACCESS_TOKEN, X_ACCESS_TOKEN_SECRET, X_BEARER_TOKEN.


API Restrictions (as of 2025-2026)

X has progressively restricted what automated/API clients can do. Here's what affects x-mcp:

Likes removed from Free tier (Aug 2025)

The like_tweet endpoint (POST /2/users/:id/likes) was removed from the Free API tier in August 2025. If you're on the Free tier, like_tweet will return a permissions error. Paid tiers (Basic, Pro, Enterprise) are unaffected.

Programmatic replies restricted (Feb 2026)

Replies via the API now only succeed if the original post's author @mentioned you or quoted your post. This applies to all self-serve tiers (Free, Basic, Pro, Pay-Per-Use). Only Enterprise is exempt. Use quote_tweet as a workaround.

Bookmarks require Basic+ tier

Bookmark endpoints have never been available on the Free tier. You need at least Basic ($200/mo) to use get_bookmarks, bookmark_tweet, and unbookmark_tweet.

Post volume caps

Free tier: 500 posts/month. Basic: 10,000/month. Pro: 1,000,000/month.


Troubleshooting

403 "oauth1-permissions" error when posting

Your Access Token was generated before you enabled write permissions. Go to the X Developer Portal, ensure App permissions are set to "Read and write", then Regenerate your Access Token and Secret.

401 Unauthorized

Double-check that all 5 credentials in your .env are correct and that there are no extra spaces or line breaks.

429 Rate Limited

The error message includes exactly when the rate limit resets. Wait until then, or reduce request frequency.

Reply fails with a permissions/restriction error

As of Feb 2026, X restricts programmatic replies via the API on all self-serve tiers. You can only reply if the original author @mentions you or quotes your post. This applies to Free, Basic, Pro, and Pay-Per-Use tiers (Enterprise is exempt). Use quote_tweet as a workaround.

Server shows "Connected" but tools aren't used

Make sure you added the server with the correct scope (user/global, not project-scoped if you want it everywhere), then restart your client.


Rate Limiting

Every response includes rate limit info: remaining requests, total limit, and reset time. When a limit is hit, you get a clear error with the exact reset timestamp.

Pagination

List endpoints return a next_token in the response. Pass it back to get the next page of results. Works on: search_tweets, get_timeline, get_mentions, get_followers, get_following.

Search Query Syntax

The search_tweets tool supports X's full query language:

  • from:username -- posts by a specific user
  • to:username -- replies to a specific user
  • #hashtag -- posts containing a hashtag
  • "exact phrase" -- exact text match
  • has:media / has:links / has:images -- filter by content type
  • is:reply / -is:retweet -- filter by post type
  • lang:en -- filter by language
  • Combine with spaces (AND) or OR

License

MIT

README fetched from the repository 5 days ago. The original is authoritative.

Questions

About X MCP

How do I install X MCP?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is X MCP safe to use with an AI agent?

Its trust score is 56 out of 100 (fair). It passes 2 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is X MCP still maintained?

The last commit was 7 months ago and 3 open issues. That's long enough that you should check whether the maintainer is responding to issues before depending on it.