X (Twitter) MCP Server for Claude Desktop Setup Guide (2026)
Connect X (Twitter) to Claude Desktop via MCP. Search tweets, post from Claude, read your timeline — step-by-step setup with copy-paste config for Mac and Windows.
X (Twitter) MCP Server: Claude Desktop Setup Guide (2026)
Claude Desktop can talk directly to X (Twitter) through an MCP server — letting you search posts, tweet, reply, and browse your timeline without ever leaving your AI assistant.
This guide is specifically for Claude Desktop users. If you're using Cursor IDE, see the Cursor setup guide.
What You Can Do from Claude Desktop
Once connected, you can have natural conversations like:
Claude handles the API call — you just talk to it.
X API Tiers (2026)
X moved to pay-per-use credits in February 2026. For Claude Desktop personal use, the Free tier covers most scenarios:
| Tier | Cost | Reads/month | Writes/month |
|------|------|-------------|--------------|
| Free | $0 | ~100 | ~500 |
| Basic | $200/month | 10,000 | 3,000 |
| Pay-per-use | Credits | ~$0.005/read | Varies |
Important: Liking and following were removed from the Free tier in August 2025. You need Basic+ for those actions.
Prerequisites
Step 1: Get Your X API Credentials
Create a Developer App
1. Go to developer.x.com and sign in
2. Click + Create Project in the left sidebar
3. Name it something like "Claude MCP" and click through
4. In your app dashboard, go to User authentication settings
5. Set App permissions to Read and Write
6. Toggle on OAuth 1.0a
7. Hit Save
Generate Keys and Tokens
1. In your app, go to Keys and tokens
2. Under Consumer Keys, click Regenerate (or copy if already showing)
3. Save your API Key and API Key Secret
4. Under Authentication Tokens, click Generate next to Access Token and Secret
5. Save your Access Token and Access Token Secret
> Save all four values somewhere safe — X only shows Access Tokens once after generation.
Step 2: Install the MCP Server
Open your terminal and run:
git clone https://github.com/DataWhisker/x-mcp-server.git
cd x-mcp-server
npm install
npm run build
After the build, you'll have a build/index.js file. Note the full path to this folder.
Step 3: Configure Claude Desktop
Find your Claude Desktop config file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonOpen it in a text editor and add the x-twitter entry. If the file is empty or new, use this as your full config:
Mac/Linux:
{
"mcpServers": {
"x-twitter": {
"command": "node",
"args": ["/Users/yourname/x-mcp-server/build/index.js"],
"env": {
"TWITTER_API_KEY": "your_api_key_here",
"TWITTER_API_SECRET": "your_api_key_secret_here",
"TWITTER_ACCESS_TOKEN": "your_access_token_here",
"TWITTER_ACCESS_SECRET": "your_access_token_secret_here"
}
}
}
}
Windows:
{
"mcpServers": {
"x-twitter": {
"command": "node",
"args": ["C:\\Users\\yourname\\x-mcp-server\\build\\index.js"],
"env": {
"TWITTER_API_KEY": "your_api_key_here",
"TWITTER_API_SECRET": "your_api_key_secret_here",
"TWITTER_ACCESS_TOKEN": "your_access_token_here",
"TWITTER_ACCESS_SECRET": "your_access_token_secret_here"
}
}
}
}
Replace the path with wherever you cloned x-mcp-server and fill in your real credentials.
Step 4: Restart Claude Desktop
Completely quit and reopen Claude Desktop — not just close the window, but Quit from the menu (Cmd+Q on Mac, or from the system tray on Windows).
When Claude restarts, you should see a hammer icon (🔨) in the chat interface indicating MCP tools are loaded.
Step 5: Test It
Try a simple test first:
> "Search X for recent posts about Claude AI"
If you see real tweet content in the response, you're fully connected.
Then try posting:
> "Post a tweet that says: Testing my Claude Desktop MCP setup — pretty wild that I can tweet from my AI chat now 🤖"
All 16 Available Tools
The server exposes these tools to Claude:
Search & Timeline
| Tool | What It Does |
|------|-------------|
| search_tweets | Search public posts (last 7 days) |
| get_home_timeline | Fetch your home feed (up to 100 posts) |
Posting
| Tool | What It Does |
|------|-------------|
| create_tweet | Post text or media |
| reply_to_tweet | Reply to any post by ID |
| quote_tweet | Quote-tweet with commentary |
| delete_tweet | Delete your own post |
| get_tweet | Fetch a specific post by ID |
Engagement (Basic tier required)
| Tool | What It Does |
|------|-------------|
| like_tweet / unlike_tweet | Like or remove a like |
| retweet / undo_retweet | Repost or remove repost |
| bookmark_tweet / unbookmark_tweet | Save or remove a bookmark |
| get_bookmarks | List your saved bookmarks |
Users
| Tool | What It Does |
|------|-------------|
| get_user | Look up any public profile |
| get_user_tweets | Get a user's recent posts |
Adding Media Upload (Optional)
X removed the old v1.1 media upload endpoint in June 2025. To post images or videos from Claude, you need additional OAuth 2.0 credentials.
In your X Developer app:
1. Enable OAuth 2.0 under authentication settings
2. Set client type to Confidential
3. Add a callback URL (can be http://localhost:3000/callback)
4. Request scopes: tweet.read tweet.write media.write offline.access users.read
Then add to your Claude Desktop config env block:
"TWITTER_CLIENT_ID": "your_oauth2_client_id",
"TWITTER_CLIENT_SECRET": "your_oauth2_client_secret",
"TWITTER_OAUTH2_REFRESH_TOKEN": "your_refresh_token"
Tokens auto-refresh and are stored at ~/.x-mcp-tokens.json.
Claude-Specific Prompt Tips
Claude works better with X data when you're specific:
"Search X for tweets about 'cursor IDE mcp' from the last 3 days and summarize the sentiment""Look up the last 10 tweets from @AnthropicAI and tell me what they've been focused on"
"Draft a tweet thread (3 parts) about why MCP servers are changing AI workflows, then post all three in sequence"
"Search for anyone complaining about [competitor] on X and give me a summary of the main pain points"
"Post this tweet and tell me the tweet ID so I can track engagement: [text]"
Troubleshooting
"No tools available" in Claude — Claude Desktop didn't pick up the config. Check the file path, make sure JSON is valid (no trailing commas), and fully quit+restart Claude.
401 Unauthorized — Wrong credentials or your app still has Read-only permissions. Go back to User authentication settings in the developer portal and confirm Read+Write is saved.
403 on like/retweet — Free tier doesn't support engagement endpoints. You need the Basic plan ($200/month) for those.
"Cannot find module" — You likely forgot to run npm run build. The build/ folder must exist before Claude can launch the server.
Rate limit hit — Free tier is about 100 reads and 500 writes per month. For heavier usage, switch to pay-per-use credits at developer.x.com.
How This Compares to Cursor IDE
Both setups use identical credentials and the same x-mcp-server. The only difference is where the config file lives:
claude_desktop_config.json (best for general AI chat + social media management).cursor/mcp.json (best for developers who want X access alongside coding tools)You can run both at the same time using the same credentials.