Spectre MCP
The fastest X/Twitter automation for AI agents.
111 tools · no browser · no API keys · no monthly fees
Quick Start · Tools · Why Spectre? · Safety · Integrations · Reference
Spectre is an MCP server that gives AI agents 111 tools for X/Twitter: search, timelines, profiles, posting, media, DMs, lists, bookmarks, communities, notifications, scheduled posts and account management.
Under the hood it talks straight to X's internal GraphQL and REST APIs with the cookies you already have. No browser to boot, no Puppeteer to babysit, no DOM scraping that dies when the UI changes.
Why Spectre?
| Spectre | Browser agents | API wrappers | |
|---|---|---|---|
| Transport | Direct GraphQL/REST | Headless Chromium | GraphQL (single session) |
| Per call | < 1s | 3–10s (browser startup) | ~1s |
| Memory | ~10 MB | 200 MB+ | ~10 MB |
| MCP server | ✓ 111 tools | ad-hoc scripts | ✗ |
| Account pool | ✓ real rotation on 429 | ✗ | ✗ |
| Error contract | ✓ structured kind + hint |
✗ | ✗ |
| Pagination | ✓ cursors on list endpoints | ✗ | partial |
| Media upload | ✓ cookie auth, no API keys | slow | needs keys |
| Language | Python | JS | Python |
What changed in 2.0, and why it matters:
- Every write verifies itself. X answers HTTP 200 with an
errorsarray often enough that "no exception" means nothing. 31 GraphQL query ids had silently drifted; the ones Spectre uses are now generated from X's live bundles and verified against the API. - Errors are structured.
{"error", "kind", "hint"}withkindinauth · rate_limit · permission · validation · not_found · upstream, so an agent can retry, switch accounts, or stop — instead of guessing. - Rotation is real. A 429 or a dead cookie parks that account and retries the call on the next one.
- Limits are honoured.
limit=5000returns 5000 followers, not the first page. Long walks returntruncated: trueinstead of hanging. - New in 2.0:
get_me,get_user_by_id,get_users_by_ids,get_tweets,get_tweet_quotes,download_media,get_rate_limits,get_list_info,get_trend_locations.
Quick Start
1. Install
pipx install spectre-mcp # or: uv tool install spectre-mcp
2. Add your X account
Log into x.com, open DevTools (F12) → Application → Cookies →
https://x.com, and copy two values:
| Cookie | Looks like |
|---|---|
auth_token |
a long hex string |
ct0 |
exactly 160 hex characters |
spectre add myaccount "auth_token=...; ct0=..."
Spectre checks the cookies against X before saving and stores the account's real handle — so a renamed account still works. Bad cookies are rejected on the spot instead of failing silently weeks later.
spectre list # accounts and their state
spectre status # pool health
spectre doctor # auth + operation-table check
3. Point your MCP client at it
{
"mcpServers": {
"spectre": {
"command": "uvx",
"args": ["spectre-mcp"]
}
}
}
Works with Hermes (~/.hermes/config.yaml), Claude Desktop
(claude_desktop_config.json), Cursor (.cursor/mcp.json) — see
Integrations.
4. Call a tool
IDs are strings (or full https://x.com/... URLs), never JSON numbers:
get_me() # which account is live
search("mcp server", limit=20, mode="latest")
get_user("elonmusk") # -> id for follow/block/DM
post_tweet("hello from an agent")
X IDs are 64-bit and overflow the IEEE-754 safe range (2^53). A client that
parses JSON numbers as doubles turns 2111332908657148356 into
2111332908657148416 and the tool reports a perfectly good post as "not
found". Strings never round-trip through a float.
What's in the box
| Area | Tools |
|---|---|
| Accounts | get_me, list_accounts, pool_status, set_active_account, set_auto_rotate, get_rate_limits, remove_account |
| Search | search (full operator syntax), search_users |
| Profiles | get_user, get_user_by_id, get_users_by_ids, get_user_tweets, get_user_tweets_and_replies, get_user_media, get_followers, get_following, get_verified_followers, get_followers_you_know, get_user_likes, get_user_highlights |
| Posts | get_tweet, get_tweets, get_tweet_replies, get_thread, get_tweet_quotes, get_retweeters, get_favoriters, get_tweet_edit_history, get_similar_posts, get_community_notes |
| Compose | post_tweet, delete_tweet, upload_media, download_media, schedule_tweet (+CRUD), create_draft (+CRUD) |
| Engagement | like_tweet, unlike_tweet, retweet, unretweet, bookmark_tweet, unbookmark_tweet, pin_tweet, unpin_tweet, pin_reply, unpin_reply |
| Social | follow_user, unfollow_user, mute_user, unmute_user, block_user, unblock_user, remove_follower, get_muted_accounts, get_blocked_accounts |
| DMs | send_dm, get_dm_inbox, get_dm_conversation, search_dm, search_dm_groups, search_dm_people, get_dm_muted, dm_block_user, dm_unblock_user |
| Lists | get_list_info, create_list, update_list, delete_list, add_list_member, remove_list_member, get_list_members, get_list_timeline, get_list_subscribers, get_list_memberships, get_list_ownerships, subscribe_list, unsubscribe_list |
| Communities & topics | get_community_info, get_community_tweets, join_community, leave_community, get_topic_info, follow_topic, unfollow_topic, get_trends, get_trend_locations |
| Bookmarks | get_bookmarks, search_bookmarks, clear_all_bookmarks, folder CRUD + folder timeline |
| Notifications | get_notifications, get_home_timeline |
| Profile | get_account_settings, update_profile, update_profile_image, update_profile_banner, delete_profile_banner, rate_community_note |
Full reference with arguments and gotchas: docs/tools.md.
Safety
Posting, DMs, follows, blocks, deletes and profile edits are public and mostly irreversible. Spectre labels them in docs/safety.md; the agent-side rule is simple: confirm with the user before any write.
Rate limits are per account (~50 searches / 15 min, ~300 requests / 15 min on
reads). The pool rotates automatically; get_rate_limits() tells you when the
next window opens.
Automated access violates X's Terms of Service. You are responsible for the account you point this at.
Development
git clone https://github.com/pranrichh/spectre-mcp
cd spectre-mcp
uv sync
.venv/bin/python tools/gen_docs.py --check # fails if docs/tools.md drifted
.venv/bin/python -m pytest tests -q # parser tests
.venv/bin/python tools/update_ops.py GraphQL.json # refresh query ids
Query ids drift every few weeks. tools/update_ops.py regenerates
src/spectre/ops.py from
fa0311/TwitterInternalAPIDocument;
SPECTRE_OP_<NAME> overrides a single operation at runtime.
License
MIT
Metadata
Release files for spectre-mcp 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spectre_mcp-2.0.0.tar.gz | 73.8 kB | Without provenance | Details for spectre_mcp-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spectre_mcp-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for spectre_mcp-2.0.0-py3-none-any.whl |
Total release size: 128.7 kB
Release files / spectre_mcp-2.0.0.tar.gz
| Download URL | spectre_mcp-2.0.0.tar.gz |
|---|---|
| Size | 73.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
579b61695229123e694923b1df6cedeae4321ec909fcba6d18de257e8d39b572
|
|
BLAKE2b-256 checksum How to use checksums |
45d43a35bae9d514a50fabf293c2a4858c22bd76c8e7d93cbee47f8a2b330bac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / spectre_mcp-2.0.0-py3-none-any.whl
| Download URL | spectre_mcp-2.0.0-py3-none-any.whl |
|---|---|
| Size | 54.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0e37777a31c4585d82431484762b67374455a918cebb745c300429f241af1a3
|
|
BLAKE2b-256 checksum How to use checksums |
359e04cae14e663788ac4227e6a624bcabc9ce797b7c725d771307c7e6549229
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for spectre-mcp 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.