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
Visit Server

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!

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured