Skip to main content

X (Twitter)

io.github.Role1776/mcp-x

v0.1.1Updated Sep 9, 2026stdio · MCPBstdio · Docker

Search, read and publish X posts and manage users, lists and media via the X API v2.

Install

Needs 4 secrets. Replace 5 placeholders with your own values.

Run in your terminal. Replace 5 placeholders.

claude mcp add mcp-x -e 'X_API_KEY=<your-x-api-key>' -e 'X_API_KEY_SECRET=<your-x-api-key-secret>' -e 'X_ACCESS_TOKEN=<your-x-access-token>' -e 'X_ACCESS_TOKEN_SECRET=<your-x-access-token-secret>' -e 'MEDIA_ROOT=<your-media-root>' -e MCP_TRANSPORT=stdio -e MCP_NAME=mcp-x -e MCP_PATH=/mcp -e SERVER_PORT=8080 -e SERVER_READ_TIMEOUT=60s -e SERVER_WRITE_TIMEOUT=60s -e LOG_MODE=local -e MAX_IDLE_CONNS_PER_HOST=100 -e X_DEBUG=false -e POSTS_MAX_QUERIES=5 -e POSTS_MAX_USERNAMES=5 -e POSTS_MAX_IDS=100 -e POSTS_DEFAULT_RESULTS=10 -e POSTS_MAX_RESULTS=100 -e POSTS_DEFAULT_DAYS=7 -e POSTS_MAX_DAYS=7 -e POSTS_DEFAULT_TIMEOUT_MS=15000 -e POSTS_MIN_TIMEOUT_MS=2000 -e POSTS_MAX_TIMEOUT_MS=60000 -e USERS_MAX_USERNAMES=100 -e USERS_MAX_IDS=100 -e USERS_DEFAULT_RESULTS=100 -e USERS_MAX_RESULTS=1000 -e USERS_DEFAULT_TIMEOUT_MS=15000 -e USERS_MIN_TIMEOUT_MS=2000 -e USERS_MAX_TIMEOUT_MS=60000 -e LISTS_DEFAULT_RESULTS=25 -e LISTS_MAX_RESULTS=100 -e LISTS_DEFAULT_TIMEOUT_MS=15000 -e LISTS_MIN_TIMEOUT_MS=2000 -e LISTS_MAX_TIMEOUT_MS=60000 -e MEDIA_CHUNK_BYTES=4194304 -e MEDIA_POLL_INTERVAL_MS=2000 -e MEDIA_DEFAULT_TIMEOUT_MS=120000 -e MEDIA_MIN_TIMEOUT_MS=5000 -e MEDIA_MAX_TIMEOUT_MS=600000 -- docker run -i --rm -e X_API_KEY -e X_API_KEY_SECRET -e X_ACCESS_TOKEN -e X_ACCESS_TOKEN_SECRET -e MEDIA_ROOT -e MCP_TRANSPORT -e MCP_NAME -e MCP_PATH -e SERVER_PORT -e SERVER_READ_TIMEOUT -e SERVER_WRITE_TIMEOUT -e LOG_MODE -e MAX_IDLE_CONNS_PER_HOST -e X_DEBUG -e POSTS_MAX_QUERIES -e POSTS_MAX_USERNAMES -e POSTS_MAX_IDS -e POSTS_DEFAULT_RESULTS -e POSTS_MAX_RESULTS -e POSTS_DEFAULT_DAYS -e POSTS_MAX_DAYS -e POSTS_DEFAULT_TIMEOUT_MS -e POSTS_MIN_TIMEOUT_MS -e POSTS_MAX_TIMEOUT_MS -e USERS_MAX_USERNAMES -e USERS_MAX_IDS -e USERS_DEFAULT_RESULTS -e USERS_MAX_RESULTS -e USERS_DEFAULT_TIMEOUT_MS -e USERS_MIN_TIMEOUT_MS -e USERS_MAX_TIMEOUT_MS -e LISTS_DEFAULT_RESULTS -e LISTS_MAX_RESULTS -e LISTS_DEFAULT_TIMEOUT_MS -e LISTS_MIN_TIMEOUT_MS -e LISTS_MAX_TIMEOUT_MS -e MEDIA_CHUNK_BYTES -e MEDIA_POLL_INTERVAL_MS -e MEDIA_DEFAULT_TIMEOUT_MS -e MEDIA_MIN_TIMEOUT_MS -e MEDIA_MAX_TIMEOUT_MS ghcr.io/role1776/mcp-x:0.1.1

Configuration

41 settings, 4 required secrets. Snippets use placeholders; keep real values out of shared config.

  • X_API_KEY
    Env var· required· secret
    OAuth 1.0a consumer key. developer.x.com -> your project -> your app -> Keys and tokens.
  • X_API_KEY_SECRET
    Env var· required· secret
    OAuth 1.0a consumer secret, issued together with X_API_KEY.
  • X_ACCESS_TOKEN
    Env var· required· secret
    User access token. Set the app permissions to Read and Write BEFORE generating it: a token keeps the permissions it was created with, and a read-only one fails every write until it is regenerated.
  • X_ACCESS_TOKEN_SECRET
    Env var· required· secret
    User access token secret, issued together with X_ACCESS_TOKEN.
  • MEDIA_ROOT
    Env var· required
    Absolute path to an existing directory - the only one x_media_upload may read files from. Anything outside it is refused, symlinks included. Checked at startup.
  • MCP_TRANSPORT
    Env var· optional
    stdio (client spawns the process) or http (streamable HTTP listener).Default: stdio
Show 35 more
  • MCP_NAME
    Env var· optional
    Server name reported in the MCP initialize handshake.Default: mcp-x
  • MCP_PATH
    Env var· optional
    HTTP path the MCP endpoint is served on. Used only when MCP_TRANSPORT=http.Default: /mcp
  • SERVER_PORT
    Env var· optional
    TCP port to listen on. Used only when MCP_TRANSPORT=http.Default: 8080
  • SERVER_READ_TIMEOUT
    Env var· optional
    HTTP read timeout as a Go duration. Used only when MCP_TRANSPORT=http.Default: 60s
  • SERVER_WRITE_TIMEOUT
    Env var· optional
    HTTP write timeout as a Go duration. Used only when MCP_TRANSPORT=http.Default: 60s
  • LOG_MODE
    Env var· optional
    local (text, debug) or prod (JSON, info). Logs go to stderr.Default: local
  • MAX_IDLE_CONNS_PER_HOST
    Env var· optional
    Idle connections the outbound HTTP client keeps per host.Default: 100
  • X_DEBUG
    Env var· optional
    Log the raw requests sent to the X API. Verbose; the output can contain request details, so keep it off outside debugging.Default: false
  • POSTS_MAX_QUERIES
    Env var· optional
    Queries accepted in one x_posts_search or x_posts_count call.Default: 5
  • POSTS_MAX_USERNAMES
    Env var· optional
    Usernames accepted in one x_posts_by_user call.Default: 5
  • POSTS_MAX_IDS
    Env var· optional
    Post ids accepted in one x_posts_lookup call. The X API caps this at 100.Default: 100
  • POSTS_DEFAULT_RESULTS
    Env var· optional
    Posts returned per query when the call does not ask for a count. Every post returned is billed.Default: 10
  • POSTS_MAX_RESULTS
    Env var· optional
    Upper bound for posts per query. The X API caps this at 100.Default: 100
  • POSTS_DEFAULT_DAYS
    Env var· optional
    How far back post searches look when the call does not say, in days.Default: 7
  • POSTS_MAX_DAYS
    Env var· optional
    Furthest back a post search may look, in days. Recent search cannot exceed 7.Default: 7
  • POSTS_DEFAULT_TIMEOUT_MS
    Env var· optional
    Timeout for a posts call in milliseconds when the call does not request one.Default: 15000
  • POSTS_MIN_TIMEOUT_MS
    Env var· optional
    Lowest timeout a posts call may request, in milliseconds.Default: 2000
  • POSTS_MAX_TIMEOUT_MS
    Env var· optional
    Highest timeout a posts call may request, in milliseconds.Default: 60000
  • USERS_MAX_USERNAMES
    Env var· optional
    Usernames accepted in one x_users_lookup call. The X API caps this at 100.Default: 100
  • USERS_MAX_IDS
    Env var· optional
    User ids accepted in one x_users_lookup call. The X API caps this at 100.Default: 100
  • USERS_DEFAULT_RESULTS
    Env var· optional
    Users returned per page when the call does not ask for a count.Default: 100
  • USERS_MAX_RESULTS
    Env var· optional
    Upper bound for users per page.Default: 1000
  • USERS_DEFAULT_TIMEOUT_MS
    Env var· optional
    Timeout for a users call in milliseconds when the call does not request one.Default: 15000
  • USERS_MIN_TIMEOUT_MS
    Env var· optional
    Lowest timeout a users call may request, in milliseconds.Default: 2000
  • USERS_MAX_TIMEOUT_MS
    Env var· optional
    Highest timeout a users call may request, in milliseconds.Default: 60000
  • LISTS_DEFAULT_RESULTS
    Env var· optional
    Items returned per list page when the call does not ask for a count.Default: 25
  • LISTS_MAX_RESULTS
    Env var· optional
    Upper bound for items per list page. The X API caps this at 100.Default: 100
  • LISTS_DEFAULT_TIMEOUT_MS
    Env var· optional
    Timeout for a lists call in milliseconds when the call does not request one.Default: 15000
  • LISTS_MIN_TIMEOUT_MS
    Env var· optional
    Lowest timeout a lists call may request, in milliseconds.Default: 2000
  • LISTS_MAX_TIMEOUT_MS
    Env var· optional
    Highest timeout a lists call may request, in milliseconds.Default: 60000
  • MEDIA_CHUNK_BYTES
    Env var· optional
    Bytes per upload segment. The X APPEND endpoint caps a segment at 5 MB.Default: 4194304
  • MEDIA_POLL_INTERVAL_MS
    Env var· optional
    How often the upload status is polled while X transcodes a video, in milliseconds.Default: 2000
  • MEDIA_DEFAULT_TIMEOUT_MS
    Env var· optional
    Timeout for a whole upload in milliseconds when the call does not request one.Default: 120000
  • MEDIA_MIN_TIMEOUT_MS
    Env var· optional
    Lowest timeout an upload may request, in milliseconds.Default: 5000
  • MEDIA_MAX_TIMEOUT_MS
    Env var· optional
    Highest timeout an upload may request, in milliseconds.Default: 600000

Listed in the official MCP Registry since Sep 9, 2026. Mirrored daily; last checked Nov 26, 2026.