twikit-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@twikit-mcp search tweets about AI"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
twikit-x-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 — seelicenses/twikit-LICENSE.txt), because the published twikit is currently broken on X (theCouldn't get KEY_BYTE indiceslogin bug). The patch only fixes login. When upstream ships a fix, the bundled copy can be dropped in favour of the PyPItwikitpackage.
Full reference: Documentation · Setup: INSTALL.md · Changelog: CHANGELOG.md · Versioning & releases: docs/RELEASES.md
Related MCP server: X(Twitter) V2 MCP Server
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), orpip.
Area | Tools |
Session |
|
Users |
|
Tweets (read) |
|
Tweets (write) |
|
Trends |
|
Direct messages |
|
Paginating tools return { "items": [...], "count": N, "next_cursor": "..." };
pass next_cursor back in to page.
Tool annotations
Per the MCP annotations spec — side effects at a glance. Write tools act on your real account.
Tools | Read-only | Idempotent | Destructive |
| ✓ | ✓ | – |
| – | ✓ | – |
| – | – | – |
| – | ✓ | ✓ |
Install
Install and run with uvx:
uvx twikit-x-mcpNote: the Python import module is
twikit_x_mcp(underscore), per Python convention. The distribution 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
Log in to https://x.com in your browser.
Open DevTools → Application (Chrome/Edge) or Storage (Firefox) → Cookies →
https://x.com.Copy the Value of
auth_tokenand ofct0.
2. Set them as environment variables
Variable | Required | Notes |
| ✅ | the |
| ✅ | the |
| default | |
| e.g. |
🔐 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 |
|
| Set to |
|
| Max tool calls per minute |
Call the rate_limit_status tool to see the active configuration.
Run manually
python -m twikit_x_mcp # or: twikit-x-mcpYou normally won't run it by hand — your MCP client launches it. See INSTALL.md for client setup.
Troubleshooting
Symptom | Likely cause / fix |
| The published twikit's login bug — this repo bundles a patched copy under |
Auth errors / |
|
Frequent rate-limit errors | Throttling is on by default (30/min). Check |
A "verify you're human" / Cloudflare challenge | Use the cookie method (above) rather than username/password login. |
Server not found by the client | Verify the |
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.
Security & conduct: SECURITY.md · Code of Conduct
Credits
twikit by d60 — the underlying X client that does all the heavy lifting (MIT). A patched copy is bundled here under
twikit/; its license is preserved atlicenses/twikit-LICENSE.txt. ⭐ Please star the original repo.This project (
twikit-x-mcp) is MIT-licensed. SeeLICENSE.
Disclaimer
This is an unofficial project. It is not affiliated with, authorized, maintained, sponsored, or endorsed by X Corp. (Twitter).
It authenticates as your own account using session cookies and drives X through twikit — an unofficial client — so a tool can break when X changes its site. Automating X may violate its Terms of Service and can get accounts rate-limited or suspended.
You are responsible for using this software in compliance with X's Terms of Service and applicable law. Use a purpose-made account, keep volume low, and don't use it for spam, harassment, or mass automation. All product names, logos, and brands are property of their respective owners.
Available Tools
27 toolsblock_userC
Block the account with the given user id.
Inputs: user_id (required).
bookmark_tweetB
Bookmark a tweet by id.
Inputs: tweet_id (required).
delete_tweetA
Delete one of your own tweets by id.
Inputs: tweet_id (required).
follow_userB
Follow the account with the given user id.
Inputs: user_id (required). Returns: result
get_dm_historyA
Get direct-message history with a user id. max_id pages older messages.
Inputs: user_id (required), max_id.
get_favoritersA
List accounts that liked the given tweet. Paginated via cursor.
Inputs: tweet_id (required), count, cursor.
get_home_timelineB
Get the authenticated user's home timeline ('for_you' or 'following').
Inputs: kind, count, cursor.
get_retweetersB
List accounts that retweeted the given tweet. Paginated via cursor.
Inputs: tweet_id (required), count, cursor.
get_trendsC
Get current trends for a category.
Inputs: count, category.
get_tweetA
Fetch a single tweet by its id, including engagement counts and media.
Inputs: tweet_id (required). Returns: result
get_userA
Look up a user profile by @handle (screen name), e.g. "jack".
Inputs: screen_name (required). Returns: result
get_user_by_idB
Look up a user profile by their numeric user id.
Inputs: user_id (required). Returns: result
get_user_followersA
List accounts that follow the given user id. Paginated via cursor.
Inputs: user_id (required), count, cursor.
get_user_followingA
List accounts the given user id follows. Paginated via cursor.
Inputs: user_id (required), count, cursor.
get_user_tweetsB
Get a user's tweets. tweet_type selects the tab. Paginated via cursor.
Inputs: user_id (required), count, cursor, tweet_type.
like_tweetA
Like (favorite) a tweet by id.
Inputs: tweet_id (required).
mute_userC
Mute the account with the given user id.
Inputs: user_id (required).
post_tweetA
Post a tweet. Set reply_to to a tweet id to reply. is_note_tweet
allows long-form (>280 char) posts on eligible accounts.
Inputs: text (required), reply_to, is_note_tweet. Returns: result
rate_limit_statusA
Report the current client-side rate-limit configuration.
Does not require auth and does not consume a rate-limit token. Configure via TWIKIT_MCP_RATE_LIMIT (on/off) and TWIKIT_MCP_RATE_LIMIT_PER_MINUTE.
Inputs: no named parameters.
retweetC
Retweet a tweet by id.
Inputs: tweet_id (required).
search_tweetsA
Search tweets. product = Top | Latest | Media. Paginated via cursor.
Supports X search operators, e.g. 'from:nasa filter:media -is:retweet'.
Inputs: query (required), count, cursor, product.
search_usersA
Search for user accounts matching a query. Paginated via cursor.
Inputs: query (required), count, cursor.
send_direct_messageB
Send a direct message to a user id. reply_to is an optional message id.
Inputs: text (required), user_id (required), reply_to. Returns: result
undo_retweetB
Undo a retweet by tweet id.
Inputs: tweet_id (required).
unfollow_userC
Unfollow the account with the given user id.
Inputs: user_id (required). Returns: result
unlike_tweetB
Remove your like from a tweet by id.
Inputs: tweet_id (required).
whoamiA
Return the authenticated account's own user id (confirms the session works).
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 27 tools
Each tool targets a distinct resource+action combination, such as get_user vs get_user_by_id vs search_users, which are clearly separated by lookup key. Opposite actions like like/unlike and retweet/undo_retweet are unambiguous, leaving no confusion about tool purpose.
The set largely follows a consistent verb_noun pattern, e.g., search_users, get_tweet, post_tweet, like_tweet. Minor deviations like whoami and rate_limit_status, plus inconsistent DM naming (get_dm_history vs send_direct_message), slightly weaken the pattern but it remains readable.
With 27 tools, the set is above the 25-tool threshold, feeling heavy and potentially overwhelming for an agent. While each tool has a purpose, the count is excessive for a focused client, and some operations could be merged or omitted.
The core Twitter workflows are well covered, including tweets, users, follows, likes, retweets, DMs, and trends. However, missing reverse operations like unbookmark_tweet and the lack of a get_user_likes method create minor dead ends for common interaction patterns.
Maintenance
Related MCP Connectors
Hosted MCP server from TwitterAPI.io that gives AI agents read-only access to Twitter/X data. 12 tools: tweet search with X operators, user profiles, a user's latest tweets, followers and followings, replies, quotes, retweeters, mentions and trends. Connect at https://mcp.twitterapi.io/mcp with a TwitterAPI.io API key or account sign-in; usage is paid per result returned.
Hosted X (Twitter) MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Official twitterapi.io hosted MCP: Twitter/X tweets, users, followers, trends. OAuth or API key.
Your agent needs X/Twitter data — who follows a competitor, what a community is posting, who quoted that tweet, what is trending in Japan. Normally that means applying for an X developer account, passing app review, and managing a quota per endpoint. **What you can ask for** • "Who follows @stripe, and which of them are verified?" • "Pull every reply and quote on this tweet and summarise what people object to." • "List this community's moderators and its posts this week." • "What is trending in Japan right now?" • "Give me the full thread context behind this link, including the long-form article." **How to use it** Point any MCP client at https://mcp.aisa.one/twitter-api/mcp and sign in with OAuth — there is no key to create or paste. 29 read tools: users (profile, about, batch lookup by id, search, followers, verified followers, followings, follow check), tweets (timeline, latest, mentions, advanced search, replies, quotes, retweeters, thread context, articles), communities, lists, Spaces and trends. **Why this rather than the source** No developer account to apply for, no app review, no per-endpoint quota to manage. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Ask for a handle's followers here, then ask the same agent for that brand's search traffic, its backlinks, or the people to contact — without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/social/mcp for X plus Instagram, Reddit, Pinterest and YouTube; https://mcp.aisa.one/gtm/mcp for those plus Similarweb and Apollo.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that provides AI agents with full access to the X (Twitter) API for posting, searching, and managing engagement through natural language. It supports comprehensive tools for tweet management, media uploads, and account analytics across multiple MCP-compatible clients.1563MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server for interacting with the Twitter/X API v2, enabling AI assistants to retrieve tweets, post content, reply, quote, and more programmatically.2,105 npm13MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI agents to automate actions on X (Twitter) through a real browser session, including posting, engaging, and reading via over 40 tools. It supports self-hosting and provides a panel for API key management.2 npm7MIT
- AlicenseAqualityCmaintenanceMCP server for Twitter/X enabling AI agents to search, post, reply, and engage with tweets.147 npm2MIT