6551Team/opentwitter-mcp

Twitter/X Data · User Profiles · Tweet Search · Follower Events · KOL Tracking

opentwitter‑mcp – Twitter data server for AI assistants

What it is – A small FastMCP‑based HTTP/WebSocket server that wraps Twitter/X data (profiles, tweets, search, follower events, KOL tracking, etc.) behind a simple API. It is meant to be run locally and then added as an MCP (Model‑Context‑Protocol) server to AI‑powered coding assistants such as Claude, OpenClaw, Cursor, Zed, etc., so the assistant can ask natural‑language questions about Twitter and get structured results.

Key capabilities

Capability How it’s exposed
User profile lookup get_twitter_user / get_twitter_user_by_id
Recent tweets of a user get_twitter_user_tweets
Keyword / hashtag search search_twitter, search_twitter_advanced
Real‑time follower / unfollower events get_twitter_follower_events (WebSocket push)
Deleted‑tweet detection get_twitter_deleted_tweets
KOL‑follower discovery get_twitter_kol_followers
Watch‑list management (add / delete / list) add_twitter_watch, delete_twitter_watch, get_twitter_watch
Full tweet fetch (including replies, quotes, media) get_twitter_tweet_by_id, get_twitter_quote_tweets_by_id, get_twitter_retweet_users_by_id

Installation & start‑up

  1. Obtain a token – Register at http://app.newsliquid.com/mcp and copy the OPENNEWS_TOKEN.
  2. Set the token – either as an environment variable or in a config.json placed in the project root:
    export OPENNEWS_TOKEN="<your-token>"   # macOS / Linux
    # Windows PowerShell
    $env:OPENNEWS_TOKEN = "<your-token>"
    
  3. Run the server – the README recommends the uv build tool (a modern Python‑only alternative to Poetry/venv):
    uv --directory /path/to/twitter-mcp run twitter-mcp
    
    The same command can be embedded in the MCP configuration of any supported AI client (Claude Code, OpenClaw, Cursor, etc.).

How an AI assistant talks to it

  • The assistant registers the server as an MCP named twitter.
  • When you type a natural‑language request (e.g., “Show @elonmusk’s Twitter profile”), the assistant calls the appropriate tool (e.g., get_twitter_user).
  • Results are returned as JSON structures defined in the README (user object, tweet object, event arrays, etc.).
  • For real‑time monitoring, the assistant can open the WebSocket wss://ai.6551.io/open/twitter_wss?token=YOUR_TOKEN and receive JSON‑RPC push events such as NEW_TWEET, NEW_FOLLOWER, DELETE, etc.

Configuration options

Variable Purpose
OPENNEWS_TOKEN (required) Bearer token for the 6551 backend API
TWITTER_API_BASE Override the default REST endpoint (defaults to https://ai.6551.io)
TWITTER_MAX_ROWS Maximum number of items returned per request (default 100)

Both env vars and a config.json file are supported; env vars win if both are present.

Supported clients – The README lists ready‑made one‑liners for Claude Code (claude mcp add twitter …) and OpenClaw (copy the skill directory). It also provides JSON/YAML snippets for many editors (Cursor, Zed, Continue.dev, etc.) so the server can be launched automatically from the editor’s MCP integration.

Development

  • Code lives under src/twitter_mcp/ with a clear layout: server.py (entry point), app.py (FastMCP app), config.py, api_client.py, and tools.py (the eight public tools).
  • Dependencies are minimal: the mcp framework, httpx for HTTP calls, and uv for environment management.
  • To work on the project: uv sync to install, then uv run twitter-mcp.

License – MIT, so you can freely modify or embed it in your own AI‑assistant setups.


Bottom lineopentwitter‑mcp is a lightweight, purpose‑built bridge that lets AI coding assistants query live Twitter data and receive event streams without the assistant having to implement Twitter’s API itself. It’s a genuine software project aimed at AI‑augmented workflows rather than a mere tutorial or link list.

Related

  • Project
  • Project
  • Project
  • Project
  • Project