Skip to main content
Glama

Spectre

X/Twitter data for AI agents. MCP server powered by twscrape — direct GraphQL, no browser automation, no paid API keys.

What It Does

Gives AI agents (Hermes, Claude, Cursor, etc.) the ability to:

  • Search tweets with full X query operators

  • Read user profiles, timelines, media

  • Follow conversation threads

  • Track trending topics

  • Browse communities and lists

  • Manage an account pool with automatic rotation

All via X's internal GraphQL API — 10-100x faster than browser-based alternatives.

Related MCP server: Twitter/X MCP Server

Quick Start

1. Install

# With uvx (recommended for MCP)
uvx spectre-mcp

# Or pip
pip install spectre-mcp

2. Add an Account

Grab cookies from your browser (DevTools → Application → Cookies → x.com):

# Via the MCP tool
add_account_cookies("my_account", "auth_token=xxx; ct0=yyy")

Or via twscrape CLI:

twscrape add_cookie my_account "auth_token=xxx; ct0=yyy"

3. Configure Your MCP Client

Hermes Agent (~/.hermes/config.yaml):

mcp:
  servers:
    spectre:
      command: uvx
      args: ["spectre-mcp"]

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "spectre": {
      "command": "uvx",
      "args": ["spectre-mcp"]
    }
  }
}

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "spectre": {
      "command": "uvx",
      "args": ["spectre-mcp"]
    }
  }
}

Tools (22)

Tool

Description

search

Search tweets with X query operators

search_users

Search for users by name/keyword

get_user

User profile by @handle

get_user_tweets

User's recent tweets

get_user_media

User's photos/videos

get_followers

User's followers

get_following

Who a user follows

get_tweet

Single tweet by ID

get_tweet_replies

Replies to a tweet

get_thread

Full conversation thread

get_retweeters

Users who retweeted

get_trends

Trending topics

get_list_timeline

Tweets from a list

get_list_members

Members of a list

get_community_tweets

Tweets from a community

get_community_info

Community details

get_bookmarks

Auth'd user's bookmarks

add_account_cookies

Add account via cookies

add_account_credentials

Add account via login

pool_status

Account pool health

Environment Variables

Variable

Default

Description

SPECTRE_DB

~/.twscrape/spectre.db

Account pool SQLite path

SPECTRE_PROXY

none

Global proxy (socks5://user:pass@host:port)

TWS_HTTP_BACKEND

httpx

Set to curl for TLS fingerprinting

TWS_PROXY

none

twscrape's own proxy env (lower priority)

How It Works

Spectre wraps twscrape behind the Model Context Protocol. twscrape handles:

  • GraphQL endpoint management (auto-updated operation IDs)

  • x-client-transaction-id generation

  • Account pool rotation on rate limits

  • Per-endpoint rate limit tracking

  • Cookie-based session persistence

Spectre adds:

  • Clean MCP tool interface for agent consumption

  • Pydantic response models

  • Account pool management tools

  • Proper error handling and limits

Account Pool

The account pool is a local SQLite database. Accounts are automatically rotated when one gets rate-limited (per-endpoint). If all accounts are locked, Spectre waits until one frees up.

Best practice: Use 2-3 throwaway accounts with cookies from separate browser sessions. Never use your main account.

Limitations

  • Read-only — no posting, liking, following (by design, for research use)

  • Requires authenticated accounts — X blocks unauthenticated access

  • Rate limited — ~300 requests/hour/account (automatic rotation handles this)

  • ~3200 tweet cap on user timelines (X's own limit)

  • ToS risk — automated access violates X's terms. Use responsibly.

License

MIT

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pranrichh/spectre-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server