Skip to main content
Glama

X(Twitter) MCP Server

by cjkcr

X(Twitter) MCP Server

English | 中文

An MCP server to create, manage and publish X/Twitter posts directly through Claude Desktop 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)
  • ✅ Delete drafts
  • ✅ Draft preservation on publish failure

Quick Setup

Installing via Smithery

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

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

Manual Installation for Claude Desktop

  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 Desktop:

  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 Desktop 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.'"

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
  • Enhanced draft management - Improved draft preservation on publish failure
  • Better error handling - More detailed error messages and recovery options

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

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

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.

  1. Features
    1. Quick Setup
      1. Installing via Smithery
      2. Manual Installation for Claude Desktop
      3. Configuration for Gemini CLI
    2. Usage Examples
      1. Troubleshooting
        1. Credits
          1. What's New in This Fork

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/cjkcr/x-mcp'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server