home / mcp / twitter mcp server
Provides post, image posting, and search capabilities for Twitter via MCP in Claude AI.
Configuration
View docs{
"mcpServers": {
"genaiwithms-twitter-mcp": {
"command": "npx",
"args": [
"-y",
"@muhammadsiddiq/twitter-mcp"
],
"env": {
"API_KEY": "your_api_key",
"ACCESS_TOKEN": "your_access_token",
"API_SECRET_KEY": "your_api_secret_key",
"ACCESS_TOKEN_SECRET": "your_access_token_secret"
}
}
}
}This MCP server lets you interact with Twitter/X directly from Claude AI. You can post tweets, share images, search tweets, and engage in conversations with secure authentication and built-in rate limiting.
You connect to the Twitter MCP Server from your MCP client (such as Claude) and issue high-level actions like posting a tweet, posting a tweet with an image, or searching tweets. The server handles authentication with Twitter and enforces rate limits, so you can focus on your workflow without managing low-level API details.
Prerequisites you need before starting are a Node.js 18+ runtime and npm or npx, a Twitter Developer Account with API credentials, and Claude Desktop installed.
You configure the MCP server as follows. The server runs through npx and uses your Twitter API credentials. Place the configuration snippet in Claudeβs MCP server configuration area or your equivalent MCP client configuration file.
{
"mcpServers": {
"twitter": {
"command": "npx",
"args": ["-y", "@muhammadsiddiq/twitter-mcp"],
"env": {
"API_KEY": "your_api_key",
"API_SECRET_KEY": "your_api_secret_key",
"ACCESS_TOKEN": "your_access_token",
"ACCESS_TOKEN_SECRET": "your_access_token_secret"
}
}
}
}Post a plain tweet from Claude by issuing a simple command that sends the text you want to tweet. To include media, ensure the image file is accessible to Claude Desktop and your filesystem access is configured for the MCP server. You can also search Twitter using a query to retrieve matching tweets for analysis.
If you want to post images, configure filesystem access so Claude can read image files on your computer. Grant access to the folders where you store images, then reference absolute or relative paths to those files when composing a tweet with an image.
Post a text tweet: you provide the content and submit it through Claude. Post with an image: ensure the image is accessible and referenced from your command; the server will upload the image along with your caption. Search tweets: provide a query, and the server returns a list of tweets matching that query and related metadata.
Keep your Twitter API credentials secure by using environment variables in production and avoiding hard-coded values. Rotate credentials periodically and monitor API usage in the Twitter Developer Portal.
Common issues include authentication failures, rate limit messages, and image upload problems. Verify your API credentials, ensure the tokens have the correct permissions, and confirm the image file path and size meet the requirements. If the MCP server cannot be reached from Claude, restart Claude Desktop and check the MCP configuration JSON for proper syntax.
This MCP server supports posting tweets, posting with images (JPEG, PNG, GIF, WEBP), and searching tweets by query. It uses OAuth 1.0a authentication and includes rate limiting to protect against API abuse.
The server exposes tools to interact with Twitter programmatically: post_tweet for text-only tweets, post_tweet_with_image for tweets with media, and search_tweets to find tweets matching a query. Each tool handles the necessary API calls and formatting of results.
Post a text-only tweet through the MCP server using the Twitter API.
Post a tweet with an attached image. Supports JPEG, PNG, GIF, and WEBP formats.
Search for tweets matching a query and return a list of tweets with metadata.