xmcp
MCP server for the X API
The X API MCP server transforms the X (formerly Twitter) platform API into tool calls accessible to AI agents through the Model Context Protocol. Built with FastMCP and Python, it exposes over 150 X API operations—from posting and searching tweets to managing direct messages, lists, communities, and media—as structured tools. Developers can whitelist specific operations, authenticate via OAuth1 or OAuth2, and connect any MCP-compatible client to programmatically interact with X through natural language instructions.
Key Features
Use Cases
- 01Automate posting, replying, and content scheduling on X through AI agent workflows
- 02Search recent or all posts matching criteria and analyze sentiment or trends
- 03Manage followers, muting, blocking, and direct messages programmatically via natural language
- 04Retrieve analytics for posts and media to inform content strategy decisions
- 05Integrate X community moderation and Community Notes creation into agent toolchains
- 06Build conversational agents that query user profiles, timelines, and bookmarks on demand
Related MCP Servers
View moremarkitdown
Python tool for converting files and office documents to Markdown.
firecrawl
The context API to search, scrape, and interact with the web at scale. 🔥
prompts.chat
f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.
langflow
Langflow is a powerful tool for building and deploying AI-powered agents and workflows.
xmcp — FAQ
What is the X API MCP server?+
It's a Model Context Protocol server that wraps the X (Twitter) API, allowing AI agents and assistants to post, search, message, and manage X accounts through structured tool calls instead of direct API integration.
How do I install and run the X MCP server?+
Clone the repository, create a Python 3.9+ virtual environment, install dependencies with pip, copy env.example to .env and fill in your X API credentials, register the OAuth callback URL in your X Developer app, then run python server.py. The MCP endpoint defaults to http://127.0.0.1:8000/mcp.
What API keys and credentials are required?+
You must create an app in the X Developer Platform to obtain X_OAUTH_CONSUMER_KEY, X_OAUTH_CONSUMER_SECRET, and X_BEARER_TOKEN. Optionally, you can provide CLIENT_ID and CLIENT_SECRET for OAuth2, or an XAI_API_KEY to test with the Grok client.
Which MCP clients work with this server?+
Any MCP-compatible client that supports HTTP connections can connect by pointing to http://127.0.0.1:8000/mcp or a tunneled URL. The repository includes an optional Grok test client for validation.
Is the X MCP server free to use?+
The server code is open source and free. However, using the X API itself may require a paid X Developer Platform subscription depending on your tier and usage volume.
Can I limit which X API operations are exposed as tools?+
Yes, set the X_API_TOOL_ALLOWLIST environment variable to a comma-separated list of operation names (e.g., getUsersByUsername,createPosts,searchPostsRecent) to load only those tools at startup.
How do I install xmcp?+
Open the source repository on GitHub and follow its README. xmcp is a mcp server — MCP Agents Market links you directly to the official repo.
Is xmcp free?+
xmcp is an open-source project hosted on GitHub. Check the repository for its license and any usage requirements.