X Twitter MCP Server

A Model Context Protocol (MCP) server for interacting with Twitter (X) via AI tools. This server allows you to fetch tweets, post tweets, search

Local serverstdioPython

What is the X Twitter MCP server?

A Model Context Protocol (MCP) server for interacting with Twitter (X) via AI tools. This server allows you to fetch tweets, post tweets, search Twitter, manage followers, and more, all through natural language commands in AI Tools. That is what the x twitter mcp server brings to an AI assistant: the same capability, reachable through the Model Context Protocol rather than a separate app or dashboard.

The short version

  • Fetch user profiles, followers, and following lists
  • Post, delete, and favorite tweets
  • Search Twitter for tweets and trends
  • Manage bookmarks and timelines
  • Built-in rate limit handling for the Twitter API
  • Uses Twitter API v2 with proper authentication (API keys and tokens), avoiding the username/password hack to minimize the risk of account suspensions

The tools it exposes

The server publishes 14 tools. What each one is for:

  • Steps — 1. In the Twitter Developer Portal, open your app → SettingsUser authentication settings and enable
  • get_user_profile — The get_user_profile tool exposed by this server
  • get_user_by_screen_name — The get_user_by_screen_name tool exposed by this server
  • get_user_by_id — The get_user_by_id tool exposed by this server
  • get_user_followers — The get_user_followers tool exposed by this server
  • get_user_following — The get_user_following tool exposed by this server
  • get_user_followers_you_know — The get_user_followers_you_know tool exposed by this server
  • get_user_subscriptions — The get_user_subscriptions tool exposed by this server
  • post_tweet — The post_tweet tool exposed by this server
  • delete_tweet — The delete_tweet tool exposed by this server
  • get_tweet_details — The get_tweet_details tool exposed by this server
  • create_poll_tweet — The create_poll_tweet tool exposed by this server

Getting it running

Installation goes through your MCP client rather than a global install: point it at @smithery/cli on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

What it needs from you

Configuration is passed through the environment: PYTHONUNBUFFERED, TWITTER_API_KEY, TWITTER_API_SECRET, TWITTER_ACCESS_TOKEN, TWITTER_ACCESS_TOKEN_SECRET, TWITTER_BEARER_TOKEN, TWITTER_OAUTH2_USER_ACCESS_TOKEN, YOUR_CLIENT_ID. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

  • Python 3.10 or higher: Ensure Python is installed on your system. - Twitter Developer Account: You need API credentials (API Key, API Secret, Access Token, Access Token Secret, and Bearer Token) from the Twitter Developer Portal. - Optional: Claude Desktop: Download and install the Claude Desktop app from the [Anthropic

How it compares

Plenty of developer tooling servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. X Twitter's toolset — Steps, get_user_profile, get_user_by_screen_name and 11 more — is a fair guide to whether it matches your workflow. It is maintained by rafaljanicki; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Things to watch

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch X Twitter.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
Steps1. In the [Twitter Developer Portal](https://developer.twitter.com/), open your app → **Settings** → **User authentication settings** and enable OAuth 2.0. Set a callback URL (e.g. https://localhost/).
get_user_profileThe get_user_profile tool exposed by this server.
get_user_by_screen_nameThe get_user_by_screen_name tool exposed by this server.
get_user_by_idThe get_user_by_id tool exposed by this server.
get_user_followersThe get_user_followers tool exposed by this server.
get_user_followingThe get_user_following tool exposed by this server.
get_user_followers_you_knowThe get_user_followers_you_know tool exposed by this server.
get_user_subscriptionsThe get_user_subscriptions tool exposed by this server.
post_tweetThe post_tweet tool exposed by this server.
delete_tweetThe delete_tweet tool exposed by this server.
get_tweet_detailsThe get_tweet_details tool exposed by this server.
create_poll_tweetThe create_poll_tweet tool exposed by this server.
vote_on_pollThe vote_on_poll tool exposed by this server.
favorite_tweetThe favorite_tweet tool exposed by this server.

How to install the X Twitter MCP server

If installed from source with `uv`:
```json
{
  "mcpServers": {
    "x-twitter-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/x-twitter-mcp-server",
        "run",
        "x-twitter-mcp-server"
      ],
      "env": {
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Python 3.10 or higher: Ensure Python is installed on your system. - Twitter Developer Account: You need API credentials (API Key, API Secret, Access Token, Access Token Secret, and Bearer Token) from the Twitter Developer Portal. - Optional: Claude Desktop: Download and install the Claude Desktop app from the [Anthropic
VariableDescriptionRequired
PYTHONUNBUFFEREDConfiguration value read at startup.Optional
TWITTER_API_KEYCredential the server authenticates with.Yes
TWITTER_API_SECRETCredential the server authenticates with.Yes
TWITTER_ACCESS_TOKENCredential the server authenticates with.Yes
TWITTER_ACCESS_TOKEN_SECRETCredential the server authenticates with.Yes
TWITTER_BEARER_TOKENCredential the server authenticates with.Yes
TWITTER_OAUTH2_USER_ACCESS_TOKENCredential the server authenticates with.Yes
YOUR_CLIENT_IDConfiguration value read at startup.Optional

Example prompts to try

  • Use X Twitter to Steps.
  • Use X Twitter to get user profile.
  • Use X Twitter to get user by screen name.

Frequently asked questions

It connects X Twitter to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (Steps, get_user_profile, get_user_by_screen_name, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with X Twitter directly.