
rafaljanicki/x-twitter-mcp-server 是从 https://github.com/rafaljanicki/x-twitter-mcp-server. 导入的 MCP 服务器候选
概览
rafaljanicki/x-twitter-mcp-server 是从 https://github.com/rafaljanicki/x-twitter-mcp-server. 导入的 MCP 服务器候选
概述(AI 翻译)
一个模型上下文协议(MCP)服务器,通过AI工具与Twitter(X)交互。该服务器允许你通过AI工具中的自然语言命令获取推文、发布推文、搜索Twitter、管理粉丝等功能。
特色
- 获取用户资料、关注者和关注列表。
- 发布、删除和收藏推文。
- 在推特上搜索推文和趋势。
- 管理书签和时间线。
- Twitter API 内置速率限制处理。
- 采用Twitter API v2并配备适当认证(API密钥和令牌),避免用户名/密码被破解,以降低账户被暂停的风险。
- 提供完整的 Twitter API v2 端点实现,用于用户管理、推文管理、时间线和搜索功能。
先修条件
- Python 3.10 或更高版本:确保你的系统已安装 Python。
- Twitter 开发者账户:你需要从 Twitter 开发者门户获取 API 凭证(API 密钥、API 秘密、访问令牌、访问令牌秘密和持有令牌)。
- 可选:Claude Desktop:从Anthropic网站下载并安装Claude桌面应用。
- 可选:**节点。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
X (Twitter) MCP server
A Model Context Protocol (MCP) server for interacting with Twitter (X) via AI tools. This server allows you to fetch tweets, post tweets, search Twitter, manage followers, and more, all through natural language commands in AI Tools.
Features
- Fetch user profiles, followers, and following lists.
- Post, delete, and favorite tweets.
- Search Twitter for tweets and trends.
- Manage bookmarks and timelines.
- Built-in rate limit handling for the Twitter API.
- Uses Twitter API v2 with proper authentication (API keys and tokens), avoiding the username/password hack to minimize the risk of account suspensions.
- Provides a complete implementation of Twitter API v2 endpoints for user management, tweet management, timelines, and search functionality.
Prerequisites
- Python 3.10 or higher: Ensure Python is installed on your system.
- Twitter Developer Account: You need API credentials (API Key, API Secret, Access Token, Access Token Secret, and Bearer Token) from the Twitter Developer Portal.
- Optional: Claude Desktop: Download and install the Claude Desktop app from the Anthropic website.
- Optional: Node.js (for MCP integration): Required for running MCP servers in Claude Desktop.
- A package manager like
uvorpipfor Python dependencies.
Installation
Option 1: Installing via Smithery (Recommended)
To install X (Twitter) MCP server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @rafaljanicki/x-twitter-mcp-server --client claude
Option 2: Install from PyPI
The easiest way to install x-twitter-mcp is via PyPI:
pip install x-twitter-mcp
Option 3: Install from Source
If you prefer to install from the source repository:
-
Clone the Repository:
git clone https://github.com/rafaljanicki/x-twitter-mcp-server.git cd x-twitter-mcp-server -
Set Up a Virtual Environment (optional but recommended):
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate -
Install Dependencies: Using
uv(recommended, as the project usesuv.lock):uv syncAlternatively, using
pip:pip install . -
Configure Environment Variables:
安装
npx -y @smithery/cli install @rafaljanicki/x-twitter-mcp-server --client claude配置
{
"mcpServers": {
"x-twitter-mcp": {
"command": "x-twitter-mcp-server",
"args": [],
"env": {
"PYTHONUNBUFFERED": "1",
"TWITTER_API_KEY": "your_api_key",
"TWITTER_API_SECRET": "your_api_secret",
"TWITTER_ACCESS_TOKEN": "your_access_token",
"TWITTER_ACCESS_TOKEN_SECRET": "your_access_token_secret",
"TWITTER_BEARER_TOKEN": "your_bearer_token",
"TWITTER_OAUTH2_USER_ACCESS_TOKEN": "your_oauth2_user_token"
}
}
}
}