Skip to main content

apitwitter-mcp

MCP server for the apitwitter.com Twitter/X API. Lets Claude Desktop, Cursor, and any other MCP client use X/Twitter as first-class tools: read timelines, search, post tweets, DMs, lists, communities, topics, bookmarks, follows, likes — the full surface.

What you need

  1. An apitwitter.com API key — sign up at https://apitwitter.com.
  2. An x.com session cookie (your logged-in X session) — this is what actions are performed as. You can pass it per tool call, or set a default via APITWITTER_COOKIE.

Install

Option A — uvx (zero-install, recommended)

{
  "mcpServers": {
    "apitwitter": {
      "command": "uvx",
      "args": ["apitwitter-mcp"],
      "env": {
        "APITWITTER_KEY": "sk_live_...",
        "APITWITTER_COOKIE": "auth_token=...; ct0=..."
      }
    }
  }
}

Option B — pip

pip install apitwitter-mcp
{
  "mcpServers": {
    "apitwitter": {
      "command": "apitwitter-mcp",
      "env": {
        "APITWITTER_KEY": "sk_live_...",
        "APITWITTER_COOKIE": "auth_token=...; ct0=..."
      }
    }
  }
}

Place the snippet in:

  • Claude Desktop — %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
  • Cursor — Settings → MCP → Add server
  • Any other MCP-compatible client

Restart the client; the tools appear under the hammer icon.

Environment variables

Var Required Default Purpose
APITWITTER_KEY yes — Your apitwitter.com API key (sent as X-API-Key).
APITWITTER_COOKIE no — Default x.com session cookie. Without it, every tool call must pass cookie=.
APITWITTER_BASE no https://api.apitwitter.com Override for self-hosting / staging.
APITWITTER_PROXY no — Default proxy URL for Twitter requests.
APITWITTER_TIMEOUT no 60 HTTP timeout (seconds).

Tools

All endpoints of /twitter/* are exposed. Every tool accepts optional cookie and proxy arguments that override the env defaults.

Tweets — post_tweet, lookup_tweet, get_user_tweets, get_for_you_timeline, get_latest_timeline, search_tweets, delete_tweet, retweet, unretweet, pin_tweet, unpin_tweet

Users — verify_session, get_user, get_users_batch, get_user_by_id, get_user_followers, get_user_following, get_user_likes, get_user_media, get_user_replies, get_followers_you_know, remove_follower, get_blocked_accounts, get_muted_accounts

Engagement — like_tweet, unlike_tweet, follow_user, unfollow_user

DMs — get_dm_inbox, get_xchat_token, get_dm_permissions, block_dm, unblock_dm, send_dm

Bookmarks — bookmark_tweet, unbookmark_tweet, get_bookmarks

Lists — create_list, delete_list, get_owned_lists, get_list_memberships, get_list_info, get_list_tweets, get_list_members, add_list_member, remove_list_member, get_list_subscribers, subscribe_list, unsubscribe_list

Communities — explore_communities, get_community, join_community, leave_community, get_community_tweets, get_community_media

Topics — get_topic, follow_topic, unfollow_topic

Local development

git clone https://github.com/YOUR_ORG/apitwitter-mcp
cd apitwitter-mcp
python -m venv .venv && .venv\Scripts\activate   # Windows
pip install -e .

set APITWITTER_KEY=sk_live_...
set APITWITTER_COOKIE=auth_token=...; ct0=...
apitwitter-mcp                                   # stdio server

To point at a staging backend:

set APITWITTER_BASE=http://localhost:8000

Publishing to PyPI (maintainers)

pip install build twine
python -m build
twine upload dist/*

After the first release, users can install via pip install apitwitter-mcp or run with no install via uvx apitwitter-mcp.

License

MIT

Metadata

Release files for apitwitter-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apitwitter-mcp 0.1.0
File Size Uploaded
apitwitter_mcp-0.1.0.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for apitwitter-mcp 0.1.0
File Interpreter ABI Platform
apitwitter_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / apitwitter_mcp-0.1.0.tar.gz

Download URL apitwitter_mcp-0.1.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
359744b38c75ccd0177303fe79cef31c7c72159d8063ccad684ff04314d5cf28
BLAKE2b-256 checksum
How to use checksums
1bddfce9f68f9acca07aa1f35cc6cce7896f823c7458e8d413b91fb82c34d9f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / apitwitter_mcp-0.1.0-py3-none-any.whl

Download URL apitwitter_mcp-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e312d7502d8a6f1bab70a92870cdca608f10c84a6e0ab0b9e2c58a7acb538ee7
BLAKE2b-256 checksum
How to use checksums
c9e07c373733432f79aed90af0ad7bdafc608f025fc525d911691953e6d1f7fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page