X MCP Server

Enhanced MCP server for X with OAuth 2.0 support, media uploads, and comprehensive rate limiting.

Local serverstdioTypeScript

What is the X MCP server?

X mcp server connects X to AI assistants that speak the Model Context Protocol. Enhanced MCP server for X with OAuth 2.0 support, media uploads, and comprehensive rate limiting.

What X does

An enhanced Model Context Protocol (MCP) server for X that adds OAuth 2.0 support, v2 API media uploads, and comprehensive rate limiting to the original implementation.

Key capabilities

  • v1.1 — Legacy API, being phased out but still works with OAuth 1.0a
  • v2 — Modern API with better features but some endpoints have issues
  • Media — OAuth 2.0 tokens cannot access v1.1 media endpoints, must use v2
  • Delete — v2 delete endpoint currently has issues (500 errors), v1.1 works as fallback

Tools it exposes

Once connected, the assistant can call these 5 tools directly:

  • post_tweet — Post a new tweet with optional media attachments and replies
  • search_tweets — Example prompts: - "Search for tweets about #MachineLearning" - "Find 50 recent tweets mentioning @ClaudeAI" - "Search for tweets about TypeScript tutorials"
  • delete_tweet — Example prompts: - "Delete tweet with ID 1234567890" - "Remove my last tweet (provide the ID)"
  • Setup — The Setup tool exposed by this server
  • Commands — The Commands tool exposed by this server

Installing the x mcp server

The server is distributed via npm as npm, so most clients can run it without a manual build step. Add it to your MCP client's configuration and restart the client to pick it up — the copy-paste configs for Claude Desktop, Claude Code and Cursor are on this page.

Configuration

Before the server will start you need to supply 8 environment variables: API_KEY, API_SECRET_KEY, ACCESS_TOKEN, ACCESS_TOKEN_SECRET, AUTH_TYPE, OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_ACCESS_TOKEN. Keep credentials in your client's env block or a secrets manager rather than committing them.

Where it fits

Developer-tool servers are usually the first ones people connect, because they turn "help me with this code" into an assistant that can actually read the repo and act on it. X sits in that group, and the shape of its toolset — post_tweet, search_tweets, delete_tweet among others — tells you what it is really for. Worth comparing against the other developer tools servers in this directory before you commit to one, since several overlap in scope but differ sharply in setup cost and permissions.

Practical notes

  • This server runs locally, so it operates with whatever access your machine and its credentials already have. Scope that deliberately rather than by default.
  • It will not start until its required credentials are present, so set those before wondering why the tools never appear.
  • Maintained by mbelinky, written in TypeScript.
  • MCP clients ask for confirmation before each tool call by default. Keep that on while you learn what the x mcp server actually does with your data.
  • Every entry in this directory is reviewed by hand before it goes live, and details are checked against the project's own documentation.

Available tools

ToolWhat it does
post_tweetPost a new tweet with optional media attachments and replies.
search_tweetsExample prompts: - "Search for tweets about #MachineLearning" - "Find 50 recent tweets mentioning @ClaudeAI" - "Search for tweets about TypeScript tutorials"
delete_tweetExample prompts: - "Delete tweet with ID 1234567890" - "Remove my last tweet (provide the ID)"
SetupThe Setup tool exposed by this server.
CommandsThe Commands tool exposed by this server.

How to install the X MCP server

For OAuth 2.0:
   ```json
   {
     "mcpServers": {
       "twitter-mcp": {
         "command": "npx",
         "args": ["-y", "@mbelinky/x-mcp-server"],
         "env": {
           "AUTH_TYPE": "oauth2",
           "OAUTH2_CLIENT_ID": "your_client_id",
           "OAUTH2_CLIENT_SECRET": "your_client_secret",
           "OAUTH2_ACCESS_TOKEN": "your_access_token",
           "OAUTH2_REFRESH_TOKEN": "your_refresh_token"
         }
       }
     }
   }

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
API_KEYCredential the server authenticates with.Yes
API_SECRET_KEYCredential the server authenticates with.Yes
ACCESS_TOKENCredential the server authenticates with.Yes
ACCESS_TOKEN_SECRETCredential the server authenticates with.Yes
AUTH_TYPEConfiguration value read at startup.Optional
OAUTH2_CLIENT_IDConfiguration value read at startup.Optional
OAUTH2_CLIENT_SECRETCredential the server authenticates with.Yes
OAUTH2_ACCESS_TOKENCredential the server authenticates with.Yes

Example prompts to try

  • Use X to post tweet.
  • Use X to search tweets.
  • Use X to delete tweet.

Frequently asked questions

It connects X to MCP-compatible AI assistants such as Claude and Cursor, exposing 5 tools (post_tweet, search_tweets, delete_tweet, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with X directly.