TwitGhost
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., "@TwitGhost 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.
TwitGhost
A Model Context Protocol (MCP) server for interacting with Twitter/X. Search tweets, post tweets, send DMs, manage your timeline — all through natural language with any MCP client (Claude, Code, Cursor, etc.).
Why TwitGhost? This is a maintained fork of
adhikasp/mcp-twikitthat uses theunclecode/twikitfork instead ofd60/twikit, fixing theKEY_BYTE/Cryptography_Hashererrors that have been blocking authentication with current X API versions.
Features
Search tweets — by keyword, with Top or Latest sorting
User timeline — get tweets from any user
Home timeline — For You and Following feeds
Post tweets — with media, replies, and mentions
Delete tweets — by ID
Send DMs — direct messages with optional media
Delete DMs — by message ID
Related MCP server: Twitter MCP Server
Installation
Prerequisites
Python 3.10+
A Twitter/X account (free tier works fine)
Via Smithery (recommended)
npx -y @smithery/cli install mcp-twitghost --client claudeManual (uvx)
{
"mcpServers": {
"twitghost": {
"command": "uvx",
"args": ["--from", "git+https://github.com/arvinmoj/mcp-twitghost", "mcp-twitghost"],
"env": {
"TWITTER_USERNAME": "@yourusername",
"TWITTER_EMAIL": "you@example.com",
"TWITTER_PASSWORD": "your-password"
}
}
}
}Manual (pip)
git clone https://github.com/arvinmoj/mcp-twitghost.git
cd mcp-twitghost
pip install .Then configure in your MCP client:
{
"mcpServers": {
"twitghost": {
"command": "mcp-twitghost",
"env": {
"TWITTER_USERNAME": "@yourusername",
"TWITTER_EMAIL": "you@example.com",
"TWITTER_PASSWORD": "your-password"
}
}
}
}Authentication
TwitGhost supports two authentication modes, checked in order:
1. Browser Cookies (recommended — bypasses Cloudflare/rate limits)
If you export cookies from your browser session, TwitGhost loads them directly. This bypasses the Cloudflare WAF block that often breaks password login.
Cookie path: ~/.twitghost/cookies.json
How to export:
Log in to X in your browser
Install a cookie exporter extension (e.g., "Get cookies.txt" or "Export Cookie JSON")
Export cookies as JSON to
~/.twitghost/cookies.jsonRestart your MCP client
Required cookies for a working session:
auth_token— primary authct0— CSRF tokentwid— user IDguest_id— guest identifier__cf_bm— Cloudflare bypass
Cookies expire ~30 days. When they do, re-export from your browser.
2. Credentials (fallback)
If no cookies file is found, TwitGhost falls back to username/email/password login:
Env Variable | Description | Required |
| Your X handle | Yes |
| Email on your X account | Yes |
| Your X password | Yes |
| Optional browser UA | No |
⚠️ Known issue: password login may fail with
CloudflareorKEY_BYTEerrors. If this happens, switch to browser cookies.
Available Tools
Tool | Description |
| Search tweets by query. |
| Get tweets from a user's timeline |
| Your For You feed |
| Your Following feed |
| Post a tweet. Supports media, replies, and @mentions |
| Delete a tweet by ID |
| Send a DM to a user. Optional media attachment. |
| Delete a DM by message ID |
Rate Limits
Built-in client-side rate limiting to avoid hitting Twitter's server-side caps:
Endpoint | Limit | Window |
Tweets | 300 tweets | 15 min |
DMs | 1,000 messages | 15 min |
Troubleshooting
KEY_BYTE or Cryptography_Hasher error
This is a known issue with the original d60/twikit package and newer X API endpoints. TwitGhost uses the unclecode/twikit fork which fixes this. Make sure you installed the right dependency:
pip show twikit
# Source should show unclecode/twikitIf it still shows d60/twikit, reinstall:
pip uninstall twikit
pip install git+https://github.com/unclecode/twikit.gitCloudflare / 403 error on login
Twitter's Cloudflare WAF blocks many automated logins. Use browser cookies instead:
Export cookies from a logged-in browser session
Save to
~/.twitghost/cookies.jsonRestart TwitGhost
Cookie file exists but auth fails
Cookies expire after ~30 days. Re-export from your browser.
Cannot connect to host / SSL errors
Ensure your Python installation has up-to-date SSL certificates:
pip install --upgrade certifiCredits
Based on
adhikasp/mcp-twikit— original MCP Twitter serverUses
unclecode/twikitfork for X API compatibilityBuilt with FastMCP and the MCP protocol
License
MIT
Available Tools
8 toolsdelete_dmC
Delete a direct message by its ID.
Inputs: message_id (required). Returns: result
delete_tweetC
Delete a tweet by its ID.
Inputs: tweet_id (required). Returns: result
get_latest_timelineC
Get tweets from your home timeline (Following).
Inputs: count. Returns: result
get_timelineC
Get tweets from your home timeline (For You).
Inputs: count. Returns: result
get_user_tweetsC
Get tweets from a specific user's timeline.
Inputs: username (required), tweet_type, count. Returns: result
post_tweetC
Post a tweet with optional media, reply, and tags.
Inputs: text (required), media_paths, reply_to, tags. Returns: result
search_twitterC
Search twitter with a query. Sort by 'Top' or 'Latest'
Inputs: query (required), sort_by, count. Returns: result
send_dmC
Send a direct message to a user.
Inputs: user_id (required), message (required), media_path. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools are clearly distinct, but get_latest_timeline and get_timeline both retrieve home timeline tweets with only a subtle difference (Following vs For You), which could cause misselection.
All tools use snake_case with a consistent verb_noun pattern (delete_, get_, post_, search_, send_), making them predictable.
8 tools is well-scoped for a Twitter API wrapper, covering posting, deleting, reading, searching, and DMs without being excessive.
Missing essential operations like get_tweet by ID and list/get DMs, which creates dead ends for common workflows.
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.
Official twitterapi.io hosted MCP: Twitter/X tweets, users, followers, trends. OAuth or API key.
Search, label, and manage your X (Twitter) bookmarks from any MCP client via Tweetsmash
Publish and schedule tweets and threads on X (Twitter) from your AI assistant.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables interaction with X (formerly Twitter), allowing for posting tweets, searching content, managing accounts, and organizing lists.1119 npm3MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to access Twitter/X data including user profiles, tweets, search, and follower events via a set of MCP tools.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with X (Twitter) API v2 for posting tweets, searching, liking, retweeting, and more through natural language.MIT
- FlicenseAqualityDmaintenanceEnables AI assistants to post, search, and manage tweets on X (Twitter) via the MCP protocol.102-