X-Use - X (Twitter) MCP Server — Claude Code MCP server
Connects AI clients to X for profile lookups, direct message management, and drafted posts through a local browser session without developer API tokens.
claude mcp add --env X_USE_HOME=<X_USE_HOME> --env OPENAI_API_KEY=<OPENAI_API_KEY> --env OPENAI_BASE_URL=<OPENAI_BASE_URL> --transport stdio x-use-x-twitter-mcp-server -- uvx x-use-mcpWhat X-Use - X (Twitter) MCP Server does
This package links assistants like Claude Code, Codex, or Cursor to X by automating a local Chromium instance via patchright. You do not need official platform tokens because the tool loads existing login cookies from an exported JSON file. Accounts and operational files reside in the path assigned to X_USE_HOME.
Version 3.2.0 includes 82 discrete tools. It handles tasks like reading discussion threads, checking incoming message folders, and queuing outreach campaigns. To avoid unintended posts, outgoing replies and tweets stay in a staging area until you explicitly confirm publication with approve_draft.
The server will not operate unless you install Chromium and import a valid web session cookie beforehand. An OpenAI-compatible API key is optional and only used if you rely on built-in server generation instead of client reasoning.
What it helps with
- inspect public feeds and profiles to collect reply context
- manage direct message folders and notifications without platform keys
- stage outgoing tweets and threads for mandatory human sign-off
- track prospective contacts and opt-out preferences locally
Example prompts for the agent
- Check account status with
get_account_healthand inspect recent inbox conversations. - Gather recent posts from this handle and create a draft response without publishing it.
- Pull the thread context for this post and stage an answer for my review.
How to install X-Use - X (Twitter) MCP Server
Platform CLI
claude mcp add --env X_USE_HOME=<X_USE_HOME> --env OPENAI_API_KEY=<OPENAI_API_KEY> --env OPENAI_BASE_URL=<OPENAI_BASE_URL> --transport stdio x-use-x-twitter-mcp-server -- uvx x-use-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from x-use-mcp <command>
Platform CLI
codex mcp add x-use-x-twitter-mcp-server --env X_USE_HOME=<X_USE_HOME> --env OPENAI_API_KEY=<OPENAI_API_KEY> --env OPENAI_BASE_URL=<OPENAI_BASE_URL> -- uvx x-use-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from x-use-mcp <command>
Config file
{
"mcpServers": {
"x-use-x-twitter-mcp-server": {
"command": "uvx",
"args": [
"x-use-mcp"
],
"env": {
"X_USE_HOME": "<X_USE_HOME>",
"OPENAI_API_KEY": "<OPENAI_API_KEY>",
"OPENAI_BASE_URL": "<OPENAI_BASE_URL>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from x-use-mcp <command>
Config file
{
"servers": {
"x-use-x-twitter-mcp-server": {
"type": "stdio",
"command": "uvx",
"args": [
"x-use-mcp"
],
"env": {
"X_USE_HOME": "<X_USE_HOME>",
"OPENAI_API_KEY": "<OPENAI_API_KEY>",
"OPENAI_BASE_URL": "<OPENAI_BASE_URL>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from x-use-mcp <command>
Platform CLI
gemini mcp add -e X_USE_HOME=<X_USE_HOME> -e OPENAI_API_KEY=<OPENAI_API_KEY> -e OPENAI_BASE_URL=<OPENAI_BASE_URL> x-use-x-twitter-mcp-server uvx x-use-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from x-use-mcp <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about X-Use - X (Twitter) MCP Server
How do I install X-Use - X (Twitter) MCP Server in Claude Code?
Run `claude mcp add --env X_USE_HOME=<X_USE_HOME> --env OPENAI_API_KEY=<OPENAI_API_KEY> --env OPENAI_BASE_URL=<OPENAI_BASE_URL> --transport stdio x-use-x-twitter-mcp-server -- uvx x-use-mcp` in your command line.
Does X-Use require an official Twitter API subscription?
No official API access is needed. The tool relies on your authenticated browser session and Chromium to interact with the platform.
Can the AI publish posts automatically?
Publishing tools stage messages as drafts by default. A tweet is only posted to the platform once you trigger the approve_draft tool.