A headless MCP server that provides Twitter API access without requiring local credential setup, enabling core Twitter operations like searching tweets, getting user tweets, posting tweets, and replying to tweets.
A MCP (Model Context Protocol) server that provides Twitter API access without local credential or token setup. Provides core Twitter operations like searching tweets, getting user tweets, posting tweets, and replying to tweets.
https://www.youtube.com/watch?v=LOxFqCTPedc
# Clone the repository git clone https://github.com/yourusername/mcp-twitter-noauth.git cd mcp-twitter-noauth # Install dependencies pip install -e .
# Build the Docker image docker build -t mcp-twitter-noauth .
You can configure Claude Desktop to use the Docker image by adding the following to your Claude configuration:
{ "mcpServers": { "twitter": { "command": "docker", "args": [ "run", "-i", "--rm", "buryhuang/mcp-twitter-noauth:latest" ] } } }
Note: With this configuration, you'll need to provide your Twitter API credentials in the tool calls as shown in the Using the Tools section. Twitter credentials are not passed as environment variables to maintain separation between credential storage and server implementation.
To publish the Docker image for multiple platforms, you can use the docker buildx
command. Follow these steps:
Create a new builder instance (if you haven't already):
docker buildx create --use
Build and push the image for multiple platforms:
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t buryhuang/mcp-twitter-noauth:latest --push .
Verify the image is available for the specified platforms:
docker buildx imagetools inspect buryhuang/mcp-twitter-noauth:latest
The server provides Twitter functionality through MCP tools. Authentication handling is simplified with a dedicated token refresh tool.
mcp-server-twitter-noauth
When using an MCP client like Claude, you have two main ways to handle authentication:
If you have both access and refresh tokens:
{ "twitter_access_token": "your_access_token", "twitter_refresh_token": "your_refresh_token", "twitter_client_id": "your_client_id", "twitter_client_secret": "your_client_secret" }
If your access token has expired, you can refresh with just the refresh token:
{ "twitter_refresh_token": "your_refresh_token", "twitter_client_id": "your_client_id", "twitter_client_secret": "your_client_secret" }
This will return a new access token and its expiration time, which you can use for subsequent calls.
Search for tweets using the Twitter API:
{ "twitter_access_token": "your_access_token", "query": "your search query", "max_results": 10 }
Response includes tweet data including text, creation time, and author information.
Get recent tweets by a specific user:
{ "twitter_access_token": "your_access_token", "user_id": "twitter_user_id", "max_results": 10 }
Get recent replies by a specific user:
{ "twitter_access_token": "your_access_token", "user_id": "twitter_user_id", "max_results": 10 }
Post a new tweet:
{ "twitter_access_token": "your_access_token", "text": "This is a test tweet from the MCP Twitter server" }
Reply to an existing tweet:
{ "twitter_access_token": "your_access_token", "tweet_id": "id_of_tweet_to_reply_to", "text": "This is a reply to the original tweet" }
twitter_refresh_token
tool with either:
twitter_refresh_token
tool again to get a new token.This approach simplifies most API calls by not requiring client credentials for every operation, while still enabling token refresh when needed.
To obtain the required Twitter API credentials, follow these steps:
This server implements automatic token refreshing. When your access token expires, the server will use the refresh token, client ID, and client secret to obtain a new access token without requiring user intervention.
This server requires direct access to your Twitter API credentials. Always keep your tokens and credentials secure and never share them with untrusted parties.
See the LICENSE file for details.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!