Skip to main content
Glama

x-mcp

MCP server in front of the X (Twitter) API v2. Image: ghcr.io/robertdwhite/x-mcp. Manifests in whitehouse-rke2 (apps/ai/x-mcp/).

Reads are free. Writes are two-stepdraft_post returns a preview plus a single-use confirm_token, and nothing is published until publish_post is called with that exact token. An agent cannot post in one call, so a human-visible preview always exists first. That matters when the output is public and permanent.

There is deliberately no delete tool. Deletion is destructive and irreversible; remove posts from the X app.

Tools

Tool

Kind

Notes

whoami

read

Which account the credentials act as

get_tweet

read

One post by id

get_user_posts

read

Recent posts from a handle

get_mentions

read

Mentions of the authenticated account

get_home_timeline

read

Reverse-chronological home timeline

search_recent

read

Last-7-days search (plan-dependent)

draft_post

stage

Validates + previews. Publishes nothing.

list_drafts

read

Staged drafts and their remaining TTL

publish_post

write

Publishes a draft. Public and permanent.

Drafts are in-memory: a restart clears them, so a stale confirm token never outlives the process that showed the preview.

Related MCP server: pyX-MCP

Endpoints

  • POST /mcp — streamable-HTTP MCP, gated on Authorization: Bearer $MCP_TOKEN

  • GET /healthz — open, for liveness/readiness

Every other path returns 404, not 401 — including the /.well-known/oauth-* probes MCP clients make on startup. A 401 there makes clients attempt an interactive OAuth flow, which hangs headless clients as a connection timeout.

Configuration

Env

Required

Purpose

MCP_TOKEN

recommended

Bearer for /mcp. Unset = unauthenticated.

X_API_KEY

yes

Consumer key

X_API_SECRET

yes

Consumer secret

X_ACCESS_TOKEN

yes

Access token (user context)

X_ACCESS_TOKEN_SECRET

yes

Access token secret

X_MAX_CHARS

no

Length limit, default 280. Raise for premium.

X_DRAFT_TTL

no

Draft lifetime in seconds, default 600

X_TIMEOUT

no

HTTP timeout, default 30

Auth to X is OAuth 1.0a user context, signed per request. App-only bearer tokens cannot post, because publishing acts as the account. Get the four values from an X app with Read and Write permission: consumer keys plus an access token/secret pair generated for your own account.

If the credentials are missing, every tool returns a clear "not configured" error instead of a stack trace — so the service can be deployed before the credentials exist.

Note on X API plans

Write access is gated by X's paid API tiers, and the free tier is heavily capped. A 429 from this server surfaces the rate-limit reset when X provides it. Check your plan at developer.x.com if writes fail immediately.

Local run

pip install -r requirements.txt
MCP_TOKEN=dev X_API_KEY=... X_API_SECRET=... \
  X_ACCESS_TOKEN=... X_ACCESS_TOKEN_SECRET=... python server.py
F
license - not found
Not graded
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.

Related MCP Servers

  • A
    license
    B
    quality
    C
    maintenance
    Enables interacting with Twitter/X through natural language, including searching tweets, posting, sending DMs, and managing timelines via any MCP client.
    8
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to post, search, and manage tweets on X (Twitter) via the MCP protocol.
    10
    2
  • F
    license
    A
    quality
    D
    maintenance
    Enables interaction with the X (Twitter) API through MCP tools for managing users, posts, bookmarks, likes, and lists. Supports markdown or JSON output and uses OAuth 2.0 PKCE authentication.
    22
  • A
    license
    A
    quality
    B
    maintenance
    MCP server for the Twitter/X read API, enabling search, user profiles, tweets, followers, and more via natural language.
    94
    149
    MIT

View all related MCP servers

Related MCP Connectors

  • FastMCP server for posting formatted content to X (Twitter) — Tollbooth-monetized, DPYC-native

  • 128 REST operations. 120 MCP routes; 119 JSON/text ops. OAuth 2.1. Not affiliated with X Corp.

  • Bluesky MCP — wraps the AT Protocol API

View all MCP Connectors

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/RobertDWhite/x-mcp'

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