Token导航 LogoToken导航TokenDH.com
X Autonomous MCP logo
AI代理未说明官方级别未说明来源级核验

X Autonomous MCP

MCP Server

一个为AI代理提供完整X(Twitter) API访问的MCP服务器,包含安全限制和自然语言交互功能。

工具数

28

提示词数

0

GitHub Stars

2

资源数

0
TypeScriptClaude自然语言处理Claude DesktopClaudeCursorWindsurfCline

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

JohannesHoppe

提供方

JohannesHoppe

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

x-autonomous-mcp

不要使用X API。不用付钱,它死了。 2026年2月23日,X推出了“杀死机器人行动“--平台范围内的限制,阻止 全部 程序化回复任何没有首先提到你的人。他们的公告说“不回复将保持不变”。这是一个谎言。冷 引用推文 也被相同的403错误阻止。也一样 @在常规帖子中提及.API文档仍然列出了这些可用功能。他们不是。 你付钱干什么?你可以搜索推文,阅读它们,并喜欢它们。就是这样。你不能回复任何人。你不能引用任何人的推文。你不能在单独的帖子中@提及任何人。除非目标已经知道你的存在,否则每个“参与”端点都会返回403。企业不受任何限制,因为它当然是。 我们构建了整个MCP服务器,包括预算限制、参与度消除、工作流编排、紧凑的响应和智能回复报价回退系统。所有这些都工作得很好。这一切都不重要,因为X决定API应该是一个只读提要阅读器,每次读取都要收费。 如果您正在评估任何涉及机器人程序、代理或自动化的X API 与他人交谈:省钱。API不是开发人员平台。这是一个蜜罐,它接受你的付款,然后阻止你支付的功能,不退款,也不提前通知。 --更新2026-03-01,在发现即使是我们的报价推文解决方法也会得到403分后。

一个MCP(模型上下文协议)服务器,为人工智能代理提供对X(Twitter)API的完全访问-内置用于自主操作的安全轨道。通过自然语言发布推文、搜索、阅读时间线、点赞、转发、上传媒体。包括每日预算限制、参与重复数据删除、紧凑的TOON编码响应、自描述错误以及MCP协调多步增长策略的工作流系统。

使用 克劳德代码, 克劳德桌面版, OpenAI Codex, OpenClaw(ClawdBot), 光标, 帆板运动, 克莱恩,以及任何其他MCP兼容客户端。

如果您是帮助用户设置此项目的LLM/AI代理,请阅读 LLMs.md 有关分步说明,您可以引导用户完成。

______________________________________________________________________

安全特性

每日预算限额

每天每种动作类型的硬限制。MCP服务器在耗尽时拒绝——即使LLM忽略每条指令,它也能工作。

X_MCP_MAX_REPLIES=8      # Max replies per day (default)
X_MCP_MAX_ORIGINALS=2    # Max standalone posts per day
X_MCP_MAX_LIKES=20       # Max likes per day
X_MCP_MAX_RETWEETS=5     # Max retweets per day
X_MCP_MAX_FOLLOWS=10     # Max follows per day
X_MCP_MAX_UNFOLLOWS=10   # Max unfollows per day
X_MCP_MAX_DELETES=5      # Max tweet deletions per day

吃起来 0 完全禁用某个操作。吃起来 -1 无限制。

每个回复中都有预算计数器

每个MCP响应都包括剩余的预算——读写都一样。LLM在不读取内存文件的情况下主动发现其局限性:

{
  "data": { "id": "123", "text": "..." },
  "x_rate_limit": "299/300 remaining, resets in 900s",
  "x_budget": "3/8 replies used, 0/2 originals used, 5/20 likes used, 1/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used | last action: 3m ago"
}

TOON编码响应(默认打开)

响应使用 TOON(面向令牌的对象表示法) 而不是JSON。对于数组密集的响应(时间线、搜索结果、关注者),TOON在标头中声明一次字段名,并使用CSV样式的行——比JSON少得多的标记:

data[2]{id,text,author,author_followers,author_follower_ratio,likes,retweets,replies,replied_to_id,created_at}:
  "123",Hello world,@foo,5200,2.1,9,2,0,null,"2026-02-23T17:00:01.000Z"
  "456",Another tweet,@foo,5200,2.1,3,0,1,null,"2026-02-23T16:00:00.000Z"
meta:
  result_count: 2
  next_token: abc
x_rate_limit: 299/300 (900s)
x_budget: "3/8 replies used, 0/2 originals used, 5/20 likes used, 1/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used"

X_MCP_TOON=false 以获得不漂亮的JSON。

压缩响应(默认打开)

剥离LLM不需要的字段。下降: entities, edit_history_tweet_ids, conversation_id, lang, annotations、URL扩展、图像元数据。变平 public_metrics 并解决 author_id@username长推文(高级,>280个字符)被透明地合并—— text 无论推文长度如何,字段始终包含全文。

交互重复数据删除(默认启用)

永远不要回复、点赞或转发同一条推文两次。永久跟踪-防止垃圾邮件报告在几天后重新吸引同一条推文。

带有拼写错误建议的自我描述错误

每个工具都会验证参数并返回可操作的提示。硬编码重定向会捕获常见错误,模糊匹配会建议拼写最接近的有效参数:

Unknown parameter 'reply_to_tweet_id': Use the 'reply_to_tweet' tool instead.
Unknown parameter 'poll_option': Did you mean 'poll_options'?

Valid parameters for post_tweet: text, poll_options, poll_duration_minutes, media_ids

冷回复自动回退(被X打断——见上面的警告)

X的API(自2026年2月起)会阻止程序回复,除非目标作者@提到了您的帐户。 reply_to_tweet 自动处理:它检查 mentioned_by 缓存(由填充 get_mentions)并在直接回复被阻止时发布引用推文。回应包括 _fallback: "quote_tweet" 当这种情况发生时。无论如何,预算都会计入回复限制。

更新(2026-03-01): 引用推文回退也被X阻止。冷引用推文返回与冷回复相同的403。代码是正确的——X只是屏蔽了所有东西。请参阅本README顶部的警告。

预算限制的破坏性工具

delete_tweetunfollow_user 预算有限。吃起来 0 要完全阻止它们:

X_MCP_MAX_UNFOLLOWS=10   # Default 10/day. Set to 0 to block all unfollows.
X_MCP_MAX_DELETES=5      # Default 5/day. Set to 0 to block all deletions.

受保护的帐户

逗号分隔的用户名 不能 被取消跟踪--由检查 unfollow_user, cleanup_non_followers,以及工作流清理:

X_MCP_PROTECTED_ACCOUNTS=friend1,friend2,@mentor

未知参数检测

MCP服务器会捕获未知参数(不会自动忽略)。未知密钥会触发模糊匹配建议或硬编码重定向提示——LLM会从错误中学习,而不是得到不透明的验证错误。

______________________________________________________________________

特性

参与度过滤 search_tweets

X API v2没有 min_faves 操作员。x-autonomous-mcp添加 客户端参与过滤 所以低参与度的推文永远不会到达LLM:

search_tweets query="AI safety -is:retweet" max_results=10 min_likes=20 min_retweets=5

设置过滤器后,服务器在内部获取100个结果,按以下方式进行过滤 public_metrics,并返回到 max_resultsThe includes.users 数组被修剪以匹配。

相关性排序开启 search_tweets

search_tweets query="AI hallucination" sort_order="relevancy"

默认值为 recency (最新第一)。 relevancy 首先展示热门推文,这自然会与 min_likes 过滤。

通过以下方式进行增量轮询 since_id

两者 search_tweetsget_mentions 接受 since_id --只返回比给定推特ID更新的结果。对于定期轮询的代理,这避免了重新处理旧结果并节省了令牌。

get_mentions since_id="2025881827982876805"
search_tweets query="@mybot" since_id="2025881827982876805"

用户名或ID——无处不在

所有与用户相关的工具(get_timeline, get_followers, get_following, follow_user, unfollow_user, get_non_followers)接受a @username,一个普通的用户名或一个数字用户ID。不再需要两步“先查找用户,然后获取时间线”的舞蹈。服务器会自动解析它。

get_timeline user="@JohannesHoppe"
get_timeline user="JohannesHoppe"
get_timeline user="43859239"

精益响应

  • 省略 profile_image_url 以及来自API请求的媒体扩展(对LLM无用,浪费令牌)
  • 包含 public_metrics 在搜索结果的用户扩展中(这样代理在评估回复目标时就可以看到关注者数量)

______________________________________________________________________

它能做什么?

类别工具你能说什么
发布post_tweet, reply_to_tweet, quote_tweet“在X上发布‘hello world’”/“回复这条推文说谢谢”
阅读get_tweet, search_tweets, get_timeline, get_mentions“显示@JohannesHoppe的最新帖子”/“搜索有关MCP的推文”
用户get_user, get_followers, get_following, get_non_followers“查找@openai”/“谁不跟我回去?”
参与like_tweet, retweet, follow_user“喜欢那条推文”/“关注@openai”
撤销unlike_tweet, unretweet, unfollow_user, delete_tweet“与那条推文不同”/“取消关注@spambot”
列表get_list_members, get_list_tweets, get_followed_lists“显示此列表的成员”/“我关注哪些列表?”
媒体upload_media“上传此图像并附上标题…”
分析get_metrics“我上一篇文章给人留下了多少印象?”
工作流get_next_task, submit_task, start_workflow, get_workflow_status, cleanup_non_followers“我的下一个任务是什么?”/“开始关注@interesting_user”

可互换地接受推特URL或ID——粘贴 https://x.com/user/status/123 或者只是 123. 接受有或没有用户名 @,或数字用户ID-- @JohannesHoppe, JohannesHoppe,或 43859239.

搜索结果和时间线推文包括 author_followers (原始计数)和 author_follower_ratio (追随者/追随者比率,预先计算),这样你就可以在不消耗算术令牌的情况下评估参与质量。

______________________________________________________________________

示例响应(TOON格式)

每个回复都包括 x_rate_limitx_budget 领域。数组端点使用TOON的表格格式(字段名在标题中一次,CSV样式的行)。集 X_MCP_TOON=false 改为JSON。

get_timeline/search_tweets/get_ments

data[3]{id,text,author,author_followers,author_follower_ratio,likes,retweets,replies,replied_to_id,created_at}:
  "1893660912",Build agents not wrappers,@karpathy,3940281,118.6,4521,312,89,null,"2026-02-23T17:00:01.000Z"
  "1893660913",Hot take: MCP is underrated,@swyx,98200,3.2,210,45,12,null,"2026-02-23T16:30:00.000Z"
  "1893660914",Agreed!,@johndoe,1500,0.8,3,0,0,"1893660913","2026-02-23T16:45:00.000Z"
meta:
  result_count: 3
  next_token: abc123
x_rate_limit: 299/300 (900s)
x_budget: "3/8 replies used, 0/2 originals used, 5/20 likes used, 1/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used | last action: 3m ago"

紧凑的推文包括 author_followers (原始计数)和 author_follower_ratio (追随者/追随者比率,预先计算)。 replied_to_id 这是正在回复的推特ID,或者 null 对于独立推文。

获取推特

data:
  id: "1893660912"
  text: Build agents not wrappers
  author: "@karpathy"
  author_followers: 3940281
  author_follower_ratio: 118.6
  likes: 4521
  retweets: 312
  replies: 89
  replied_to_id: null
  created_at: "2026-02-23T17:00:01.000Z"
x_rate_limit: 299/300 (900s)
x_budget: "3/8 replies used, 0/2 originals used, 5/20 likes used, 1/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used"

get_user

data:
  id: "43859239"
  username: JohannesHoppe
  name: Johannes Hoppe
  followers: 1234
  following: 567
  tweets: 890
  bio: Building things with TypeScript and AI
  pinned_tweet_id: "1893650001"
x_rate_limit: 299/300 (900s)
x_budget: "0/8 replies used, 0/2 originals used, 0/20 likes used, 0/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used"

get_followpowers/get_following

data[2]{id,username,name,followers,following,tweets,bio,pinned_tweet_id}:
  "123456",alice_dev,Alice,8900,450,1200,Full-stack engineer,"1893650100"
  "789012",bob_ai,Bob,340,120,890,ML researcher,null
meta:
  result_count: 2
  next_token: def456
x_rate_limit: 14/15 (900s)
x_budget: "0/8 replies used, 0/2 originals used, 0/20 likes used, 0/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used"

获取_关注者

data[2]{id,username,name,followers,following,tweets,bio,pinned_tweet_id}:
  "111222",inactive_acc,Some Account,12,5000,3,,null
  "333444",spam_bot,Spammy,0,10000,50000,Follow me!,null
meta:
  total_following: 567
  total_followers: 1234
  non_followers_count: 2
x_rate_limit: 14/15 (900s)
x_budget: "0/8 replies used, 0/2 originals used, 0/20 likes used, 0/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used"

按关注者数量升序排序(最低质量优先=最佳取消关注候选人)。摘要字段(total_following, total_followers, non_followers_count)都在 meta.

发布推特/回复推特/引用推特

data:
  id: "1893661000"
  text: Hello world!
x_rate_limit: 199/200 (900s)
x_budget: "0/8 replies used, 1/2 originals used, 0/20 likes used, 0/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used | last action: 0s ago"

like_tweet/retweet/follow_user

data:
  liked: true
x_rate_limit: 199/200 (900s)
x_budget: "0/8 replies used, 0/2 originals used, 1/20 likes used, 0/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used | last action: 0s ago"

get_metrics

data:
  id: "1893660912"
  text: Build agents not wrappers
  public_metrics:
    like_count: 4521
    retweet_count: 312
    reply_count: 89
    quote_count: 23
    bookmark_count: 156
    impression_count: 892340
x_rate_limit: 299/300 (900s)
x_budget: "0/8 replies used, 0/2 originals used, 0/20 likes used, 0/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used"

upload_media

media_id: "1893670001"
message: Upload complete. Use this media_id in post_tweet.
x_rate_limit: 299/300 (900s)
x_budget: "0/8 replies used, 0/2 originals used, 0/20 likes used, 0/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used"

错误响应

预算已用尽:

Error: Daily reply limit reached (8/8). Try again tomorrow. Remaining today: 0 replies, 2 originals, 15 likes, 5 retweets, 10 follows, 10 unfollows, 5 deletes.

Current x_budget: 8/8 replies used (LIMIT REACHED), 0/2 originals used, 5/20 likes used, 0/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used

重复约定:

Error: Already liked tweet 1893660912 at 2026-02-23T10:00:00.000Z. Duplicate blocked.

Current x_budget: 3/8 replies used, 0/2 originals used, 5/20 likes used, 1/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used

未知参数:

Error: Unknown parameter 'poll_option': Did you mean 'poll_options'?

Valid parameters for post_tweet: text, poll_options, poll_duration_minutes, media_ids

Current x_budget: 0/8 replies used, 0/2 originals used, 0/20 likes used, 0/5 retweets used, 0/10 follows used, 0/10 unfollows used, 0/5 deletes used

______________________________________________________________________

工作流系统

MCP包括一个硬编码的工作流引擎,用于编排多步增长策略。MCP是权威——它自动执行所有机械步骤,只在需要创造性输入时才询问LLM。工作流是持久的:如果LLM断开连接,下一个 get_next_task 呼叫会精确地恢复到中断的位置。活动工作流所针对的用户会自动受到保护 cleanup_non_followers -你不会在与某人交往的过程中意外地不关注对方。

工作流摘要文档
follow_cycle关注,如固定,回复,等待7天,检查跟进,清理全速前进
reply_track跟踪回复48小时,如果没有参与,则自动删除全速前进
cleanup_n关注者一次性取消关注非关注者全速前进

工作流工具

工具说明
get_next_task自动处理所有待处理的工作,返回下一个LLM分配
submit_task提交LLM响应(例如回复文本),自动继续工作流程
start_workflow开始新的follow_cycle或reply_track(reply_tweet_id reply_track需要)
get_workflow_status显示所有包含步骤、日期和结果的工作流
cleanup_non_followers批量取消关注非关注者(尊重预算+受保护帐户)

______________________________________________________________________

设置

1.克隆和构建

git clone https://github.com/JohannesHoppe/x-autonomous-mcp.git
cd x-autonomous-mcp
npm install
npm run build

2.获取您的X API证书

你需要5个证书 X开发者门户。获取它们的具体方法如下:

a) 创建应用程序

  1. X开发者门户
  2. 使用您的X帐户登录
  3. 首选 应用 在左侧边栏中
  4. 点击 创建应用程序 (您可能需要先注册一个开发人员帐户)
  5. 给它起个名字(例如。, my-x-mcp)
  6. 您将立即看到您的 消费者密钥 (API密钥), 密钥 (API机密),以及 持有者令牌
  7. 立即保存所有三个 --这个秘密不会再公开了

b) 启用写入权限

默认情况下,新应用程序只有读取权限。你需要阅读和写作来发布推文、点赞、转发等。

  1. 在应用程序的页面中,向下滚动到 用户身份验证设置
  2. 点击 设置
  3. 应用程序权限读写
  4. 应用程序类型Web应用程序、自动应用程序或机器人
  5. 回调URI/重定向URLhttps://localhost (必填,但不会使用)
  6. 网站网址 指向任何有效的URL(例如。, https://x.com)
  7. 点击 保存

c) 生成访问令牌(具有写入权限)

启用写入权限后,您需要生成(或重新生成)您的访问令牌和密钥,以便它们携带新的权限:

  1. 返回您的应用程序 密钥和令牌
  2. 在...之下 访问令牌和密码,单击 再生
  3. 保存这两个 访问令牌访问令牌密钥

如果在生成令牌之前跳过步骤(b),您的令牌将是只读的,发布将失败,并出现403错误。

3.配置凭据

复制示例env文件并填写您的5个凭据:

cp .env.example .env

编辑 .env:

X_API_KEY=your_consumer_key
X_API_SECRET=your_secret_key
X_BEARER_TOKEN=your_bearer_token
X_ACCESS_TOKEN=your_access_token
X_ACCESS_TOKEN_SECRET=your_access_token_secret

4.配置安全功能(可选)

.env.example 对于所有可用选项:

# Daily budget limits (defaults shown)
X_MCP_MAX_REPLIES=8
X_MCP_MAX_ORIGINALS=2
X_MCP_MAX_LIKES=20
X_MCP_MAX_RETWEETS=5
X_MCP_MAX_FOLLOWS=10
X_MCP_MAX_UNFOLLOWS=10
X_MCP_MAX_DELETES=5

# TOON encoding (default: true) — set to "false" for JSON
X_MCP_TOON=true

# Compact responses (default: true)
X_MCP_COMPACT=true

# Engagement deduplication (default: true)
X_MCP_DEDUP=true

# Protected accounts (cannot be unfollowed)
# X_MCP_PROTECTED_ACCOUNTS=friend1,friend2,@mentor

# Max active workflows (default: 200)
# X_MCP_MAX_WORKFLOWS=200

______________________________________________________________________

连接到您的客户

客户端设置 有关Claude Code、Claude Desktop、Cursor、OpenAI Codex、Windsurf、Cline和其他MCP客户端的配置说明。

______________________________________________________________________

故障排除

403发布时出现“oauth1权限”错误

您的访问令牌是在启用写入权限之前生成的。转到X开发人员门户,确保应用程序权限设置为“读写”,然后 再生 您的访问令牌和密码。

401未经授权

仔细检查您的所有5个凭据 .env 正确,没有多余的空格或换行符。

429价格有限

错误消息包括速率限制重置的确切时间。等到那时,或者降低请求频率。

服务器显示“已连接”,但未使用工具

确保您添加了具有正确作用域的服务器(用户/全局,如果您希望它无处不在,则不是项目作用域),然后重新启动客户端。

______________________________________________________________________

速率限制

每个响应都包含速率限制信息:剩余请求、总限制和重置时间。当达到限制时,您会得到一个带有精确重置时间戳的明显错误。

分页

列表端点返回 next_token 在回应中。将其传回以获取下一页结果。工作内容: search_tweets, get_timeline, get_mentions, get_followers, get_following, get_list_members, get_list_tweets, get_followed_lists.

搜索查询语法

search_tweets 该工具支持X的完整查询语言:

  • from:username --特定用户发布的帖子
  • to:username --回复特定用户
  • #hashtag --包含标签的帖子
  • "exact phrase" --精确文本匹配
  • has:media / has:links / has:images --按内容类型筛选
  • is:reply / -is:retweet --按帖子类型筛选
  • lang:en --按语言筛选
  • 与空格(AND)或 OR

______________________________________________________________________

积分

许可证

麻省理工学院

目录标签

目录标签

TypeScriptClaude自然语言处理社交媒体自动化本地部署AI代理API代理安全限制

支持客户端

Claude DesktopClaudeCursorWindsurfCline

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

28

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP