Get the FREE Ultimate OpenClaw Setup Guide →

twitter

Model Context Protocol server for Twitter integration. can be used to perform CRUD like operations using the twitter API in the background

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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)
  1. Clone the repository
git clone https://github.com/Dishant27/twitter-mcp.git
cd twitter-mcp
  1. Install dependencies
npm install
  1. 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
  1. Start the server
npm start
  1. 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

Sponsor this space

Reach thousands of developers