loading…
Search for a command to run...
loading…
An MCP server that provides AI agents with full access to the X (Twitter) API for posting, searching, and managing engagement through natural language. It suppo
An 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.
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.
| 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.
git clone https://github.com/INFATOSHI/x-mcp.git
cd x-mcp
npm install
npm run build
You need 5 credentials from the X Developer Portal. Here's exactly how to get them:
my-x-mcp)By default, new apps only have Read permissions. You need Read and Write to post tweets, like, retweet, etc.
https://localhost (required but won't be used)https://x.com)After enabling write permissions, you need to generate (or regenerate) your Access Token and Secret so they carry the new permissions:
If you skip step (b) before generating tokens, your tokens will be Read-only and posting will fail with a 403 error.
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
Pick your client below. You only need to follow one section.
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.
Add to your claude_desktop_config.json:
~/Library/Application Support/Claude/claude_desktop_config.json%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"
}
}
}
}
Add to your Cursor MCP config:
~/.cursor/mcp.json.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.
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"
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.
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
}
}
}
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.
X has progressively restricted what automated/API clients can do. Here's what affects x-mcp:
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.
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.
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.
Free tier: 500 posts/month. Basic: 10,000/month. Pro: 1,000,000/month.
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.
Double-check that all 5 credentials in your .env are correct and that there are no extra spaces or line breaks.
The error message includes exactly when the rate limit resets. Wait until then, or reduce request frequency.
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.
Make sure you added the server with the correct scope (user/global, not project-scoped if you want it everywhere), then restart your client.
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.
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.
The search_tweets tool supports X's full query language:
from:username -- posts by a specific userto:username -- replies to a specific user#hashtag -- posts containing a hashtag"exact phrase" -- exact text matchhas:media / has:links / has:images -- filter by content typeis:reply / -is:retweet -- filter by post typelang:en -- filter by languageORMIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"x-mcp": {
"command": "npx",
"args": []
}
}
}