MCP.so
Sign In

X (Twitter) MCP server

@rafaljanicki

About X (Twitter) MCP server

X/Twitter MCP server

Basic information

Category

Other

License

MIT

Runtime

python

Transports

stdio

Publisher

rafaljanicki

Config

Add this server to your MCP-compatible client using the configuration below.

{
  "mcpServers": {
    "x-twitter-server": {
      "type": "stdio",
      "command": "x-twitter-mcp-server",
      "args": [],
      "env": {
        "TWITTER_API_KEY": "<TWITTER_API_KEY>",
        "TWITTER_API_SECRET": "<TWITTER_API_SECRET>",
        "TWITTER_ACCESS_TOKEN": "<TWITTER_ACCESS_TOKEN>",
        "TWITTER_ACCESS_TOKEN_SECRET": "<TWITTER_ACCESS_TOKEN_SECRET>",
        "TWITTER_BEARER_TOKEN": "<TWITTER_BEARER_TOKEN>"
      }
    }
  }
}

Tools

No tools detected

We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.

Overview

What is X (Twitter) MCP server?

A Model Context Protocol (MCP) server for interacting with Twitter (X) via AI tools. It allows users to fetch tweets, post tweets, search Twitter, manage followers, and perform other actions through natural language commands in AI clients like Claude Desktop. The server uses Twitter API v2 with proper authentication (API keys and tokens) to minimize the risk of account suspensions.

How to use X (Twitter) MCP server?

Install via Smithery (recommended for Claude Desktop), from PyPI (pip install x-twitter-mcp), or from source. Set required Twitter API credentials as environment variables (TWITTER_API_KEY, TWITTER_API_SECRET, TWITTER_ACCESS_TOKEN, TWITTER_ACCESS_TOKEN_SECRET, TWITTER_BEARER_TOKEN). Run the server either as a Streamable HTTP service (Docker or local ASGI) or as a STDIO CLI script (x-twitter-mcp-server). For Claude Desktop, configure the server in claude_desktop_config.json with the appropriate command and environment variables.

Key features of X (Twitter) MCP server

  • Fetch user profiles, followers, and following lists
  • Post, delete, and favorite tweets
  • Search Twitter for tweets and trends
  • Manage bookmarks and timelines
  • Built-in rate limit handling for the Twitter API
  • Uses Twitter API v2 with proper authentication
  • Complete implementation of Twitter API v2 endpoints

Use cases of X (Twitter) MCP server

  • Fetch a user's Twitter profile via natural language prompts
  • Post tweets directly from an AI assistant like Claude Desktop
  • Search Twitter for recent tweets on a topic
  • Retrieve current trending topics on Twitter
  • Manage bookmarks (get bookmarks, delete all bookmarks) with an OAuth 2.0 user token

FAQ from X (Twitter) MCP server

What are the prerequisites for using this server?

Python 3.10 or higher, a Twitter Developer Account with API credentials (API Key, API Secret, Access Token, Access Token Secret, Bearer Token), and optionally Claude Desktop and Node.js for MCP integration.

How do I obtain Twitter API credentials?

You need to create a developer account and obtain API keys and tokens from the Twitter Developer Portal. For bookmark tools, you also need an OAuth 2.0 user access token obtained via the PKCE authorization flow using Tweepy.

What transport methods are available for the server?

The recommended transport is Streamable HTTP (JSON-RPC over HTTP) with endpoints at /mcp (POST) and /sse (GET). The server also provides a legacy STDIO CLI script for desktop clients.

How do I configure the server with Claude Desktop?

Edit claude_desktop_config.json (located in %APPDATA%\Claude on Windows or ~/Library/Application Support/Claude on macOS) to include the x-twitter-mcp server with the appropriate command and environment variables. Restart Claude Desktop to load the configuration.

What is required for bookmark-related tools?

Bookmark tools (get_bookmarks, delete_all_bookmarks) require an OAuth 2.0 user access token. Set it as the TWITTER_OAUTH2_USER_ACCESS_TOKEN environment variable after completing the PKCE authorization flow with Tweepy.

Comments

More Other MCP servers