twikit-mcp¶
Twitter/X MCP server + CLI — no API key needed.
An MCP server that lets Claude (or any MCP-compatible AI agent) interact with Twitter/X using browser cookies. The same twikit-mcp binary doubles as a CLI for shell scripts and debugging.
What's new in 0.1.33¶
- Drop the 200-char text truncation —
get_timeline/search_tweets/get_user_tweets/get_bookmarks/get_list_tweets/get_scheduled_tweets/get_community_tweets/get_communities_timeline/search_community_tweetno longer cut tweet text at 200 characters.get_tweetandget_tweet_repliesalso switch toTweet.full_text, which returns the long-form text (up to 4000 chars) for X note tweets. Compact responses are user-controlled viacount. (closes #97) get_article_previewdistinguishes quote tweets — when the input is a quote tweet, the error now says "this is a quote tweet, not an article. Use get_tweet to read the quoted tweet content" instead of the generic "does not embed an article".
Upgrade with uv tool upgrade twikit-mcp (or pip install --upgrade twikit-mcp).
What's new in 0.1.32¶
- Read tweet replies — new
get_tweet_replies(tweet_id, cursor=None)tool fetches the comments / discussion under a tweet. Uses X's TweetDetail GraphQL via vendored twikit; one page per call withnext_cursorfor more. Returns the same compact reply shape asget_user_tweets/get_timeline. (closes #94)
What's new in 0.1.31¶
- Per-client install matrix in docs — new Install page walks through registering
twikit-mcpwith Claude Code / Claude Desktop / Cursor / Windsurf / Cline / opencode (config file path + JSON snippet, ≤ 12 lines per client). Single canonical install command (uv tool install twikit-mcp); JSON shape is universal across clients. (closes #92)
What's new in 0.1.30¶
- Localized API docs page —
/zh/api/and/ja/api/now show Chinese / Japanese chrome (title, intro, table headers, section labels) instead of falling back to English. Tool docstrings stay native (Python source) — same trade-offmkdocstringsmakes. (closes #90)
What's new in 0.1.29¶
- Community + article-preview reliability —
get_community/get_community_tweets/get_community_members/get_community_moderators/search_community_tweetno longer crash withKeyError: 'rest_id'/IndexError.get_article_previewnow surfaces a cleanToolErrorinstead of leakingHTTPStatusErrorwhen the syndication endpoint returns 404 for a stale article. Defensive.get()parsing in_vendor/twikit/community.py+client.py. Closes issue #76 —T_DRIFTis now empty inlive-smoke.yml. (issue #76 parts 2 + 3)
What's new in 0.1.28¶
- List-tool reliability —
get_list/get_list_tweets/get_list_members/get_list_subscribersno longer crash withKeyError: 'created_at'/IndexError/Invalid list idon burner-gated responses. Defensive parsing in_vendor/twikit/list.py+client.py: missing fields returnNone/""/0, empty entries return emptyResult. Live-smoke now catches future regressions of these classes (no moreT_DRIFTtolerance for the list path). (issue #76 part 1)
What's new in 0.1.27¶
- Download tweet videos via yt-dlp — new
download_tweet_videoMCP tool +twikit-mcp video <id>CLI subcommand. Saves to~/Downloads/twikit-mcp/by default. Authenticated via your existingcookies.json. Requiresyt-dlpon PATH (uv tool install yt-dlp);ffmpegonly needed if you pass a separate-stream format likebestvideo+bestaudio. (closes #84)
What's new in 0.1.26¶
- Quote tweet visibility on
get_tweet— the response now includesis_quote_status,quoted_id,quoted_author, andquoted_textwhen the tweet quote-retweets another. Agents can now show the quoted text inline without an extraget_tweetround-trip — the data is already in the same GraphQL response, we just expose it. (closes #82)
What's new in 0.1.25¶
- Conversation context on
get_tweet— the response now includesin_reply_to(parent tweet ID when the tweet is a reply) andconversation_id(root tweet ID of the thread). Agents can now reconstruct thread context from a single tweet without needing the user to paste the parent link. (closes #77)
What's new in 0.1.24¶
- Rich-rendered cards — the terminal cards from 0.1.23 are now produced by Rich, giving correct cell-width math for emoji + CJK (no more right-border drift on
❤ 🔁lines), and OSC 8 clickable hyperlinks for tweet / profile / bio URLs in iTerm2, kitty, WezTerm, Windows Terminal, gnome-terminal ≥ 3.36, etc. The trends list is now a proper table. - Plain (non-TTY) output unchanged:
| jq/> file/NO_COLOR=1consumers stay byte-stable.
What's new in 0.1.23¶
- ASCII Twitter-card UI —
twikit-mcp tweet,user,tl,search,trendsnow render box-drawing cards in your terminal (bold author, dim timestamps, separators between body / counts / URL). Piping to a file or another command, or settingNO_COLOR=1, auto-falls-back to the previous byte-stable plain text. See CLI mode for samples.
What's new in 0.1.22¶
- Human-friendly CLI subcommands — read tweets / profiles / timeline / search / trends straight from your terminal:
Plain text output, native unicode, sensible defaults. See the CLI mode page.
- UTF-8 outputs end-to-end — no more \uXXXX escapes. Greek / 中文 / 日本語 / emoji all flow through tools as readable text.
- Tri-lingual docs site — this very page; switch language in the top bar.
What you get¶
- 57 tools covering tweets, users, lists, communities, scheduled tweets + polls, DMs, articles, search, trends, notifications.
- Browser-cookie auth — copy
ct0+auth_tokenfrom your X session, you're authenticated. - Two transports, one binary — MCP server (default) for AI agents;
twikit-mcp call <tool>CLI for shells. - Vendored twikit with project-specific defensive patches.
Where to go¶
- CLI mode — subcommands, type coercion, exit codes, examples.
- MCP Tools API — auto-generated reference: every tool's signature + docstring + CLI example, kept in sync with code.
- Technical design — internals (currently 中文 only — translation welcome).
- Vendoring twikit — every patch and the issue that motivated it (currently 中文 only).
- GitHub repo — README has full install / quickstart in three languages.
Quick install¶
# 1. Drop your X cookies into ~/.config/twitter-mcp/cookies.json
mkdir -p ~/.config/twitter-mcp
cat > ~/.config/twitter-mcp/cookies.json <<'EOF'
{"ct0": "...", "auth_token": "..."}
EOF
chmod 600 ~/.config/twitter-mcp/cookies.json
# 2. Install (recommended for daily use)
uv tool install twikit-mcp
# 3. Register with Claude Code
claude mcp add twitter -s user \
-e "TWITTER_COOKIES=$HOME/.config/twitter-mcp/cookies.json" \
-- twikit-mcp
Use uv tool upgrade twikit-mcp to update; full alternatives (uvx / pip / pipx) on the GitHub README.