x-v2
An MCP server implementation that provides tools for interacting with the [Twitter/X API v2](https://docs.x.com/x-api/introduction).
claude mcp add --transport stdio nexusx-mcp-x-v2-server node dist/index.js \ --env TWITTER_API_KEY="your_api_key" \ --env TWITTER_ACCESS_TOKEN="your_access_token" \ --env TWITTER_API_KEY_SECRET="your_api_secret" \ --env TWITTER_ACCESS_TOKEN_SECRET="your_access_token_secret"
How to use
The X V2 MCP Server provides a suite of tools for interacting with the Twitter/X API v2. You can retrieve user timelines, fetch individual tweets, manage mentions, post and quote tweets, reply to tweets, like and follow actions, and even search for content or manage lists. Each tool corresponds to a specific Twitter API action (for example, get_tweets_by_userid retrieves a user’s timeline, post_tweet publishes a new tweet, and follow_user follows a target account). The server exposes these capabilities as MCP tools so you can call them programmatically from your AI workflows or agents. To get started, ensure the server is running with the required Twitter API credentials in the environment, then use the available tools by name with the appropriate parameters described in the README.
Typical workflows include: fetching a user’s recent tweets to analyze sentiment or trends, replying to a tweet with context-aware content, posting a new tweet with media (imageBase64), or gathering trending topics for a location to inform content strategy. The tools are designed to be composable, allowing you to chain actions (e.g., search_tweets to find content, then quote_tweet to respond with a commentary).
How to install
Prerequisites:
- Node.js (14.x or newer) and npm installed on your system
- Access to Twitter API v2 credentials (API key, API key secret, Access token, Access token secret)
Installation steps:
- Clone the repository or download the release package.
- Install dependencies: npm install
- Build the project (if required by the project setup): npm run build
- Prepare environment variables either in your shell or a .env file with the following keys: TWITTER_API_KEY=your_api_key TWITTER_API_KEY_SECRET=your_api_secret TWITTER_ACCESS_TOKEN=your_access_token TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret
- Run the MCP server (as described in the mcp_config): node dist/index.js
- Open your MCP inspector or connect to the server using the MCP tooling to verify that the tools are available.
Note: If your build process outputs to a different path, adjust the mcp_config accordingly (e.g., replace dist/index.js with build/server.js or similar).
Additional notes
Environment variables for Twitter authentication must be correctly set; otherwise, API requests will fail. If you encounter rate limit issues, consider implementing exponential backoff in your client logic. The MCP server logs can help diagnose authentication problems or invalid parameter values for any tool. For production deployments, securely manage environment variables (e.g., use a secrets manager) and consider restricting access to the MCP server endpoints. If you expand capabilities, you can add more Twitter API v2 endpoints following the existing tool patterns (names, param schemas).
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