IX

infatoshi/x-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

57 stars 17 forks 质量 69 趋势 13

infatoshi/x-mcp 是从 https://github.com/infatoshi/x-mcp. 导入的 MCP 服务器候选

概览

infatoshi/x-mcp 是从 https://github.com/infatoshi/x-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

一个MCP(模型上下文协议)服务器,赋予AI代理对X(Twitter)API的完全访问权限。通过自然语言发布推文、搜索、阅读时间线、点赞、转发、上传媒体。

可兼容Claude Code、Claude Desktop、OpenAI Codex、Cursor、Windsurf、Cline以及任何其他兼容MCP的客户端。

如果你是一名帮助用户搭建该项目的LLM/AI代理,请阅读LLMs.md,了解你可以引导用户一步步完成的步骤。


它能做什么?

分类 工具 你可以说的 状态
帖子 post_tweet, quote_tweet, delete_tweet “在X上发布’你好世界’” 好的
阅读 get_tweet, search_tweets, get_timeline, get_mentions “给我看看@elonmusk的最新帖子” 好的
用户 get_user, get_followers, get_following “查找@openai” / “该用户关注谁?” 好的
参与 retweet “转发此文” 好的
媒体upload_media “上传这张图片并附上说明…” 好的
分析get_metrics “我上一篇帖子获得了多少曝光?” 好的

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

x-mcp

An MCP (Model Context Protocol) server that gives AI agents full access to the X (Twitter) API. Post tweets, search, read timelines, like, retweet, upload media – all through natural language.

Works with Claude Code, Claude Desktop, OpenAI Codex, Cursor, Windsurf, Cline, and any other MCP-compatible client.

If you’re an LLM/AI agent helping a user set up this project, read LLMs.md for step-by-step instructions you can walk the user through.


What Can It Do?

Category Tools What You Can Say Status
Post post_tweet, quote_tweet, delete_tweet “Post ‘hello world’ on X” OK
Read get_tweet, search_tweets, get_timeline, get_mentions “Show me @elonmusk’s latest posts” OK
Users get_user, get_followers, get_following “Look up @openai” / “Who does this user follow?” OK
Engage retweet “Retweet this” OK
Media upload_media “Upload this image and post it with the caption…” OK
Analytics get_metrics “How many impressions did my last post get?” OK
Bookmarks get_bookmarks, bookmark_tweet, unbookmark_tweet “Show my bookmarks” Requires Basic+ tier
Reply reply_to_tweet “Reply to this tweet saying thanks” Restricted (see below)
Like like_tweet “Like that tweet” Removed on Free tier (see below)

Accepts tweet URLs or IDs interchangeably – paste https://x.com/user/status/123 or just 123.


Setup

1. Clone and build

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

2. Get your X API credentials

You need 5 credentials from the X Developer Portal. Here’s exactly how to get them:

a) Create an app

  1. Go to the X Developer Portal
  2. Sign in with your X account
  3. Go to Apps in the left sidebar
  4. Click Create App (you may need to sign up for a developer account first)
  5. Give it a name (e.g., my-x-mcp)
  6. You’ll immediately see your Consumer Key (API Key), Secret Key (API Secret), and Bearer Token
  7. Save all three now – the secret won’t be shown again

b) Enable write permissions

By default, new apps only have Read permissions. You need Read and Write to post tweets, like, retweet, etc.

  1. In your app’s page, scroll down to User authentication settings
  2. Click Set up
  3. Set App permissions to Read and write
  4. Set Type of App to Web App, Automated App or Bot
  5. Set Callback URI / Redirect URL to https://localhost (required but won’t be used)
  6. Set Website URL to any valid URL (e.g., https://x.com)
  7. Click Save

c) Generate access tokens (with write permissions)

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "x-twitter": { "command": "node", "args": ["/ABSOLUTE/PATH/TO/x-mcp/dist/index.js"], "env": { "X_API_KEY": "your_consumer_key", "X_API_SECRET": "your_secret_key", "X_ACCESS_TOKEN": "your_access_token", "X_ACCESS_TOKEN_SECRET": "your_access_token_secret", "X_BEARER_TOKEN": "your_bearer_token" } } } }