跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 X (Twitter),然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
摘要
让你的 AI 使用 X(原 Twitter):读取和搜索帖子、你的时间线、提及、书签、列表和私信,查找账号和关注者,并在你确认后发布帖子、回复和引用,点赞、转发和发送私信。
试试这样问
X (Twitter) 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → X (Twitter)、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
X (Twitter) + Cursor
让你的 AI 使用 X(原 Twitter):读取和搜索帖子、你的时间线、提及、书签、列表和私信,查找账号和关注者,并在你确认后发布帖子、回复和引用,点赞、转发和发送私信。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
X_CLIENT_ID, X_CLIENT_SECRET
步骤 1 — 获取凭证
- 打开
https://console.x.com上的 X Developer Console,用将拥有该应用的 X 账号登录,然后点击 Create App。 - 在账单(billing)中充值 API 额度。X API 采用预付额度、按用量计费的方式,新开发者没有免费套餐:没有额度时,X 会拒绝所有调用。
- 打开应用的 User authentication settings,点击 Set up。应用权限选择 Read and write and Direct message(如果不使用私信工具,Read and write 就够了),应用类型选择 Web App, Automated App or Bot,再填写一个网站 URL 和回调 URI
https://cloud.anythingmcp.com/api/mcp-oauth/callback。如果你自托管 AnythingMCP,则为<your AnythingMCP URL>/api/mcp-oauth/callback。X 会逐字符比对,包括末尾的斜杠。本地部署请使用127.0.0.1,不要用localhost:http://127.0.0.1:<port>/api/mcp-oauth/callback。 - 把 OAuth 2.0 Client ID 和 Client Secret 复制到
X_CLIENT_ID和X_CLIENT_SECRET。X 只显示一次 secret。应用的 API Key、API Secret 和 Bearer Token 属于其他登录方式,这里不使用。 - 安装连接器,点击 Authorize with Provider,并在 X 上允许访问。登录使用 OAuth 2.0,因此 AnythingMCP 永远看不到你的 X 密码,并会自动续期访问令牌(有效期两小时)。
- 先运行
x_get_me:它返回你的账号以及数字用户 ID,时间线、点赞、转发、书签和关注工具都需要这个 ID。x_get_user_by_username可以把任意 @username 转换为对应的 ID。
费用:X 会从你的额度余额中扣除每一次读取和每一次发布的费用。发布比读取贵,带链接的帖子则贵得多。如果你登录所用的账号同时也是开发者应用的所有者,读取你自己的数据会更便宜;同一条内容在同一个 UTC 日内读取两次只计费一次。请在 Developer Console 中设置支出上限,并在 https://docs.x.com/x-api/getting-started/pricing 查看 X 的最新价格。请求更少的结果可以降低费用,因为返回的每一条内容都会计费。
先确认:帖子、回复、引用、转发和私信(x_create_post、x_reply_to_post、x_quote_post、x_repost、x_send_dm、x_send_dm_to_conversation)会立即发出,因此 AI 会先给你看确切的文字和接收者,等你同意后再发送。关注和取消关注账号也需要确认。x_delete_post 和 x_delete_dm 在安装时处于关闭状态。
回复:只有当原帖作者提及或引用了你的账号时,X 才接受通过 API 发送的回复。在你自己的帖子串中回复,以及回复提及你的帖子,都可以正常使用。
搜索和消息:搜索覆盖最近 7 天,并支持 X 的运算符,例如 from:、to:、#hashtag、"exact phrase"、-is:retweet 或 lang:en。x_count_recent_posts 只统计匹配帖子的数量,不读取内容。私信覆盖最近 30 天;加密会话无法通过 API 获取。
只读或不含私信:在连接器的 OAuth 设置中删除 .write scope 或 dm. scope,重新授权,并关闭需要它们的工具。
常见错误:401 表示授权已被撤销或 client secret 已更改,请重新授权。带有 client-forbidden 或 client-not-enrolled 的 403 表示应用没有使用按量付费:在 Developer Console 中把它移到 Pay-per-use 套餐和 Production 环境,并充值额度。以前正常的调用开始失败,通常意味着额度或支出上限已用完。429 是 X 的速率限制,每 15 分钟重置一次。
连接器不会上传媒体(帖子仅限文字或投票)、搜索完整存档、以流式方式获取帖子、管理列表、静音或屏蔽账号,也不会投放广告。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Cursor 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Cursor 从 ~/.cursor/mcp.json 读取 MCP 服务器。添加以下条目:
{
"mcpServers": {
"anythingmcp": {
"url": "https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID",
"headers": { "X-API-Key": "YOUR_MCP_API_KEY" }
}
}
}
- 在 AnythingMCP 的 MCP Servers → 你的服务器 → API keys 中创建 MCP API 密钥,并用它替换
YOUR_MCP_API_KEY。 - 保存文件并重启 Cursor。
- 打开 Cursor → Settings → MCP,确认
anythingmcp已列出并处于已连接状态。 - 开始对话,智能体现在可以调用
X (Twitter)的工具。
可用工具
| Tool | What it does |
|---|---|
x_get_me | Read the X account that authorized the connector: id, name, @username and the user fields asked for |
x_get_user_by_username | Look up one X account by its @username (without the @): id, name, bio, follower and post counts and more |
x_get_users_by_usernames | Look up up to 100 X accounts by @username in one call |
x_get_user | Look up one X account by its numeric user id: name, @username, bio, counts and the user fields asked for |
x_search_users | Find X accounts by name or @username keywords |
x_get_post | Read one post by id: text, author_id, time, metrics and the fields asked for |
x_get_posts | Read up to 100 posts by id in one call |
x_list_user_posts | List the most recent posts of an account (up to the last 3,200), newest first |
x_list_user_mentions | List the most recent posts that mention an account (up to the last 800), newest first |
x_get_home_timeline | Read your home timeline in reverse chronological order: posts and reposts from you and the accounts you follow |
x_search_recent_posts | Search posts from the last 7 days with X search operators, e.g. "anythingmcp lang:en -is:retweet", from:username, to:username, #hashtag… |
x_count_recent_posts | Count the posts of the last 7 days that match a search query, per minute, hour or day, without reading them |
x_list_quote_posts | List the posts that quote a given post, newest first, with the quoting text and author_id |
x_list_reposted_by | List the accounts that reposted a post, with the user fields asked for |
x_list_liking_users | List the accounts that liked a post |
x_create_post | Publish a new post on the authorized account, visible to everyone at once |
x_reply_to_post | Publish a reply to a post, visible to everyone at once |
x_quote_post | Publish a post that quotes another post with your comment, visible to everyone at once |
x_delete_post | Delete one of your own posts for good |
x_list_liked_posts | List the posts an account liked, newest like first |
x_like_post | Like a post as the authorized account |
x_unlike_post | Remove your like from a post you liked before |
x_repost | Repost a post to your followers, visible to everyone at once |
x_undo_repost | Take back your repost of a post; the original post stays |
x_list_bookmarks | List your bookmarked posts, most recently bookmarked first (up to the last 800) |
x_add_bookmark | Bookmark a post |
x_remove_bookmark | Remove a post from your bookmarks |
x_list_followers | List the accounts that follow an account, newest follower first |
x_list_following | List the accounts an account follows, most recently followed first |
x_follow_user | Follow an account as the authorized account; the other account is notified |
x_unfollow_user | Stop following an account as the authorized account |
x_list_owned_lists | List the X Lists an account owns: id, name, description, member and follower counts |
x_list_followed_lists | List the X Lists an account follows: id, name, description, member and follower counts |
x_get_list | Read one X List: name, description, member and follower counts, whether it is private and when it was created |
x_list_list_posts | Read the latest posts from the members of an X List, newest first |
x_list_list_members | List the accounts that are members of an X List, with the user fields asked for |
x_list_dm_events | List your recent direct messages across all conversations (the last 30 days), newest first |
x_list_dm_conversation_with_user | Read your one-to-one direct message conversation with another account (the last 30 days), newest first |
x_send_dm | Send a direct message to an account, in your one-to-one conversation with it (created when needed) |
x_send_dm_to_conversation | Send a direct message into an existing conversation (one-to-one or group) by its dm_conversation_id from x_list_dm_events |
x_delete_dm | Delete one of your direct messages, for you only (the other side keeps it) |
示例提示
- “显示今天提及我账号的帖子,并为其中提问的帖子起草回复。”
- “搜索最近 7 天关于我们产品发布的帖子,并总结整体语气。”
- “本周每天有多少帖子提到了 #ourbrand?”
- “起草一条宣布我们新定价页面的帖子,在我批准文字后发布。”
FAQ
Cursor 免费套餐支持自定义 MCP 服务器吗? 支持,Hobby、Pro 和 Business 套餐均可使用 MCP。
下一步
这份指南对你有帮助吗?