Back to MCP directory
publicPublicdnsLocal runtime

X Twitter

一个通过Claude聊天直接创建、管理和发布X/Twitter帖子的MCP服务器

article

README

🚀 X(Twitter)MCP 服务器

通过Claude聊天直接创建、管理和发布X/Twitter帖子的MCP服务器,为您提供便捷的社交内容管理体验。

smithery badge

🚀 快速开始

📦 安装指南

使用Smithery安装

通过Smithery可自动安装X/Twitter MCP服务器,只需执行以下命令:

npx -y @smithery/cli install x-mcp --client claude

手动安装

  1. 克隆仓库:
git clone https://github.com/yourusername/x-mcp.git
  1. 使用Homebrew全局安装UV:
brew install uv
  1. 创建claude_desktop_config.json文件:

    • 对于MacOS:打开目录 ~/Library/Application Support/Claude/ 并在其中创建文件。
    • 对于Windows:打开目录 %APPDATA%/Claude/ 并在其中创建文件。
  2. 将以下配置添加到claude_desktop_config.json中:

{
  "mcpServers": {
    "x_mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/x-mcp",
        "run",
        "x-mcp"
      ],
      "env": {
        "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"
      }
    }
  }
}
  1. 获取您的X/Twitter API凭证:

    • 前往X API开发者portal
    • 创建一个项目。
    • 在用户身份验证设置中:使用Read和Write权限,Web App类型。
    • 设置回调URL为 http://localhost/ 和网站URL为 http://example.com/
    • 生成并复制所有密钥和令牌(来自密钥和令牌部分)。
  2. 更新配置文件:

    • /path/to/x-mcp 替换为您实际的仓库路径。
    • 添加您的X/Twitter API凭证。
  3. 完全退出Claude,然后重新打开它。

💻 使用示例

基础用法

以下是一些使用示例,您可以在Claude聊天中输入这些指令:

  • "发布'刚刚学会了如何通过AI发推文——脑瓜子都快炸了!🤖✨'"
  • "创建一个关于披萨历史的线程"
  • "显示我的草稿推文"
  • "发布这个草稿!"
  • "删除那个草稿"

🔧 故障排除

如果无法使用该服务器,可参考以下解决方法:

  • 确保UV已全局安装(如果不是,请用 pip uninstall uv 卸载,然后重新安装 brew install uv)。
  • 或者找到UV路径并将其替换为完整的路径:"command": "uv"
  • 验证所有X/Twitter凭证是否正确。
  • 检查x-mcp路径在配置文件中是否与实际仓库位置匹配。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client