MCP Twitter
MCP 推特
描述
MCP Twitter 是一个基于模型上下文协议 (MCP) 的服务器,允许与 Twitter/X 直接交互。它通过一套标准化工具公开各种 Twitter API 功能,使 AI 模型和应用程序能够在 Twitter 上执行操作。
Related MCP server: Agent Twitter Client MCP
特征
该 MCP 服务器提供以下操作:
create_twitter_post:创建新的 X/Twitter 帖子reply_twitter_tweet:通过 ID 回复特定的 X/Twitter 帖子get_last_tweet:获取指定 X/Twitter 帐户的最新帖子get_last_tweets_options:获取与搜索查询匹配的指定数量的帖子create_and_post_twitter_thread:创建并发布 X/Twitter 线程follow_twitter_from_username:通过用户名关注 X/Twitter 用户get_twitter_profile_from_username:通过用户名获取完整的 X/Twitter 个人资料数据get_twitter_user_id_from_username:从用户名获取 X/Twitter 用户 IDget_last_tweet_and_replies_from_user:获取用户最近的 X/Twitter 帖子和回复get_last_tweet_from_user:获取用户最近的 X/Twitter 帖子get_own_twitter_account_info:获取当前帐户资料数据
安装和使用
本地安装
# Clone the repository
git clone https://github.com/0xhijo/mcp_twitter.git
# Install dependencies and build the project
pnpm build
# Launch the server
node ./build/index.js通过 NPX 安装
npx mcp_twitter配置
通过 Twitter Scraper 进行配置
配置 .env 文件:
TWITTER_AUTH_MODE = "CREDENTIALS" # Credentials mode
# Your Twitter credentials
TWITTER_USERNAME="YOUR_TWITTER_USERNAME"
TWITTER_PASSWORD="YOUR_TWITTER_PASSWORD"
TWITTER_EMAIL="YOUR_TWITTER_EMAIL"您需要通过创建.env文件或直接将变量添加到您的环境中来配置 Twitter 身份验证。
通过 Twitter API 进行配置
创建开发者帐户:
确保您拥有 Twitter 帐户 访问开发者平台 获取您的 API 凭证 如果您需要帮助创建开发者帐户,请遵循本指南
配置 .env 文件
TWITTER_AUTH_MODE = "API" # API mode
# Your CREDENTIALS obtained from the Developer Platform
TWITTER_API="YOUR_TWITTER_API"
TWITTER_API_SECRET="YOUR_TWITTER_API_SECRET"
TWITTER_ACCESS_TOKEN="YOUR_TWITTER_ACCESS_TOKEN"
TWITTER_ACCESS_TOKEN_SECRET="YOUR_TWITTER_ACCESS_TOKEN_SECRET"与克劳德整合
要将 MCP Twitter 与 Claude 结合使用,您需要将其添加到claude_mcp_config.json文件中。这将允许 Claude 通过 MCP 服务器与 Twitter 进行交互。
添加到 Claude 的 MCP 配置
将以下条目添加到您的claude_mcp_config.json文件:
"mcp_twitter": {
"command": "npx",
"args": ["mcp_twitter"],
"env": {
"TWITTER_AUTH_MODE": "CREDENTIALS",
"TWITTER_USERNAME": "YOUR_TWITTER_USERNAME",
"TWITTER_PASSWORD": "YOUR_TWITTER_PASSWORD",
"TWITTER_EMAIL": "YOUR_TWITTER_EMAIL"
}
}将占位符凭据替换为你的实际 Twitter 帐户信息。当 Claude 需要与 Twitter 交互时,此配置将使用 npx 启动 MCP Twitter 服务器。
与 Claude 一起使用
配置完成后,Claude 将能够使用 MCP 服务器提供的所有 Twitter 功能,例如创建帖子、检索推文等等。您只需让 Claude 执行 Twitter 操作,它就会利用 MCP 服务器来执行。
重要提示
根据您的需求选择身份验证模式(API 或 CREDENTIALS)
验证您的凭据是否在 .env 文件中正确配置
查看官方文档以了解有关 API 限制的更多详细信息
This server cannot be deployed
Maintenance
Related MCP Connectors
FastMCP server for posting formatted content to X (Twitter) — Tollbooth-monetized, DPYC-native
X (Twitter) data for AI agents: tweets, profiles, followers, search, trends + social listening.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Twitter/X read-only MCP server — 12 tools: search, users, tweets, followers, timelines, trends.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI to interact with Twitter, allowing functions like searching tweets, comparing sentiments across accounts, and retrieving timeline content.MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI agents to interact with Twitter without direct API access, supporting tweet operations, user interactions, and Grok AI integration.141,093 npm32MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI assistants to interact with Twitter functionality using cookie-based authentication, allowing for timeline access, tweet management, user information retrieval, and search capabilities.16-
- FlicenseAqualityDmaintenanceModel Context Protocol server that enables LLMs to interact with X.com (formerly Twitter) through OAuth 2.0 authentication, supporting major Post-related operations including reading, writing, searching, and managing posts, likes, retweets, and bookmarks.2134 npm8-