X(Twitter) MCP Server

X(Twitter) MCP Server

Enables creating, managing, and publishing X/Twitter posts, threads, and replies directly through Claude chat. Supports draft management with the ability to create, list, publish, and delete tweet drafts.

Category
访问服务器

README

X(Twitter) MCP Server

smithery badge

English | 中文

An MCP server to create, manage and publish X/Twitter posts directly through Claude code and Gemini CLI chat.

Note: This project is modified from vidhupv/x-mcp, with added reply functionality for tweets.

Features

  • ✅ Create draft tweets
  • ✅ Create draft tweet threads
  • ✅ Create draft replies to existing tweets
  • ✅ List all drafts
  • ✅ Publish drafts (tweets, threads, and replies)
  • ✅ Reply to tweets directly (without creating drafts)
  • ✅ Retweet existing tweets
  • ✅ Quote tweet with comments
  • ✅ Create draft quote tweets
  • ✅ Delete drafts
  • ✅ Draft preservation on publish failure

<a href="https://glama.ai/mcp/servers/jsxr09dktf"> <img width="380" height="200" src="https://glama.ai/mcp/servers/jsxr09dktf/badge" alt="X(Twitter) Server MCP server" /> </a>

Quick Setup

Installing via Smithery

To install X(Twitter) MCP Server for Claude code automatically via Smithery:

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

Manual Installation for Claude code

  1. Clone the repository:
git clone https://github.com/yourusername/x-mcp.git
  1. Install UV globally using Homebrew in Terminal:
brew install uv
  1. Create claude_desktop_config.json:

    • For MacOS: Open directory ~/Library/Application Support/Claude/ and create the file inside it
    • For Windows: Open directory %APPDATA%/Claude/ and create the file inside it
  2. Add this configuration to 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. Get your X/Twitter API credentials:

    • Go to X API Developer Portal
    • Create a project
    • In User Authentication Settings: Set up with Read and Write permissions, Web App type
    • Set Callback URL to http://localhost/ and Website URL to http://example.com/
    • Generate and copy all keys and tokens from Keys and Tokens section
  2. Update the config file:

    • Replace /path/to/x-mcp with your actual repository path
    • Add your X/Twitter API credentials
  3. Quit Claude completely and reopen it

Configuration for Gemini CLI

If you want to use this MCP server with Gemini CLI instead of Claude code:

  1. Install Gemini CLI:
npm install -g @google/gemini-cli
  1. Create or update your MCP configuration file:
    • Create a file named ~/.gemini/settings.json
    • Add the following configuration:
{
  "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. Start Gemini CLI with MCP support:
Restart gemini cli
  1. Update the config file:
    • Replace /path/to/x-mcp with your actual repository path
    • Add your X/Twitter API credentials

Usage Examples

Works with both Claude code and Gemini CLI:

  • "Tweet 'Just learned how to tweet through AI - mind blown! 🤖✨'"
  • "Create a thread about the history of pizza"
  • "Show me my draft tweets"
  • "Publish this draft!"
  • "Delete that draft"
  • "Reply to tweet 1234567890 with 'Great point! Thanks for sharing.'"
  • "Create a draft reply to tweet 1234567890 saying 'I completely agree with this perspective.'"
  • "Retweet tweet 1234567890"
  • "Quote tweet 1234567890 with comment 'This is exactly what I was thinking!'"
  • "Create a draft quote tweet for 1234567890 with comment 'Amazing insight here'"

Troubleshooting

If not working:

  • Make sure UV is installed globally (if not, uninstall with pip uninstall uv and reinstall with brew install uv)
  • Or find UV path with which uv and replace "command": "uv" with the full path
  • Verify all X/Twitter credentials are correct
  • Check if the x-mcp path in config matches your actual repository location

Credits

This project is based on the excellent work by Vidhu Panhavoor Vasudevan in the original x-mcp repository.

What's New in This Fork

  • Reply to tweets functionality - Create draft replies and reply directly to existing tweets
  • Retweet functionality - Simple retweets and quote tweets with comments
  • Enhanced draft management - Improved draft preservation on publish failure, support for quote tweet drafts
  • Better error handling - More detailed error messages and recovery options

Special thanks to the original author for creating the foundation of this MCP server!

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选