by ryanmac
Automate tweet operations, manage profiles, and enable auto tweet post with this TypeScript server for Twitter. Supports
β 24
GitHub stars
Connects to Twitter/X to post tweets, reply to posts, follow users, and retrieve profile data. Supports both credential-based and API authentication methods.
Twitter is a community-built MCP server published by ryanmac that provides AI assistants with tools and capabilities via the Model Context Protocol. Automate tweet operations, manage profiles, and enable auto tweet post with this TypeScript server for Twitter. Supports It is categorized under communication.
You can install Twitter in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
MIT
Twitter is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
Add new capabilities to Claude beyond text generation
Example
Access external data sources, execute code, interact with tools and services
Transform Claude from chatbot to action-taking agent
Provide Claude with access to relevant context and data
Example
Load project documentation, access knowledge bases, query databases
Get more accurate, context-aware responses
Automate multi-step workflows combining AI and external tools
Example
Research β Summarize β Create document β Send notification
Complete complex tasks end-to-end without manual steps
Share your MCP server with the developer community
Twitter is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.
I recommend Twitter for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
We wired Twitter into a staging workspace; the listingβs GitHub and npm pointers saved time versus hunting across READMEs.
Twitter has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
We evaluated Twitter against two servers with overlapping tools; this profile had the clearer scope statement.
Twitter reduced integration guesswork β categories and install configs on the listing matched the upstream repo.
We evaluated Twitter against two servers with overlapping tools; this profile had the clearer scope statement.
Useful MCP listing: Twitter is the kind of server we cite when onboarding engineers to host + tool permissions.
Twitter reduced integration guesswork β categories and install configs on the listing matched the upstream repo.
Twitter is a well-scoped MCP server in the explainx.ai directory β install snippets and categories matched our Claude Code setup.
showing 1-10 of 66
A Model Context Protocol (MCP) server that integrates with Twitter using the agent-twitter-client package, allowing AI models to interact with Twitter without direct API access.
Authentication Options:
Tweet Operations:
User Operations:
Grok Integration:
# Install globally
npm install -g agent-twitter-client-mcp
# Or install locally
npm install agent-twitter-client-mcp
.env file with your Twitter credentials (see Authentication Methods)# If installed globally
agent-twitter-client-mcp
# If installed locally
npx agent-twitter-client-mcp
The package includes a demo directory with example scripts that demonstrate various features:
# Clone the repository to access the demo scripts
git clone https://github.com/ryanmac/agent-twitter-client-mcp.git
cd agent-twitter-client-mcp/demo
# Run the interactive demo menu
./run-demo.sh
# Run a specific demo script
./run-demo.sh --script tweet-search.js
# Run Grok AI examples (requires agent-twitter-client v0.0.19)
./run-demo.sh --script simple-grok.js --use-local-agent-twitter-client
./run-demo.sh --script grok-chat.js --use-local-agent-twitter-client
See the Demo README for more details.
By default, the MCP server runs on port 3000. If you need to change this (for example, if you already have an application running on port 3000), you have several options:
Set the PORT environment variable:
PORT=3001 npx agent-twitter-client-mcp
If using Docker Compose, you can configure both the host and container ports in your .env file:
# .env file
MCP_HOST_PORT=3001 # The port on your host machine
MCP_CONTAINER_PORT=3000 # The port inside the container
Then run:
docker-compose up -d
This will map port 3001 on your host to port 3000 in the container, allowing you to access the MCP at http://localhost:3001 while your other application continues to use port 3000.
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"agent-twitter-client-mcp": {
"command": "npx",
"args": ["-y", "agent-twitter-client-mcp"],
"env": {
"AUTH_METHOD": "cookies",
"TWITTER_COOKIES": "["auth_token=YOUR_AUTH_TOKEN; Domain=.twitter.com", "ct0=YOUR_CT0_VALUE; Domain=.twitter.com", "twid=u%3DYOUR_USER_ID; Domain=.twitter.com"]"
}
}
}
}
{
"AUTH_METHOD": "cookies",
"TWITTER_COOKIES": "["auth_token=YOUR_AUTH_TOKEN; Domain=.twitter.com", "ct0=YOUR_CT0_VALUE; Domain=.twitter.com", "twid=u%3DYOUR_USER_ID; Domain=.twitter.com"]"
}
To obtain cookies:
auth_token, ct0, and twid cookiesDomain=.twitter.com part for each cookie{
"AUTH_METHOD": "credentials",
"TWITTER_USERNAME": "your_username",
"TWITTER_PASSWORD": "your_password",
"TWITTER_EMAIL": "[email protected]", // Optional
"TWITTER_2FA_SECRET": "your_2fa_secret" // Optional, required if 2FA is enabled
}
{
"AUTH_METHOD": "api",
"TWITTER_API_KEY": "your_api_key",
"TWITTER_API_SECRET_KEY": "your_api_secret_key",
"TWITTER_ACCESS_TOKEN": "your_access_token",
"TWITTER_ACCESS_TOKEN_SECRET": "your_access_token_secret"
}
get_user_tweets: Fetch tweets from a specific userget_tweet_by_id: Fetch a specific tweet by IDsearch_tweets: Search for tweetssend_tweet: Post a new tweetsend_tweet_with_poll: Post a tweet with a polllike_tweet: Like a tweetretweet: Retweet a tweetquote_tweet: Quote a tweetget_user_profile: Get a user's profilefollow_user: Follow a userget_followers: Get a user's followersget_following: Get users a user is followinggrok_chat: Chat with Grok via Twitterhealth_check: Check the health of the Twitter MCP serverThe MCP includes an interactive command-line interface for testing:
npx agent-twitter-client-mcp-test
# or if installed locally
npm run test:interface
This launches a REPL where you can test various MCP functions:
agent-twitter-client-mcp> help
Available commands:
health Run a health check
profile <username> Get a user profile
tweets <username> [count] Get tweets from a user
tweet <id> Get a specific tweet by ID
search <query> [count] Search for tweets
post <text> Post a new tweet
like <id> Like a tweet
retweet <id> Retweet a tweet
quote <id> <text> Quote a tweet
follow <username> Follow a user
followers <userId> [count] Get a user's followers
following <userId> [count] Get users a user is following
grok <message> Chat with Grok
help Show available commands
exit Exit the test interface
# Run a health check
agent-twitter-client-mcp> health
# Search for tweets
agent-twitter-client-mcp> search mcp 2
# Get a user's profile
agent-twitter-client-mcp> profile elonmusk
# Get tweets from a user
agent-twitter-client-mcp> tweets openai 5
# Chat with Grok
agent-twitter-client-mcp> grok Explain quantum computing in simple terms
Ask Claude to:
To post a tweet with an image:
I want to post a tweet with an image. The tweet should say "Beautiful sunset today!" and include this image.
To post a tweet with a video:
I want to post a tweet with a video. The tweet should say "Check out this amazing video!" and include the video file.
To create a poll:
Create a Twitter poll asking "What's your favorite programming language?" with options: Python, JavaScript, Rust, and Go. The poll should run for 24 hours.
To have a conversation with Grok:
Use Grok to explain quantum computing to me. Ask it to include some real-world applications.
To continue a conversation with Grok:
Continue the Grok conversation and ask it to elaborate on quantum entanglement.
Grok on Twitter has access to real-time Twitter data that even the standalone Grok API doesn't have. This means you can ask Grok about:
Example queries:
Grok functionality requires proper authentication. The MCP supports two methods:
Cookie Authentication (Recommended):
TWITTER_COOKIES=["auth_token=YOUR_AUTH_TOKEN; Domain=.twitter.com", "ct0=YOUR_CT0_VALUE; Domain=.twitter.com", "twid=u%3DYOUR_USER_ID; Domain=.twitter.com"]auth_token, ct0, and twidUsername/Password Authentication:
TWITTER_USERNAME and TWITTER_PASSWORD in your environmentGrok has rate limits that may affect usage:
Prerequisites
Time Estimate
15-60 minutes depending on server complexity
Steps
Troubleshooting
β Do
β Don't
π‘ Pro Tips
Architecture
Model Context Protocol standardizes how AI hosts (Claude, Cursor) communicate with external tools and data sources through server implementations.
Protocols
Compatibility
β Use when
Use when you need Claude to access external data, execute actions, or integrate with tools. Best for extending AI capabilities beyond conversation.
β Avoid when
Avoid when native integrations exist (use official APIs directly), for real-time critical systems, or when security/compliance requires zero external dependencies.