- Home
- MCP servers
- X Twitter
X Twitter
- python
28
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can interact with Twitter (X) through an MCP server that translates natural language commands into Twitter API v2 actions. It lets you fetch profiles, post tweets, search tweets, manage timelines and bookmarks, and handle rate limits, all from AI tools or client apps that support MCP.
How to use
Connect your MCP client to the server using either an HTTP endpoint or a local STDIO server, then issue natural language prompts. You can ask the tools to fetch user data, post tweets, search Twitter, manage followers, and work with timelines and trends. Use the HTTP option when you have a remote or dockerized deployment, and the STDIO option when you run the server locally and want direct process I/O.
How to install
Prerequisites include Python 3.10 or higher and a Twitter Developer account with API credentials (API Key, API Secret, Access Token, Access Token Secret, and Bearer Token). You may also install Claude Desktop if you want to integrate with that client, and you will need a Python package manager (pip) or a universal tool like uv to run dependencies.
Option 1 — Install via Smithery (recommended): Install the MCP server for Claude Desktop automatically.
npx -y @smithery/cli install @rafaljanicki/x-twitter-mcp-server --client claude
Option 2 — Install from PyPI
The easiest way is to install the Python package from PyPI.
pip install x-twitter-mcp
Option 3 — Install from Source
If you prefer installing from source, clone the repository, set up a virtual environment, and install dependencies.
git clone https://github.com/rafaljanicki/x-twitter-mcp-server.git
cd x-twitter-mcp-server
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv sync
pip install .
Configure environment variables
Create a .env file in the project root and add your Twitter API 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
TWITTER_BEARER_TOKEN=your_bearer_token
Available tools
get_user_profile
Fetch detailed profile information for a user, including ID, name, username, avatar, and bio.
get_user_by_screen_name
Fetch a user by their screen name and return profile details.
get_user_by_id
Fetch a user by their numerical ID and return profile details.
get_user_followers
Retrieve a list of followers for a given user, with an optional limit.
get_user_following
Retrieve the list of users that a given user is following, with an optional limit.
get_user_followers_you_know
Retrieve common followers between you and another user (simulated).
get_user_subscriptions
Retrieve the list of users to which the specified user is subscribed.
post_tweet
Post a tweet with optional media, reply, and tags.
delete_tweet
Delete a tweet by its ID.
get_tweet_details
Get detailed information about a specific tweet.
create_poll_tweet
Create a tweet that includes a poll with options and duration.
vote_on_poll
Vote on a poll within a tweet.
favorite_tweet
Mark a tweet as favorite.
unfavorite_tweet
Remove a tweet from favorites.
bookmark_tweet
Add a tweet to bookmarks.
delete_bookmark
Remove a tweet from bookmarks.
delete_all_bookmarks
Delete all bookmarks for the current user.
get_timeline
Fetch tweets from the home timeline (For You).
get_latest_timeline
Fetch tweets from the Following timeline.
search_twitter
Search Twitter for tweets matching a query.
get_trends
Retrieve current trending topics on Twitter.
get_highlights_tweets
Retrieve highlighted tweets from a user timeline (simulated).
get_user_mentions
Fetch tweets that mention a specific user.