Skip to main content

MCP server for the apitwitter.com Twitter/X API — use X/Twitter from Claude, Cursor and any MCP client.

Project description

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.

Tweetspost_tweet, lookup_tweet, get_user_tweets, get_for_you_timeline, get_latest_timeline, search_tweets, delete_tweet, retweet, unretweet, pin_tweet, unpin_tweet

Usersverify_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

Engagementlike_tweet, unlike_tweet, follow_user, unfollow_user

DMsget_dm_inbox, get_xchat_token, get_dm_permissions, block_dm, unblock_dm, send_dm

Bookmarksbookmark_tweet, unbookmark_tweet, get_bookmarks

Listscreate_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

Communitiesexplore_communities, get_community, join_community, leave_community, get_community_tweets, get_community_media

Topicsget_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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apitwitter_mcp-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apitwitter_mcp-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file apitwitter_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: apitwitter_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for apitwitter_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 359744b38c75ccd0177303fe79cef31c7c72159d8063ccad684ff04314d5cf28
MD5 376e97058e2e910101ac7c329b65434e
BLAKE2b-256 1bddfce9f68f9acca07aa1f35cc6cce7896f823c7458e8d413b91fb82c34d9f2

See more details on using hashes here.

File details

Details for the file apitwitter_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: apitwitter_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for apitwitter_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e312d7502d8a6f1bab70a92870cdca608f10c84a6e0ab0b9e2c58a7acb538ee7
MD5 9d758ea563be2cc3b5da1add8efc2672
BLAKE2b-256 c9e07c373733432f79aed90af0ad7bdafc608f025fc525d911691953e6d1f7fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page