Model Context Protocol server for Twitter integration. can be used to perform CRUD like operations using the twitter API in the background
claude mcp add --transport stdio dishant27-twitter-mcp node dist/index.js \ --env TWITTER_API_KEY="your_api_key" \ --env TWITTER_API_SECRET="your_api_secret" \ --env TWITTER_ACCESS_TOKEN="your_access_token" \ --env TWITTER_ACCESS_TOKEN_SECRET="your_access_token_secret"
How to use
This MCP server provides an interface to interact with X (formerly Twitter) via a set of MCP tools. It supports posting tweets, searching tweets, managing user profiles, following/unfollowing accounts, and managing lists. The tools expose common actions such as post_tweet, search_tweets, get_profile, update_profile, follow_user, unfollow_user, list_followers, list_following, create_list, get_list_info, and get_user_lists. To use these with an MCP client, ensure your client is configured to target this server (name: twitter) and supply the required API keys via environment variables. The server authenticates requests using the provided keys and exposes the operations through the standardized MCP toolkit interface, returning structured results that include success status and relevant data.
How to install
Prerequisites:
- Node.js 18.x or higher
- npm (bundled with Node.js)
- X Developer account with API keys (API Key, API Secret, Access Token, Access Token Secret)
- Clone the repository
git clone https://github.com/Dishant27/twitter-mcp.git
cd twitter-mcp
- Install dependencies
npm install
- Create a .env file (optional but recommended) with your credentials
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
- Start the server
npm start
- Verify the server is running by checking logs or sending a test request via your MCP client.
Notes:
- If you prefer not to use a .env file, you can export the environment variables in your shell before starting the server.
- The server expects Node.js 18+ and relies on the X/API keys you provide to authorize requests to X.
Additional notes
Tips and common issues:
- Ensure your X API keys have the required permissions (API v1 and v2 access as noted).
- If you encounter authentication errors, double-check that TWITTER_API_KEY, TWITTER_API_SECRET, TWITTER_ACCESS_TOKEN, and TWITTER_ACCESS_TOKEN_SECRET are correct and active.
- When configuring Claude or another MCP client, use the provided Claude configuration structure as a reference, particularly the startup.env block to pass secrets.
- The available MCP tools cover posting, searching, profile management, following/unfollowing, and list management. Use the corresponding tool names in your MCP client calls.
- If your deployment uses Docker or a different runtime, adapt the mcp_config accordingly (this setup uses a Node.js runtime with dist/index.js).
Related MCP Servers
mcp-graphql
Model Context Protocol server for GraphQL
mcp-rquest
A MCP server providing realistic browser-like HTTP request capabilities with accurate TLS/JA3/JA4 fingerprints for bypassing anti-bot measures. It also supports converting PDF and HTML documents to Markdown for easier processing by LLMs.
mcp-gemini
This project provides a dedicated MCP (Model Context Protocol) server that wraps the @google/genai SDK. It exposes Google's Gemini model capabilities as standard MCP tools, allowing other LLMs (like Cline) or MCP-compatible systems to leverage Gemini's features as a backend workhorse.
aica
aica(AI Code Analyzer) reviews your code using AI. Supports CLI and GitHub Actions.
alris
Alris is an AI automation tool that transforms natural language commands into task execution.
A Unofficial Twitter MCP Server with cookie auth.