This guide is designed to help AI agents (like Claude) effectively use the agent-twitter-client-mcp to interact with Twitter.
The agent-twitter-client-mcp provides the following tools:
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 tweet
get_user_profile: Get a user's profilefollow_user: Follow a userget_followers: Get a user's followersget_following: Get users a user is following
grok_chat: Chat with Grok via Twitter
Important: Grok functionality requires agent-twitter-client v0.0.19 or higher. If you're using v0.0.18, you'll need to upgrade to use Grok features.
health_check: Check the health of the agent-twitter-client-mcp server
Can you get the latest 5 tweets from @elonmusk?
This will use the get_user_tweets tool to fetch tweets from the specified user.
Example command in the test interface:
agent-twitter-client-mcp> tweets elonmusk 5
Search Twitter for tweets about "artificial intelligence" and summarize the main themes.
This will use the search_tweets tool to find tweets matching the query.
Example command in the test interface:
agent-twitter-client-mcp> search "artificial intelligence" 10
Can you show me the tweet with ID 1234567890123456789?
This will use the get_tweet_by_id tool to fetch a specific tweet.
Example command in the test interface:
agent-twitter-client-mcp> tweet 1234567890123456789
Post a tweet saying "Just tried the new agent-twitter-client-mcp integration with Claude. It works great!"
This will use the send_tweet tool to post a new tweet.
Example command in the test interface:
agent-twitter-client-mcp> post Just tried the new agent-twitter-client-mcp integration with Claude. It works great!
Post a tweet with this image. The tweet should say "Beautiful sunset today!"
This will use the send_tweet tool with media attachment.
Create a Twitter poll asking "What's your favorite AI assistant?" with options: Claude, ChatGPT, Bard, and Bing. The poll should run for 24 hours.
This will use the send_tweet_with_poll tool to create a poll.
Reply to tweet 1234567890123456789 saying "Great point! I completely agree."
This will use the send_tweet tool with the replyToTweetId parameter.
Quote tweet 1234567890123456789 saying "This is an important perspective on AI safety."
This will use the quote_tweet tool.
Example command in the test interface:
agent-twitter-client-mcp> quote 1234567890123456789 This is an important perspective on AI safety.
Like the tweet with ID 1234567890123456789.
This will use the like_tweet tool.
Example command in the test interface:
agent-twitter-client-mcp> like 1234567890123456789
Retweet the tweet with ID 1234567890123456789.
This will use the retweet tool.
Example command in the test interface:
agent-twitter-client-mcp> retweet 1234567890123456789
Show me the profile information for @OpenAI.
This will use the get_user_profile tool.
Example command in the test interface:
agent-twitter-client-mcp> profile OpenAI
Follow the user @elonmusk.
This will use the follow_user tool.
Example command in the test interface:
agent-twitter-client-mcp> follow elonmusk
Show me the first 10 followers of user 12345.
This will use the get_followers tool.
Example command in the test interface:
agent-twitter-client-mcp> followers 12345 10
Use Grok to explain quantum computing in simple terms.
This will use the grok_chat tool to interact with Grok.
Example command in the test interface:
agent-twitter-client-mcp> grok Explain quantum computing in simple terms.
Continue the Grok conversation and ask it to elaborate on quantum entanglement.
This will use the grok_chat tool with the previous conversation ID.
Grok on Twitter has unique access to Twitter's real-time data that even the standalone Grok API doesn't have. You can leverage this to:
Use Grok to analyze the current trending topics on Twitter and explain why they might be trending.
Ask Grok to analyze the sentiment around cryptocurrency discussions on Twitter in the past week.
Have Grok identify the most influential voices discussing climate change on Twitter right now.
Grok can provide web search results and citations for its responses:
Use Grok to research quantum computing breakthroughs and provide citations for the information.
This will use the grok_chat tool with the returnSearchResults and returnCitations parameters set to true.
1. Use Grok to research a complex topic
2. Ask follow-up questions to deepen understanding
3. Request citations and sources for further reading
4. Summarize the key insights from the conversation
Check the health of the agent-twitter-client-mcp server.
This will use the health_check tool to verify the server's status.
Example command in the test interface:
agent-twitter-client-mcp> health
To create a thread of tweets:
Create a Twitter thread about climate change with 3 tweets:
1. "Climate change is one of the biggest challenges facing humanity today. We need immediate action to reduce carbon emissions."
2. "Renewable energy sources like solar and wind are becoming more affordable and efficient. They're key to a sustainable future."
3. "Individual actions matter too. Reducing meat consumption, using public transport, and minimizing waste all help combat climate change."
To analyze Twitter content:
Search for the latest 20 tweets about "Web3" and analyze the sentiment. Are people generally positive or negative about it?
To research a Twitter user:
Research @OpenAI on Twitter. Get their profile information, their latest 10 tweets, and tell me what topics they typically tweet about.
- Be Specific: Clearly specify what you want to do on Twitter.
- Provide Context: When posting tweets, explain the purpose and content.
- Handle Media Properly: When working with images or videos, be clear about what media to include.
- Respect Privacy: Be cautious about retrieving and sharing personal information.
- Follow Twitter's Rules: Ensure content complies with Twitter's terms of service.
- Error Handling: If an operation fails, check for common issues like authentication problems or rate limiting.
- Use the Test Interface: When developing or debugging, use the test interface to verify functionality.
If you encounter issues:
- Cookie Expiration: Twitter cookies typically expire after a certain period. If authentication fails, the user may need to refresh their cookies.
- Cookie Format: Ensure cookies are properly formatted with the correct domain (
.twitter.com). - Required Cookies: Make sure all essential cookies are included:
auth_token,ct0, andtwid.
Example of properly formatted cookies:
["auth_token=value; Domain=.twitter.com", "ct0=value; Domain=.twitter.com", "twid=u%3Dvalue; Domain=.twitter.com"]
Twitter limits API calls. If you hit rate limits:
- Implement exponential backoff (wait longer between retries)
- Reduce the frequency of requests
- Prioritize essential operations
Twitter may block certain content:
- Ensure content follows Twitter's guidelines
- Avoid posting identical content repeatedly
- Be cautious with sensitive topics
Twitter occasionally changes its API:
- If a feature doesn't work, it might be due to API changes
- Check for updates to the MCP
- Use the health check to verify connectivity
1. Search Twitter for tweets about "climate change" from the past week
2. Analyze the most engaged tweets on this topic
3. Identify key influencers discussing climate change
4. Summarize the main arguments and perspectives
1. Find trending tweets about AI
2. Like relevant tweets that align with the user's interests
3. Reply to a tweet with a thoughtful comment
4. Post an original tweet contributing to the conversation
1. Research a topic on Twitter to understand current discussions
2. Draft a tweet or thread based on this research
3. Create a poll to engage followers on the topic
4. Monitor responses and engage with replies
1. Use Grok to research a complex topic
2. Ask follow-up questions to deepen understanding
3. Request citations and sources for further reading
4. Summarize the key insights from the conversation
By following these patterns and best practices, AI agents can effectively use the agent-twitter-client-mcp to provide valuable Twitter integration for users.