Back to MCP Servers
🧩

X (Twitter) MCP Server

API key required

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

To add X (Twitter) to Claude, run the install command below. Restart Claude Code after adding it and its tools show up in your next conversation. It needs 41 environment variables, listed below.

SearchAPIDevTools

Install

docker run -i --rm ghcr.io/role1776/mcp-x:0.1.1

Environment variables

X_API_KEYSet in your MCP config
X_API_KEY_SECRETSet in your MCP config
X_ACCESS_TOKENSet in your MCP config
X_ACCESS_TOKEN_SECRETSet in your MCP config
MEDIA_ROOTSet in your MCP config
MCP_TRANSPORTSet in your MCP config
MCP_NAMESet in your MCP config
MCP_PATHSet in your MCP config
SERVER_PORTSet in your MCP config
SERVER_READ_TIMEOUTSet in your MCP config
SERVER_WRITE_TIMEOUTSet in your MCP config
LOG_MODESet in your MCP config
MAX_IDLE_CONNS_PER_HOSTSet in your MCP config
X_DEBUGSet in your MCP config
POSTS_MAX_QUERIESSet in your MCP config
POSTS_MAX_USERNAMESSet in your MCP config
POSTS_MAX_IDSSet in your MCP config
POSTS_DEFAULT_RESULTSSet in your MCP config
POSTS_MAX_RESULTSSet in your MCP config
POSTS_DEFAULT_DAYSSet in your MCP config
POSTS_MAX_DAYSSet in your MCP config
POSTS_DEFAULT_TIMEOUT_MSSet in your MCP config
POSTS_MIN_TIMEOUT_MSSet in your MCP config
POSTS_MAX_TIMEOUT_MSSet in your MCP config
USERS_MAX_USERNAMESSet in your MCP config
USERS_MAX_IDSSet in your MCP config
USERS_DEFAULT_RESULTSSet in your MCP config
USERS_MAX_RESULTSSet in your MCP config
USERS_DEFAULT_TIMEOUT_MSSet in your MCP config
USERS_MIN_TIMEOUT_MSSet in your MCP config
USERS_MAX_TIMEOUT_MSSet in your MCP config
LISTS_DEFAULT_RESULTSSet in your MCP config
LISTS_MAX_RESULTSSet in your MCP config
LISTS_DEFAULT_TIMEOUT_MSSet in your MCP config
LISTS_MIN_TIMEOUT_MSSet in your MCP config
LISTS_MAX_TIMEOUT_MSSet in your MCP config
MEDIA_CHUNK_BYTESSet in your MCP config
MEDIA_POLL_INTERVAL_MSSet in your MCP config
MEDIA_DEFAULT_TIMEOUT_MSSet in your MCP config
MEDIA_MIN_TIMEOUT_MSSet in your MCP config
MEDIA_MAX_TIMEOUT_MSSet in your MCP config

What this does

X (Twitter) exposes a set of tools to Claude over the Model Context Protocol. After you add it to claude_desktop_config.json (snippet above) and restart Claude Desktop, those tools become callable inside any conversation.

Requirements

This server needs the following environment variables to be set before it can run:

X_API_KEY
X_API_KEY_SECRET
X_ACCESS_TOKEN
X_ACCESS_TOKEN_SECRET
MEDIA_ROOT
MCP_TRANSPORT
MCP_NAME
MCP_PATH
SERVER_PORT
SERVER_READ_TIMEOUT
SERVER_WRITE_TIMEOUT
LOG_MODE
MAX_IDLE_CONNS_PER_HOST
X_DEBUG
POSTS_MAX_QUERIES
POSTS_MAX_USERNAMES
POSTS_MAX_IDS
POSTS_DEFAULT_RESULTS
POSTS_MAX_RESULTS
POSTS_DEFAULT_DAYS
POSTS_MAX_DAYS
POSTS_DEFAULT_TIMEOUT_MS
POSTS_MIN_TIMEOUT_MS
POSTS_MAX_TIMEOUT_MS
USERS_MAX_USERNAMES
USERS_MAX_IDS
USERS_DEFAULT_RESULTS
USERS_MAX_RESULTS
USERS_DEFAULT_TIMEOUT_MS
USERS_MIN_TIMEOUT_MS
USERS_MAX_TIMEOUT_MS
LISTS_DEFAULT_RESULTS
LISTS_MAX_RESULTS
LISTS_DEFAULT_TIMEOUT_MS
LISTS_MIN_TIMEOUT_MS
LISTS_MAX_TIMEOUT_MS
MEDIA_CHUNK_BYTES
MEDIA_POLL_INTERVAL_MS
MEDIA_DEFAULT_TIMEOUT_MS
MEDIA_MIN_TIMEOUT_MS
MEDIA_MAX_TIMEOUT_MS

Set these via the env object in your MCP config (see claude_desktop_config.json snippet above).

Frequently asked questions

How do I install X (Twitter)?

The install section on this page carries the maker's install command for X (Twitter), as submitted. Restart your client afterwards and the tools appear in your next conversation.

Which clients work with X (Twitter)?

This page carries setup and config for Claude Code. Any other MCP client that accepts a standard server config can connect to X (Twitter) as well.

Does X (Twitter) need an API key?

Yes. Before it can run, set these environment variables: X_API_KEY, X_API_KEY_SECRET, X_ACCESS_TOKEN, X_ACCESS_TOKEN_SECRET, MEDIA_ROOT, MCP_TRANSPORT, MCP_NAME, MCP_PATH, SERVER_PORT, SERVER_READ_TIMEOUT, SERVER_WRITE_TIMEOUT, LOG_MODE, MAX_IDLE_CONNS_PER_HOST, X_DEBUG, POSTS_MAX_QUERIES, POSTS_MAX_USERNAMES, POSTS_MAX_IDS, POSTS_DEFAULT_RESULTS, POSTS_MAX_RESULTS, POSTS_DEFAULT_DAYS, POSTS_MAX_DAYS, POSTS_DEFAULT_TIMEOUT_MS, POSTS_MIN_TIMEOUT_MS, POSTS_MAX_TIMEOUT_MS, USERS_MAX_USERNAMES, USERS_MAX_IDS, USERS_DEFAULT_RESULTS, USERS_MAX_RESULTS, USERS_DEFAULT_TIMEOUT_MS, USERS_MIN_TIMEOUT_MS, USERS_MAX_TIMEOUT_MS, LISTS_DEFAULT_RESULTS, LISTS_MAX_RESULTS, LISTS_DEFAULT_TIMEOUT_MS, LISTS_MIN_TIMEOUT_MS, LISTS_MAX_TIMEOUT_MS, MEDIA_CHUNK_BYTES, MEDIA_POLL_INTERVAL_MS, MEDIA_DEFAULT_TIMEOUT_MS, MEDIA_MIN_TIMEOUT_MS, MEDIA_MAX_TIMEOUT_MS. They go in the env block of your MCP config.

Imported from the Official MCP Registry. The details above come from the registry entry; the maker can claim this listing to correct them, add docs, and see its traffic.

Is this your MCP server?

Claim this listing to see its traffic, fix details yourself, and skip the review queue on future updates.

Listed on clauderules.net

Add this badge to your README

Show visitors this server is listed in the ClaudeRules directory. The badge links straight to this listing.

Markdown
[![Listed on clauderules.net](https://clauderules.net/api/badge/io-github-role1776-mcp-x)](https://clauderules.net/mcp/io-github-role1776-mcp-x)
HTML
<a href="https://clauderules.net/mcp/io-github-role1776-mcp-x" target="_blank" rel="noopener noreferrer"><img src="https://clauderules.net/api/badge/io-github-role1776-mcp-x" alt="Listed on clauderules.net" /></a>