TwitterAPI.io MCP Server
Provides AI agents and coding assistants with Twitter data access including tweets, user profiles, followers, and search functionality.
README
TwitterAPI.io MCP Server
Twitter Data Access Capabilities for AI Agents and AI Coding Assistants
A powerful implementation of the Model Context Protocol (MCP) integrated with TwitterAPI.io for providing AI agents and AI coding assistants with advanced Twitter data access capabilities.
With this MCP server, you can access tweets, user profiles, and search functionality and then use that knowledge anywhere.
Overview
This MCP server provides tools that enable AI agents to access Twitter data through TwitterAPI.io's service, including retrieving tweets, user profiles, followers, and performing searches. It follows the best practices for building MCP servers.
Features
- Tweet Retrieval: Get tweets by ID
- User Profiles: Access user profile information
- Timeline Access: Retrieve a user's recent tweets
- Network Analysis: Get user followers and following
- Search Capabilities: Search tweets with advanced query support
- Replies Retrieval: Get replies to specific tweets
Tools
The server provides six essential Twitter data access tools:
- get_tweet: Get a tweet by its ID
- get_user_profile: Get a Twitter user's profile information
- get_user_recent_tweets: Get a user's recent tweets
- search_tweets: Search for tweets based on a query
- get_user_followers: Get a list of users who follow the specified user
- get_user_following: Get a list of users that the specified user follows
Prerequisites
- Docker/Docker Desktop if running the MCP server as a container (recommended)
- Python 3.10+ if running the MCP server directly
- TwitterAPI.io API key
Installation
Using Docker (Recommended)
- Clone this repository:
git clone https://github.com/yourusername/twitterapi.io-mcp.git
cd twitterapi.io-mcp
- Build the Docker image:
docker build -t mcp/twitterapi-io --build-arg PORT=8051 .
- Create a .env file based on the configuration section below
Using Python directly (no Docker)
- Clone this repository:
git clone https://github.com/yourusername/twitterapi.io-mcp.git
cd twitterapi.io-mcp
- Install dependencies:
pip install -e .
- Create a .env file based on the configuration section below
Configuration
Create a .env file in the project root with the following variables:
# MCP Server Configuration
HOST=0.0.0.0
PORT=8051
TRANSPORT=sse
# TwitterAPI.io Configuration
TWITTER_API_KEY=your_twitterapi_io_key
Running the Server
Using Docker
docker run --env-file .env -p 8051:8051 mcp/twitterapi-io
Using Python
python src/main.py
The server will start and listen on the configured host and port.
Integration with MCP Clients
SSE Configuration
Once you have the server running with SSE transport, you can connect to it using this configuration:
{
"mcpServers": {
"twitterapi-mcp": {
"transport": "sse",
"url": "http://localhost:8051/sse"
}
}
}
Note for Windsurf users: Use serverUrl instead of url in your configuration:
{
"mcpServers": {
"twitterapi-mcp": {
"transport": "sse",
"serverUrl": "http://localhost:8051/sse"
}
}
}
Note for Docker users: Use host.docker.internal instead of localhost if your client is running in a different container.
Stdio Configuration
Add this server to your MCP configuration for Claude Desktop, Windsurf, or any other MCP client:
{
"mcpServers": {
"twitterapi-mcp": {
"command": "python",
"args": ["path/to/twitterapi-mcp/src/main.py"],
"env": {
"TRANSPORT": "stdio",
"TWITTER_API_KEY": "your_twitterapi_io_key"
}
}
}
}
Docker with Stdio Configuration
{
"mcpServers": {
"twitterapi-mcp": {
"command": "docker",
"args": ["run", "--rm", "-i",
"-e", "TRANSPORT",
"-e", "TWITTER_API_KEY",
"mcp/twitterapi-io"],
"env": {
"TRANSPORT": "stdio",
"TWITTER_API_KEY": "your_twitterapi_io_key"
}
}
}
}
Usage Examples
# Example of using the client with MCP
from mcp.client import Client
async with Client("twitterapi-mcp") as client:
# Get a user profile
user = await client.get_user_profile(username="twitterapi")
print(user)
# Search for tweets
tweets = await client.search_tweets(query="python", count=5)
print(tweets)
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。