mcp-twitterio
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-twitterio Get the profile info for Twitter user 'elonmusk'."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Twitter API MCP服务
这是一个基于Model Context Protocol (MCP)的Twitter API客户端,使用twitterapi.io的API服务来获取Twitter数据。该服务允许AI助手(如Claude)查询Twitter数据,包括用户信息、推文、趋势等。
功能
获取用户信息和用户关系数据(粉丝、关注)
搜索和获取推文,包括用户时间线、列表推文
获取推文详情、回复、引用和转发信息
高级推文搜索功能
Related MCP server: TwitterAPI.io MCP Server
环境要求
Python 3.12或更高版本
mcp库 >= 1.6.0
httpx >= 0.28.1
python-dotenv >= 1.0.0 (可选,用于加载环境变量)
安装
确保你已安装必要的依赖:
pip install "mcp>=1.6.0" "httpx>=0.28.1" "python-dotenv>=1.0.0"或者使用uv:
uv pip install "mcp>=1.6.0" "httpx>=0.28.1" "python-dotenv>=1.0.0"设置Twitter API密钥:
export TWITTER_API_KEY="your_api_key_here"或者创建一个
.env文件:TWITTER_API_KEY=your_api_key_here
使用方法
使用uvx命令直接在Cherry Studio等终端中使用
本项目已经上传到PyPI,可直接通过uvx在Cherry Studio中使用:
mcp-twitterio需要从twitterapi.io官网获得TWITTER_API_KEY作为环境变量。
Cherry Studio使用示例
在Cherry Studio中使用mcp-twitterio服务:

查询Twitter用户信息示例:

使用MCP CLI运行服务
mcp dev main.py这将使用MCP Inspector启动服务,可通过本地网页界面测试其功能。
安装到Claude Desktop
要在Claude Desktop中使用此服务:
mcp install main.py --name "Twitter API"直接执行
python main.py可用的工具
用户相关工具
get_user_info_by_username- 根据用户名获取Twitter用户信息batch_get_users_by_ids- 批量获取用户信息get_user_last_tweets- 获取用户最新的推文get_user_followers- 获取用户的粉丝列表get_user_followings- 获取用户的关注列表get_user_mentions- 获取用户被提及的推文
推文相关工具
get_tweets_by_ids- 通过推文ID获取推文get_tweet_replies- 获取推文的回复get_tweet_quotations- 获取引用推文的推文get_tweet_retweeters- 获取转发推文的用户get_list_tweets- 获取列表中的推文advanced_search_tweets- 高级搜索推文
示例使用场景
使用Claude与此MCP服务的交互示例:
获取用户信息: "请获取Twitter用户'elonmusk'的个人资料信息。"
搜索推文: "请通过高级搜索找到关于'人工智能'的最新推文,限制结果为5条。"
查看用户推文: "显示用户'elonmusk'的最新3条推文。"
获取推文回复: "获取ID为'1234567890'的推文的所有回复。"
了解推文引用: "查看有哪些用户引用了ID为'1234567890'的推文。"
注意事项
你需要一个有效的twitterapi.io API密钥才能使用此服务
某些API调用可能受到twitterapi.io的速率限制
确保遵守Twitter的服务条款和API使用政策
开发与测试
项目包含examples目录中的客户端示例代码,可用于了解如何从Python程序中调用此MCP服务。 tests目录包含基本的单元测试,可确保服务核心功能正常工作。
Available Tools
12 toolsadvanced_search_tweetsA
高级搜索推文
Args:
query: 搜索查询语句,例如 "AI OR Twitter from:elonmusk since:2021-12-31_23:59:59_UTC"
queryType: 搜索类型,可选 "Latest" 或 "Top",默认为 "Latest"
cursor: 用于分页的游标,第一页为空字符串
Returns:
包含搜索结果的字典,每页返回约20条推文
Inputs: query (required), cursor, queryType.
batch_get_users_by_idsA
根据用户ID批量获取用户信息
Args:
user_ids: 用逗号分隔的用户ID列表,例如:"1234567890,1234567891,1234567892"
Returns:
包含多个用户信息的字典
Inputs: user_ids (required).
get_list_tweetsA
获取列表中的推文
Args:
listId: 列表ID
sinceTime: 在指定的unix时间戳(秒)之后
untilTime: 在指定的unix时间戳(秒)之前
includeReplies: 是否包含回复,默认为True
cursor: 用于分页的游标,第一页为空字符串
Returns:
包含列表推文的字典,每页返回最多20条推文
Inputs: listId (required), cursor, sinceTime, untilTime, +1 more.
get_tweet_quotationsA
获取引用推文的推文
Args:
tweetId: 推文ID
sinceTime: 在指定的unix时间戳(秒)之后
untilTime: 在指定的unix时间戳(秒)之前
includeReplies: 是否包含回复,默认为True
cursor: 用于分页的游标,第一页为空字符串
Returns:
包含引用推文的字典,每页返回最多20条引用
Inputs: tweetId (required), cursor, sinceTime, untilTime, +1 more.
get_tweet_repliesA
获取推文的回复
Args:
tweetId: 推文ID(必须是原始推文,非回复)
sinceTime: 在指定的unix时间戳(秒)之后
untilTime: 在指定的unix时间戳(秒)之前
cursor: 用于分页的游标,第一页为空字符串
Returns:
包含回复推文的字典,每页返回最多20条回复
Inputs: tweetId (required), cursor, sinceTime, untilTime.
get_tweet_retweetersA
获取转发推文的用户
Args:
tweetId: 推文ID
cursor: 用于分页的游标,第一页为空字符串
Returns:
包含转发用户列表的字典,每页返回约100个用户
Inputs: tweetId (required), cursor.
get_tweets_by_idsA
通过推文ID获取推文
Args:
tweet_ids: 推文ID列表,多个ID用逗号分隔,例如"1846987139428634858,1866332309399781537"
Returns:
包含推文列表的字典
Inputs: tweet_ids (required).
get_user_followersA
获取用户的粉丝列表
Args:
userName: 用户名称(screen name)(必需)
cursor: 用于分页的游标,第一页为空字符串
Returns:
包含用户粉丝列表的字典,每页返回最多200个粉丝
Inputs: userName (required), cursor.
get_user_followingsA
获取用户的关注列表
Args:
userName: 用户名称(screen name)(必需)
cursor: 用于分页的游标,第一页为空字符串
Returns:
包含用户关注列表的字典,每页返回最多200个关注用户
Inputs: userName (required), cursor.
get_user_info_by_usernameA
根据用户名Handle获取用户信息
Args:
username: Twitter用户名Handle(不含@符号)
Returns:
包含用户信息的字典
Inputs: userName (required).
get_user_last_tweetsB
获取用户最新的推文
Args:
userId: 用户ID (推荐使用,更稳定更快)
userName: 用户名称(screen name)
cursor: 用于分页的游标,第一页为空字符串
Returns:
包含用户推文的字典
Inputs: cursor, userId, userName.
get_user_mentionsA
获取用户的提及
Args:
userName: 用户名称(screen name)(必需)
sinceTime: 在指定的unix时间戳(秒)之后
untilTime: 在指定的unix时间戳(秒)之前
cursor: 用于分页的游标,第一页为空字符串
Returns:
包含用户提及的推文列表,每页返回最多20条提及
Inputs: userName (required), cursor, sinceTime, untilTime.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool targets a distinct Twitter resource or action, making most boundaries clear. However, get_user_last_tweets and get_user_mentions could be confused without careful reading of descriptions, as both relate to user-centric tweets.
Most tools follow a get_<object>_<detail> pattern, but there are notable deviations like batch_get_users_by_ids, advanced_search_tweets, and get_list_tweets that disrupt consistency. The convention is readable but not uniformly applied.
With 12 tools, the server is well-scoped for a read-only Twitter API client. Each tool covers a distinct operation, and the count is within the ideal range without feeling excessive or insufficient.
The server covers a broad range of Twitter read operations: user info, tweets, interactions (replies, quotes, retweets), followers/followings, mentions, search, and list tweets. Minor gaps exist (e.g., user likes, trending topics), but core workflows are well covered.
Maintenance
Related MCP Connectors
Hosted MCP server from TwitterAPI.io that gives AI agents read-only access to Twitter/X data. 12 tools: tweet search with X operators, user profiles, a user's latest tweets, followers and followings, replies, quotes, retweeters, mentions and trends. Connect at https://mcp.twitterapi.io/mcp with a TwitterAPI.io API key or account sign-in; usage is paid per result returned.
Twitter: Access real-time Twitter/X data as soon as it's posted! With the Twitter/X AIO API, you.
Official twitterapi.io hosted MCP: Twitter/X tweets, users, followers, trends. OAuth or API key.
Twitter (X) data for agents: profiles, tweets, search, followers, lists. $0.0006 per call.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables LLM agents to interact with Twitter (X) for searching tweets, posting content with images, analyzing engagement, and extracting topics using the Twitter API.-
- AlicenseNot gradedqualityDmaintenanceProvides AI agents and coding assistants with Twitter data access including tweets, user profiles, followers, and search functionality.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to access Twitter/X data including user profiles, tweets, search, and follower events via a set of MCP tools.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with X (Twitter) API v2 for posting tweets, searching, liking, retweeting, and more through natural language.23 PyPIMIT