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.1Configuration
41 settings, 4 required secrets. Snippets use placeholders; keep real values out of shared config.
X_API_KEYEnv var· required· secretOAuth 1.0a consumer key. developer.x.com -> your project -> your app -> Keys and tokens.X_API_KEY_SECRETEnv var· required· secretOAuth 1.0a consumer secret, issued together with X_API_KEY.X_ACCESS_TOKENEnv var· required· secretUser 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_SECRETEnv var· required· secretUser access token secret, issued together with X_ACCESS_TOKEN.MEDIA_ROOTEnv var· requiredAbsolute 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_TRANSPORTEnv var· optionalstdio (client spawns the process) or http (streamable HTTP listener).Default:stdio
Show 35 moreShow fewer
MCP_NAMEEnv var· optionalServer name reported in the MCP initialize handshake.Default:mcp-xMCP_PATHEnv var· optionalHTTP path the MCP endpoint is served on. Used only when MCP_TRANSPORT=http.Default:/mcpSERVER_PORTEnv var· optionalTCP port to listen on. Used only when MCP_TRANSPORT=http.Default:8080SERVER_READ_TIMEOUTEnv var· optionalHTTP read timeout as a Go duration. Used only when MCP_TRANSPORT=http.Default:60sSERVER_WRITE_TIMEOUTEnv var· optionalHTTP write timeout as a Go duration. Used only when MCP_TRANSPORT=http.Default:60sLOG_MODEEnv var· optionallocal (text, debug) or prod (JSON, info). Logs go to stderr.Default:localMAX_IDLE_CONNS_PER_HOSTEnv var· optionalIdle connections the outbound HTTP client keeps per host.Default:100X_DEBUGEnv var· optionalLog the raw requests sent to the X API. Verbose; the output can contain request details, so keep it off outside debugging.Default:falsePOSTS_MAX_QUERIESEnv var· optionalQueries accepted in one x_posts_search or x_posts_count call.Default:5POSTS_MAX_USERNAMESEnv var· optionalUsernames accepted in one x_posts_by_user call.Default:5POSTS_MAX_IDSEnv var· optionalPost ids accepted in one x_posts_lookup call. The X API caps this at 100.Default:100POSTS_DEFAULT_RESULTSEnv var· optionalPosts returned per query when the call does not ask for a count. Every post returned is billed.Default:10POSTS_MAX_RESULTSEnv var· optionalUpper bound for posts per query. The X API caps this at 100.Default:100POSTS_DEFAULT_DAYSEnv var· optionalHow far back post searches look when the call does not say, in days.Default:7POSTS_MAX_DAYSEnv var· optionalFurthest back a post search may look, in days. Recent search cannot exceed 7.Default:7POSTS_DEFAULT_TIMEOUT_MSEnv var· optionalTimeout for a posts call in milliseconds when the call does not request one.Default:15000POSTS_MIN_TIMEOUT_MSEnv var· optionalLowest timeout a posts call may request, in milliseconds.Default:2000POSTS_MAX_TIMEOUT_MSEnv var· optionalHighest timeout a posts call may request, in milliseconds.Default:60000USERS_MAX_USERNAMESEnv var· optionalUsernames accepted in one x_users_lookup call. The X API caps this at 100.Default:100USERS_MAX_IDSEnv var· optionalUser ids accepted in one x_users_lookup call. The X API caps this at 100.Default:100USERS_DEFAULT_RESULTSEnv var· optionalUsers returned per page when the call does not ask for a count.Default:100USERS_MAX_RESULTSEnv var· optionalUpper bound for users per page.Default:1000USERS_DEFAULT_TIMEOUT_MSEnv var· optionalTimeout for a users call in milliseconds when the call does not request one.Default:15000USERS_MIN_TIMEOUT_MSEnv var· optionalLowest timeout a users call may request, in milliseconds.Default:2000USERS_MAX_TIMEOUT_MSEnv var· optionalHighest timeout a users call may request, in milliseconds.Default:60000LISTS_DEFAULT_RESULTSEnv var· optionalItems returned per list page when the call does not ask for a count.Default:25LISTS_MAX_RESULTSEnv var· optionalUpper bound for items per list page. The X API caps this at 100.Default:100LISTS_DEFAULT_TIMEOUT_MSEnv var· optionalTimeout for a lists call in milliseconds when the call does not request one.Default:15000LISTS_MIN_TIMEOUT_MSEnv var· optionalLowest timeout a lists call may request, in milliseconds.Default:2000LISTS_MAX_TIMEOUT_MSEnv var· optionalHighest timeout a lists call may request, in milliseconds.Default:60000MEDIA_CHUNK_BYTESEnv var· optionalBytes per upload segment. The X APPEND endpoint caps a segment at 5 MB.Default:4194304MEDIA_POLL_INTERVAL_MSEnv var· optionalHow often the upload status is polled while X transcodes a video, in milliseconds.Default:2000MEDIA_DEFAULT_TIMEOUT_MSEnv var· optionalTimeout for a whole upload in milliseconds when the call does not request one.Default:120000MEDIA_MIN_TIMEOUT_MSEnv var· optionalLowest timeout an upload may request, in milliseconds.Default:5000MEDIA_MAX_TIMEOUT_MSEnv var· optionalHighest timeout an upload may request, in milliseconds.Default:600000
Links
Listed in the official MCP Registry since Sep 9, 2026. Mirrored daily; last checked Nov 26, 2026.