Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp_twitter

MCP.Pizza Chef: 0xhijo

MCP Twitter is a TypeScript-based MCP server that integrates with the Twitter/X platform, exposing Twitter API functionalities as standardized tools. It enables AI models and applications to create posts, reply to tweets, fetch user profiles, follow users, and manage Twitter threads programmatically, facilitating seamless AI-driven social media workflows and automation.

Use This MCP server To

Create and publish new Twitter/X posts via AI commands Reply to specific tweets using tweet IDs Fetch the most recent tweet from any Twitter/X account Search and retrieve multiple tweets matching queries Create and post threaded tweets automatically Follow Twitter/X users by their usernames Retrieve detailed Twitter/X profile information by username Convert Twitter usernames to user IDs for API operations Aggregate recent tweets for sentiment or trend analysis

README

MCP Twitter

Description

MCP Twitter is a server based on the Model Context Protocol that allows direct interaction with Twitter/X. It exposes various Twitter API functionalities through a standardized set of tools, enabling AI models and applications to perform actions on Twitter.

Features

This MCP server provides the following actions:

  • create_twitter_post: Create a new X/Twitter post
  • reply_twitter_tweet: Reply to a specific X/Twitter post by ID
  • get_last_tweet: Get the most recent post from a specified X/Twitter account
  • get_last_tweets_options: Get a specified number of posts matching a search query
  • create_and_post_twitter_thread: Create and publish an X/Twitter thread
  • follow_twitter_from_username: Follow an X/Twitter user by username
  • get_twitter_profile_from_username: Get complete X/Twitter profile data by username
  • get_twitter_user_id_from_username: Get X/Twitter user ID from username
  • get_last_tweet_and_replies_from_user: Get recent X/Twitter posts and replies from a user
  • get_last_tweet_from_user: Get recent X/Twitter posts from a user
  • get_own_twitter_account_info: Get current account profile data

Installation and Usage

Local Installation

# Clone the repository
git clone https://github.com/0xhijo/mcp_twitter.git

# Install dependencies and build the project
pnpm build

# Launch the server
node ./build/index.js

Installation via NPX

npx mcp_twitter

Configuration

Configuration via Twitter Scraper

  1. Configure the .env file:
TWITTER_AUTH_MODE = "CREDENTIALS" # Credentials mode

# Your Twitter credentials

TWITTER_USERNAME="YOUR_TWITTER_USERNAME"
TWITTER_PASSWORD="YOUR_TWITTER_PASSWORD"
TWITTER_EMAIL="YOUR_TWITTER_EMAIL"

You need to configure Twitter authentication by creating a .env file or directly adding the variables to your environment.

Configuration via Twitter API

  1. Create a Developer Account:

Make sure you have a Twitter account Visit the Developer Platform Get your API credentials Follow this guide if you need help creating your developer account

  1. Configure the .env file
TWITTER_AUTH_MODE = "API" # API mode

# Your CREDENTIALS obtained from the Developer Platform

TWITTER_API="YOUR_TWITTER_API"
TWITTER_API_SECRET="YOUR_TWITTER_API_SECRET"
TWITTER_ACCESS_TOKEN="YOUR_TWITTER_ACCESS_TOKEN"
TWITTER_ACCESS_TOKEN_SECRET="YOUR_TWITTER_ACCESS_TOKEN_SECRET"

Integrating with Claude

To use MCP Twitter with Claude, you need to add it to your claude_mcp_config.json file. This will allow Claude to interact with Twitter through the MCP server.

Adding to Claude's MCP Configuration

Add the following entry to your claude_mcp_config.json file:

"mcp_twitter": {
  "command": "npx",
  "args": ["mcp_twitter"],
  "env": {
    "TWITTER_AUTH_MODE": "CREDENTIALS",
    "TWITTER_USERNAME": "YOUR_TWITTER_USERNAME",
    "TWITTER_PASSWORD": "YOUR_TWITTER_PASSWORD",
    "TWITTER_EMAIL": "YOUR_TWITTER_EMAIL"
  }
}

Replace the placeholder credentials with your actual Twitter account information. This configuration will launch the MCP Twitter server using npx when Claude needs to interact with Twitter.

Usage with Claude

Once configured, Claude will be able to use all the Twitter functionalities provided by the MCP server, such as creating posts, retrieving tweets, and more. You can simply ask Claude to perform Twitter actions, and it will utilize the MCP server to execute them.

Important Notes

  • Choose the authentication mode (API or CREDENTIALS) based on your needs
  • Verify that your credentials are properly configured in the .env file
  • Check the official documentation for more details about API limitations

mcp_twitter FAQ

How do I authenticate MCP Twitter to access Twitter/X APIs?
MCP Twitter requires Twitter API credentials (API key, secret, and tokens) configured in its environment to authenticate requests securely.
Can MCP Twitter create multi-tweet threads automatically?
Yes, it supports creating and posting Twitter threads programmatically through its create_and_post_twitter_thread action.
Is MCP Twitter limited to posting tweets or can it also read data?
MCP Twitter supports both reading data (fetching tweets, profiles) and writing data (posting tweets, replies, following users).
How does MCP Twitter handle rate limits imposed by Twitter?
MCP Twitter relies on Twitter API rate limits; it is recommended to implement client-side rate limiting and error handling to manage API quotas.
Can MCP Twitter follow users by username without manual intervention?
Yes, it provides an action to follow Twitter users by their username programmatically.
Does MCP Twitter support searching tweets by keywords or hashtags?
Yes, it can retrieve tweets matching search queries using the get_last_tweets_options action.
What programming languages can interact with MCP Twitter?
Any language that can communicate over MCP protocol can interact, but the server itself is implemented in TypeScript.
Can MCP Twitter be used with multiple LLM providers?
Yes, it is provider-agnostic and works with OpenAI, Anthropic Claude, Google Gemini, and others supporting MCP.