x-mcp-lite
Read-only Twitter API server with bookmark and like management, plus anti-rate-limit protection.
README
x-mcp-lite
Safety-focused lite fork of lord-dubious/x-mcp.
Note on AI involvement: This fork was authored by Claude Code (Anthropic) under human direction. The human collaborator (
huakexie) made all product decisions — scope of cuts, naming, design tradeoffs (in-memory vs SQLite, active cooldown vs passive sleep, retry vs no-retry on 429, etc.) — and reviewed/verified the code at each step. Claude Code did the source reading, pattern analysis, and mechanical refactoring (commenting decorators, wrapping calls withwith_rate_limit, writing thethrottle.pymodule). The anti-rate-limit design is informed by readingDataWhisker/x-mcp-server's official-API rate-limit module and adapting its "learn from real 429 + active intercept" pattern to twikit's reverse-engineered endpoints.
Keeps the read-only tools + bookmark/like management, cuts the high-risk write tools (post/delete tweets, DM, follow/block/mute, groups, cookie ops), and adds an anti-rate-limit layer the original project lacks entirely.
⚠️ Risk warning
This is an unofficial reverse-engineering library (via twikit) that talks to Twitter's internal endpoints. It is not affiliated with Twitter/X. Use of such libraries may violate Twitter's Terms of Service and can lead to:
- Account being rate-limited (transient, recovers in ~15 min)
- Account being locked (requires Arkose challenge / phone verification)
- Account being suspended (permanent)
Use at your own risk. Recommendations:
- Use a secondary account, not your main one
- Keep call frequency low (the built-in throttler defaults to 2–5s random intervals)
- Do not run unattended long-running jobs
- If the account gets locked, stop and verify manually before resuming
What's kept vs cut
Kept (37 tools)
| Category | Tools |
|---|---|
| Bookmarks | get_bookmarks / get_all_bookmarks / get_bookmark_folders / bookmark_tweet / delete_bookmark |
| Tweet search/detail | get_tweet_by_id / search_twitter / get_tweet_details / get_conversation_thread / get_similar_tweets |
| User info | get_user_id / get_user / get_user_by_screen_name / get_user_by_id / get_user_profile / get_user_mentions / get_user_followers_you_know |
| Follower/following lists | get_user_followers / get_latest_followers / get_user_following / get_latest_friends / get_user_verified_followers / get_user_subscriptions / get_followers_ids / get_friends_ids |
| Timeline/search | get_timeline / get_latest_timeline / get_trends / get_highlights_tweets / search_user / get_user_tweets |
| DM read-only | get_dm_history |
| Retweeters/favoriters | get_retweeters / get_favoriters |
| Community note | get_community_note |
| Scheduled (read) | get_scheduled_tweets |
| Likes (low-risk write) | favorite_tweet / unfavorite_tweet |
Cut (39 tools, decorators commented — function bodies retained for diff clarity)
Post/delete tweets, polls, scheduled tweets, retweets, all DM write operations, all group operations, follow/unfollow/block/unblock/mute/unmute, set_delegate_account, update_user, all cookie management, delete_all_bookmarks, geo (reverse_geocode/search_geo/get_place), media metadata, bookmark folder create/edit, vote/vote_on_poll.
Anti-rate-limit layer
Three pieces, all in src/x_mcp/throttle.py:
-
Throttler— random-pacing throttler (memory). Every tool call awaitsthrottler.wait()first, which sleeps to enforce a 2–5s random interval since the last call. Randomization avoids fixed-pattern detection. -
with_rate_limit(endpoint, fn)— DataWhisker-style active cooldown tracking (in-memory dict).- Before calling: if a previous 429 recorded a reset time for this endpoint, sleep until that time (active intercept — no wasted request).
- On
TooManyRequests: reade.rate_limit_reset(from thex-rate-limit-resetresponse header, confirmed in twikit 2.3.3errors.py), record it, sleep, retry once. - On
AccountLocked/AccountSuspended: convert toRuntimeError, do not retry — these need human intervention.
-
paginate_all— forget_all_bookmarks. IteratesResult.next()with 3–8s random delay between pages, auto-backoff on 429.
No persistence: in-memory dicts only. Twitter's rate-limit window is 15 min; for low-frequency usage, restart intervals exceed the window anyway. Memory is also faster (no disk I/O).
Setup
-
Clone:
git clone https://github.com/huake/x-mcp-lite cd x-mcp-lite -
Configure in your MCP host (e.g., Claude):
{ "x-mcp-lite": { "command": "uvx", "args": ["--from", "git+https://github.com/huake/x-mcp-lite", "x-mcp-lite"], "env": { "TWITTER_USERNAME": "@your_username", "TWITTER_EMAIL": "your_email@example.com", "TWITTER_PASSWORD": "your_password" } } }Optional env vars:
USER_AGENT— custom user agentCAPSOLVER_API_KEY— for CAPTCHA solving (only needed if you hit Arkose challenges)
-
The MCP server starts automatically when your MCP host launches.
Cookie handling
On first run, the server logs in with username/email/password and saves cookies to ~/.x-mcp/cookies.json. Subsequent runs load cookies directly. If cookies expire (e.g., Twitter requires re-verification), the login will fail with an error — delete the cookie file and re-run to re-login. Do not retry login automatically; repeated login attempts raise account-lock risk.
License
MIT, inherited from the upstream project.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。