twikit-mcp

twikit-mcp

An MCP server that enables AI assistants to interact with Twitter/X through a single authenticated session without an official API key, providing 27 tools for reading and writing tweets, user management, timeline access, trends, and direct messages.

Category
访问服务器

README

twikit-mcp

An MCP (Model Context Protocol) server that lets an AI assistant — Claude Desktop, Claude Code, Cursor, or any MCP client — read and act on Twitter / X through a single authenticated session. No official X API key required.

Built on twikit

All the real work — the actual Twitter/X client — is twikit by d60. Full credit and rights to the original library belong to its author. This project is only a thin MCP wrapper around it. ⭐ Please star the original repo.

It exposes twikit's capabilities as clean, model-friendly MCP tools.

⚠️ This repo bundles a lightly patched copy of twikit (under twikit/, MIT — see licenses/twikit-LICENSE.txt), because the published twikit is currently broken on X (the Couldn't get KEY_BYTE indices login bug). The patch only fixes login. When upstream ships a fix, the bundled copy can be dropped in favour of the PyPI twikit package.


Features

  • 27 tools covering users, tweets (read + write), timelines, trends and DMs.
  • No X API key — authenticates as a normal account via cookies or login.
  • Built-in rate limiting, on by default, to help avoid suspension (configurable).
  • One-line run with uvx (no manual install), or pip.
Area Tools
Session whoami, rate_limit_status
Users get_user, get_user_by_id, search_users, get_user_tweets, get_user_followers, get_user_following, follow_user, unfollow_user, block_user, mute_user
Tweets (read) get_tweet, search_tweets, get_home_timeline, get_retweeters, get_favoriters
Tweets (write) post_tweet, delete_tweet, like_tweet, unlike_tweet, retweet, undo_retweet, bookmark_tweet
Trends get_trends
Direct messages send_direct_message, get_dm_history

Paginating tools return { "items": [...], "count": N, "next_cursor": "..." }; pass next_cursor back in to page.


Install

twikit-mcp is a Python package. The easiest way to run it is with uv's uvx (the Python equivalent of npx — downloads and runs in one step, nothing to install first):

uvx --from git+https://github.com/bintangtimurlangit/twikit-mcp twikit-mcp

Alternatives:

# pipx (isolated install)
pipx install git+https://github.com/bintangtimurlangit/twikit-mcp

# plain pip
pip install git+https://github.com/bintangtimurlangit/twikit-mcp

# from a clone (for development)
git clone https://github.com/bintangtimurlangit/twikit-mcp
cd twikit-mcp && pip install -e .

Why git+… and not pip install twikit-mcp? It isn't published to PyPI yet — installing straight from GitHub is the current path. (The package is self-contained: twikit is bundled in, so there are no external Git dependencies to resolve.)


Connect your MCP client

Per-client, copy-paste setup for Claude Code, Claude Desktop, Cursor, Windsurf, VS Code and more is in INSTALL.md.

Using a client that isn't documented there? Point its AI at llms-install.md — a machine-readable install spec an agent can follow to wire this server into any MCP client.


Authenticate

X's automated login regularly trips a Cloudflare / "verify you're human" challenge, so the reliable way to authenticate is to copy two cookies from a browser where you're already logged in to x.com: auth_token and ct0.

1. Grab the cookies

  1. Log in to https://x.com in your browser.
  2. Open DevTools → Application (Chrome/Edge) or Storage (Firefox) → Cookieshttps://x.com.
  3. Copy the Value of auth_token and of ct0.

2. Set them as environment variables

Variable Required Notes
TWIKIT_AUTH_TOKEN the auth_token cookie value
TWIKIT_CT0 the ct0 cookie value
TWIKIT_LANGUAGE default en-US
TWIKIT_PROXY e.g. http://user:pass@host:port

🔐 Treat these like a password — they grant access to your account. Don't commit them anywhere. They rotate when you log out of that browser session, so refresh them if requests start failing.

See INSTALL.md for exactly where these go in each client's config.

Rate limiting

To reduce the risk of rate-limit errors or account suspension, the server throttles tool calls by default (token bucket, 30 calls/minute).

Variable Default Notes
TWIKIT_MCP_RATE_LIMIT on Set to off (or 0/false) to disable throttling entirely
TWIKIT_MCP_RATE_LIMIT_PER_MINUTE 30 Max tool calls per minute

Call the rate_limit_status tool to see the active configuration.


Run manually

python -m twikit_mcp      # or:  twikit-mcp

You normally won't run it by hand — your MCP client launches it. See INSTALL.md for client setup.


Responsible use

Automating X may violate its Terms of Service and can get accounts rate-limited or suspended. Use a purpose-made account, keep volume low, and respect twikit's rate-limit notes. Don't use this for spam, harassment, or mass automation.


Contributing

Contributions welcome! This project uses Conventional Commits for commits, PR titles and issue titles — see CONTRIBUTING.md.


Credits

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选