X (Twitter) MCP Server
Community MCP server that lets Claude post tweets and search tweets on X (Twitter) through the official X API using OAuth 1.0a credentials.
The twitter-mcp server by EnesCinar is a community-built Model Context Protocol server that connects AI assistants like Claude to the X (formerly Twitter) API. It is one of the most widely used Twitter MCP implementations and is distributed as an npm package (@enescinar/twitter-mcp) so it can be launched directly via npx from any MCP client.
The server exposes two primary tools: post_tweet for publishing new tweets and search_tweets for querying tweets on the platform. Authentication is handled via OAuth 1.0a using four credentials (API key, API secret, access token, access token secret) obtained from the X Developer Portal. The setup is minimal: drop the config into Claude Desktop's MCP config file, supply your developer credentials, and restart.
Note: X does not publish an official MCP server. This project is community-maintained under the MIT license. Capabilities are intentionally narrow (post and search), so users who need timelines, likes, retweets, DMs, or media upload should consider alternative community implementations.
Tools
| Tool | Description |
|---|---|
post_tweet |
Create and publish a new tweet on the authenticated user's account. |
search_tweets |
Search for tweets matching a query using the X search API. |
Prerequisites
- A Twitter/X Developer account with an app created in the X Developer Portal
- The following OAuth 1.0a credentials from that app:
- API Key
- API Secret Key
- Access Token
- Access Token Secret
- Node.js installed locally (the server runs via
npx)
Claude Desktop configuration
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"twitter-mcp": {
"command": "npx",
"args": ["-y", "@enescinar/twitter-mcp"],
"env": {
"API_KEY": "your_api_key_here",
"API_SECRET_KEY": "your_api_secret_key_here",
"ACCESS_TOKEN": "your_access_token_here",
"ACCESS_TOKEN_SECRET": "your_access_token_secret_here"
}
}
}
}
Config file locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Restart Claude Desktop after saving.
Debugging
Logs are written to:
- macOS:
~/Library/Logs/Claude/mcp-server-twitter.log - Windows:
%APPDATA%\Claude\logs\mcp-server-twitter.log
- Draft and publish tweets directly from a chat session without leaving the AI assistant
- Search X for mentions of a brand, product, or keyword and summarize the results
- Generate threads or marketing copy and post them on a schedule controlled by the agent
- Run lightweight social listening, for example pulling the latest tweets matching a hashtag for analysis
- Combine with other MCP servers (e.g. analytics or CRM) to post updates triggered by external events
- "Post a tweet announcing our new feature launch with a link to the blog post."
- "Search X for the last 20 tweets mentioning 'modelcontextprotocol' and summarize the sentiment."
- "Find recent tweets about my company and draft a reply to the most engaged one."
- "Compose a three-tweet thread explaining what MCP is and post it."
- "Search X for 'AI agents' from the last day and list the top 10 results."
- Trivial setup: a single
npxcommand and four env vars - Uses the official X API with OAuth 1.0a, so posts come from a real authenticated account
- Distributed as a published npm package, no cloning or building required
- MIT licensed and one of the most popular Twitter MCP servers on GitHub
- Only two tools (post and search). No support for timelines, likes, retweets, DMs, follows, or media uploads
- Community-maintained, not official from X. No SLA or guaranteed updates
- Requires a paid X API tier for meaningful search and posting volume, since the free tier is heavily rate-limited
- rafaljanicki/x-twitter-mcp-server: broader coverage including fetching tweets, follower management, and more
- Infatoshi/x-mcp: adds timeline reads, likes, retweets, and media upload via the X API
- Barresider/x-mcp: Playwright-based browser automation alternative that avoids the X API entirely