Set up Twitter/X MCP in Claude Desktop
Post tweets, search timelines, manage followers, and analyze engagement on Twitter/X from your AI editor.
1
Locate the config file
Claude Desktop reads MCP server configuration from the following file:
~/Library/Application Support/Claude/claude_desktop_config.jsonCreate this file if it does not already exist.
2
Add the configuration
Add the following to your Claude Desktop config file:
json
{
"mcpServers": {
"twitter-mcp": {
"command": "npx",
"args": [
"-y",
"twitter-mcp"
],
"env": {
"TWITTER_API_KEY": "YOUR_TWITTER_API_KEY",
"TWITTER_API_SECRET": "YOUR_TWITTER_API_SECRET",
"TWITTER_ACCESS_TOKEN": "YOUR_TWITTER_ACCESS_TOKEN",
"TWITTER_ACCESS_SECRET": "YOUR_TWITTER_ACCESS_SECRET"
}
}
}
}3
Set up environment variables
Twitter/X MCP requires the following environment variables:
TWITTER_API_KEYRequiredTwitter API key
TWITTER_API_SECRETRequiredTwitter API secret
TWITTER_ACCESS_TOKENRequiredTwitter access token
TWITTER_ACCESS_SECRETRequiredTwitter access token secret
4
Verify it works
Restart Claude Desktop. Twitter/X MCP should appear in your MCP server list with 8 tools available.
This server adds approximately 4,120 tokens to your context window for tool definitions.