# X-Use - X (Twitter) 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.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 178
- Author: ihuzaifashoukat
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/ihuzaifashoukat/x-use
- Updated: 2026-10-19
- HTML: https://affpapa.org/en/nevibecode/mcp/x-use-x-twitter-mcp-server

## What it 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.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `X_USE_HOME`, `OPENAI_API_KEY`, `OPENAI_BASE_URL` — keys and tokens: ask the human for the values, never commit them or put them in shared files.
- Works with: Chrome

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
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
```
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>

### Codex

**Platform CLI**
```bash
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-mcp
```
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>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "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>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "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>

### Gemini CLI

**Platform CLI**
```bash
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-mcp
```
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>

## When to use it
- 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
- Check account status with `get_account_health` and 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.

## Similar
- [Scrapling MCP Server](https://affpapa.org/en/nevibecode/mcp/scrapling-mcp-server.md) — MCP server · ★ 89433
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [AIHawk](https://affpapa.org/en/nevibecode/mcp/aihawk.md) — MCP server · ★ 32221
- [Skyvern](https://affpapa.org/en/nevibecode/mcp/skyvern.md) — MCP server · ★ 23263
- [SeleniumBase MCP](https://affpapa.org/en/nevibecode/mcp/seleniumbase-mcp.md) — MCP server · ★ 13169
- [apify-mcp-server](https://affpapa.org/en/nevibecode/mcp/apify-mcp-server.md) — MCP server · ★ 12927

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
