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., "@TwitGhostsearch 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.
| Name | Required | Description | Default |
|---|---|---|---|
| message_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must bear full responsibility for behavioral disclosure. It merely says 'Delete a direct message' without mentioning irreversibility, permissions, authentication requirements, or side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no wasted words. It conveys the core action and required parameter efficiently.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple one-parameter delete operation, the description is minimally adequate. However, it lacks important contextual details (e.g., who can delete, confirmation, soft vs hard delete) that would improve completeness, especially given the lack of annotations.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description should compensate by explaining the parameter. It does not; it only mentions 'by its ID' implicitly referring to message_id but adds no explicit semantic value beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'delete' and the specific resource 'direct message' by its ID. This effectively distinguishes it from sibling tools like 'delete_tweet' (different resource) and 'send_dm' (different action).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, no prerequisites, and no context on appropriate or inappropriate usage scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
delete_tweetC
Delete a tweet by its ID.
| Name | Required | Description | Default |
|---|---|---|---|
| tweet_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It only states the operation with no details on irreversibility, required permissions, or side effects. Minimal disclosure beyond the action itself.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Extremely concise at five words, front-loading the action and resource. However, it is arguably under-specified; a slightly more informative description could improve without losing conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simple tool (1 parameter) and no annotations, the description is sparse. It does not mention return values, error conditions, or prerequisites. An output schema exists but is not shown, so the description alone is incomplete for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema coverage, the description must add meaning beyond the schema. It adds 'by its ID' which ties the parameter to the tweet being deleted, but does not explain how to obtain the ID or any constraints on the parameter value.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action (delete) and the resource (a tweet) with a specific identifier (by its ID). It distinguishes from siblings like delete_dm by targeting tweets specifically.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives such as delete_dm or other tweet tools. Does not provide context for appropriate use cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_latest_timelineC
Get tweets from your home timeline (Following).
| Name | Required | Description | Default |
|---|---|---|---|
| count | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must carry behavioral disclosure. It fails to mention any side effects (e.g., rate limiting), output format, or whether retweets/replies are included. The lack of detail leaves agent uncertain.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Extremely concise single sentence with clear subject and verb. No wasted words, but the brevity sacrifices valuable context. Front-loaded with core purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has one parameter and no annotations, the description should at least explain how the 'count' parameter affects results or mention the output schema. It lacks completeness for effective use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description does not mention the 'count' parameter at all. Schema has 0% description coverage, so the description provides no additional meaning beyond the schema's existence of an integer defaulting to 20.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states the verb 'Get' and resource 'tweets from your home timeline (Following)'. However, it does not differentiate from sibling tool 'get_timeline', which may serve a similar purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No indication of when to use this tool versus alternatives like 'get_timeline' or 'search_twitter'. No context on prerequisites or typical use cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_timelineC
Get tweets from your home timeline (For You).
| Name | Required | Description | Default |
|---|---|---|---|
| count | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, and the description does not disclose behavioral traits such as rate limits, authentication requirements, pagination behavior, or the nature of the returned data. The minimal description fails to add context beyond the basic function.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence. However, it is too brief and omits critical details, making it more under-specified than appropriately concise.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite having an output schema, the description lacks context about what data is returned, the effect of the 'count' parameter, and any other relevant details. It is incomplete for effective tool selection and invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has one parameter ('count') with 0% description coverage, and the tool description does not mention or explain this parameter. No value is added beyond what the schema provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool retrieves tweets from the home timeline, specifically the 'For You' feed. This distinguishes it from siblings like 'get_user_tweets' or 'get_latest_timeline', which target different scopes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like 'get_latest_timeline' or 'search_twitter'. The description lacks explicit context for appropriate usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_user_tweetsC
Get tweets from a specific user's timeline.
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | ||
| tweet_type | No | Tweets | |
| count | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, and the description fails to disclose any behavioral traits such as authentication needs, rate limits, handling of private accounts, or whether tweets include replies. The description carries the full burden but provides no useful transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, which is concise, but it is too minimal. It lacks any structure or additional context, making it less helpful.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given three parameters with no descriptions, no annotations, and a vague description, the tool is incomplete for effective agent use. The output schema exists but is not referenced.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has 0% description coverage, and the description adds no meaning to parameters like 'tweet_type' (possible values) or 'count' (limit behavior). The defaults are present but not explained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Get') and resource ('tweets from a specific user's timeline'). It distinguishes from sibling tools like 'get_timeline' and 'get_latest_timeline' by specifying 'specific user', though it could explicitly mention 'by username'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives (e.g., get_timeline for the logged-in user). There is no mention of prerequisites, limitations, or context for using tweet_type or count.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
post_tweetC
Post a tweet with optional media, reply, and tags.
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| media_paths | No | ||
| reply_to | No | ||
| tags | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description does not disclose any behavioral details beyond the basic action. With no annotations provided, it fails to mention authentication needs, rate limits, idempotency (e.g., duplicate tweets), or what happens on failure. The tool is clearly a write operation, but no safety or side-effect context is given.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that conveys the core function and optional features efficiently. It is front-loaded and wastes no words, though it could be expanded to cover key nuances without losing conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool creates a resource (tweet), the description should mention the output (e.g., returns tweet object or ID). An output schema exists but is not referenced. No prerequisites, error conditions, or usage patterns are described. For a simple tool, critical gaps remain.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description briefly maps 'media', 'reply', and 'tags' to the parameters media_paths, reply_to, and tags, but adds no semantics about format, constraints, or relationship. For example, 'media' could imply file paths, URLs, or IDs, and 'tags' might be Twitter hashtags or arbitrary metadata. With 0% schema description coverage, this minimal addition barely helps.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Post a tweet') and mentions optional features (media, reply, tags), making the purpose obvious. It distinguishes from sibling tools like delete_tweet or get_timeline by focusing on creation, but lacks specificity about the scope (e.g., user's own account).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives. For example, it doesn't mention that creating a reply uses the reply_to parameter or that media uploads might have prerequisites. Sibling tools like delete_tweet or get_user_tweets are not referenced.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_twitterC
Search twitter with a query. Sort by 'Top' or 'Latest'
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| sort_by | No | Top | |
| count | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, description must fully disclose behavior. Only mentions search and sort options, omitting return format, rate limits, or authentication needs.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Very short and front-loaded, but sacrifices completeness. Could be restructured to include more context without being verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite having an output schema, description fails to cover essential details for a search tool with three parameters and no annotations. Incomplete for effective use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Adds minimal meaning: mentions query and sort_by but not count. Does not explain query syntax or sort behavior beyond listing two values.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states verb 'Search' and resource 'twitter' with a query. However, it does not distinguish from siblings like get_timeline or get_user_tweets, which also retrieve tweets.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides no guidance on when to use search_twitter versus sibling tools. Lacks any context about prerequisites or alternative scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
send_dmC
Send a direct message to a user.
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | ||
| message | Yes | ||
| media_path | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, and description lacks disclosure of behavioral traits such as idempotency, rate limits, permissions, or response behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence is concise but underspecified for the tool's complexity. Front-loading is adequate but content is minimal.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Description fails to provide sufficient context for a 3-parameter tool with no schema descriptions. No mention of output, errors, or effects.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and description adds no meaning to the parameters (user_id, message, media_path). No formats, constraints, or examples are given.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states the action ('Send') and resource ('direct message to a user'). It is distinct from sibling tools like post_tweet or delete_dm.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool vs alternatives like post_tweet or delete_dm. No prerequisites or exclusions mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
8 tool updates
v0.1.0- First observed
delete_dm - First observed
delete_tweet - First observed
get_latest_timeline - First observed
get_timeline - First observed
get_user_tweets - First observed
post_tweet - First observed
search_twitter - First observed
send_dm
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
Search, label, and manage your X (Twitter) bookmarks from any MCP client via Tweetsmash
Twitter/X read-only MCP server — 12 tools: search, users, tweets, followers, timelines, trends.
X/Twitter reads, search, monitors and posting. Pay-per-call in USDC — no signup, no API keys.
X (formerly Twitter): X (formerly Twitter) public and private data API for search, posts (Tweets).
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with X (formerly Twitter), allowing for posting tweets, searching content, managing accounts, and organizing lists.8 npm3MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to access Twitter/X data including user profiles, tweets, search, and follower events via a set of MCP tools.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact with X (Twitter) API v2 for posting tweets, searching, liking, retweeting, and more through natural language.MIT
- FlicenseAqualityCmaintenanceEnables AI assistants to post, search, and manage tweets on X (Twitter) via the MCP protocol.102-