x.com
MCP server implementation for X.com API with OAuth 2.0 support
claude mcp add --transport stdio tiovikram-x.com-mcp-server node dist/index.js \ --env X_COM_ACCESS_TOKEN="your-access-token"
How to use
This MCP server exposes X.com (formerly Twitter) capabilities through a Model Context Protocol interface. It provides OAuth 2.0 Bearer token authentication and full coverage of the X.com Post API, including reading, writing, searching, and managing posts, likes, retweets, and bookmarks. The server ships with TypeScript definitions and validation, and exposes a set of 21 tools for common operations such as creating, deleting, and hiding replies; retrieving user timelines and mentions; performing recent and full-archive searches; counting posts over time; and managing likes, retweets, and bookmarks. To use it, obtain an access token via the X.com OAuth 2.0 flow and configure your MCP client to supply X_COM_ACCESS_TOKEN when starting the server or running via Docker. You can then invoke tools like createPost, searchRecent, getUserTimeline, likePost, getPostCountsRecent, and others through your MCP client by name and a structured arguments object. The server endpoints map to X.com API v2 resources (tweets, users, counts, retweets, etc.), enabling LLMs to perform complex interactions with X.com data in a controlled, typed manner. Typical workflows include composing posts, querying timelines, retrieving engagement metrics, and analyzing bookmarks and mentions within a single MCP-enabled dialogue context.
How to install
Prerequisites:
- Node.js (LTS version) installed on your system
- Optional: Docker if you prefer containerized deployment
- Access to an X.com OAuth 2.0 access token (X_COM_ACCESS_TOKEN)
Install from source (Node.js):
- Clone the repository or download the code
- Install dependencies and build
pnpm install
pnpm run build
- Run the server locally
node dist/index.js
Run with Docker:
- Build the Docker image
docker build -t x.com-mcp .
- Run the container with your access token
docker run -i --rm -e X_COM_ACCESS_TOKEN=your-access-token x.com-mcp
Configuration for Claude.app (example):
- Using Node.js runtime in Claude settings:
"mcpServers": {
"x-com": {
"command": "node",
"args": ["dist/index.js"],
"env": {
"X_COM_ACCESS_TOKEN": "your-access-token"
}
}
}
- Using Docker:
"mcpServers": {
"x-com": {
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "X_COM_ACCESS_TOKEN=your-access-token", "x.com-mcp"]
}
}
Additional notes
Environment variable X_COM_ACCESS_TOKEN is required for authentication. Ensure your X.com app has the appropriate OAuth scopes: tweet.read, tweet.write, tweet.moderate.write, users.read, like.read, like.write, bookmark.read, and bookmark.write. If you encounter rate-limit errors, review the X.com API rate limits in the README and adjust request usage accordingly. The server exposes endpoints for all post-related operations and supports safe, typed interactions via the provided tools. For debugging, you can use the MCP inspector as described in the README, e.g., npx @modelcontextprotocol/inspector node dist/index.js. If you plan to run behind a reverse proxy or in production, consider setting environment variables securely and handling token refresh if you implement a time-limited token strategy.
Related MCP Servers
iterm
A Model Context Protocol server that executes commands in the current iTerm session - useful for REPL and CLI assistance
mcp
Octopus Deploy Official MCP Server
furi
CLI & API for MCP management
editor
MCP Server for Phaser Editor
DoorDash
MCP server from JordanDalton/DoorDash-MCP-Server
mcp
MCP сервер для автоматического создания и развертывания приложений в Timeweb Cloud