# X (Twitter)

> X (Twitter) is an open-source MCP server. Search, read and publish X posts and manage users, lists and media via the X API v2. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Repository:** https://github.com/role1776/mcp-x
- **MCP Registry name:** io.github.Role1776/mcp-x
- **Listing updated:** 2026-11-13

## About

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

## Install

### Claude Code (Terminal)

```sh
claude mcp add mcp-x --env X_API_KEY='<X_API_KEY>' --env X_API_KEY_SECRET='<X_API_KEY_SECRET>' --env X_ACCESS_TOKEN='<X_ACCESS_TOKEN>' --env X_ACCESS_TOKEN_SECRET='<X_ACCESS_TOKEN_SECRET>' --env MEDIA_ROOT='<MEDIA_ROOT>' -- 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 ghcr.io/role1776/mcp-x:0.1.1
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mcp-x": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "X_API_KEY",
        "-e",
        "X_API_KEY_SECRET",
        "-e",
        "X_ACCESS_TOKEN",
        "-e",
        "X_ACCESS_TOKEN_SECRET",
        "-e",
        "MEDIA_ROOT",
        "ghcr.io/role1776/mcp-x:0.1.1"
      ],
      "env": {
        "X_API_KEY": "<X_API_KEY>",
        "X_API_KEY_SECRET": "<X_API_KEY_SECRET>",
        "X_ACCESS_TOKEN": "<X_ACCESS_TOKEN>",
        "X_ACCESS_TOKEN_SECRET": "<X_ACCESS_TOKEN_SECRET>",
        "MEDIA_ROOT": "<MEDIA_ROOT>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mcp-x": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "X_API_KEY",
        "-e",
        "X_API_KEY_SECRET",
        "-e",
        "X_ACCESS_TOKEN",
        "-e",
        "X_ACCESS_TOKEN_SECRET",
        "-e",
        "MEDIA_ROOT",
        "ghcr.io/role1776/mcp-x:0.1.1"
      ],
      "env": {
        "X_API_KEY": "<X_API_KEY>",
        "X_API_KEY_SECRET": "<X_API_KEY_SECRET>",
        "X_ACCESS_TOKEN": "<X_ACCESS_TOKEN>",
        "X_ACCESS_TOKEN_SECRET": "<X_ACCESS_TOKEN_SECRET>",
        "MEDIA_ROOT": "<MEDIA_ROOT>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "mcp-x": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "X_API_KEY",
        "-e",
        "X_API_KEY_SECRET",
        "-e",
        "X_ACCESS_TOKEN",
        "-e",
        "X_ACCESS_TOKEN_SECRET",
        "-e",
        "MEDIA_ROOT",
        "ghcr.io/role1776/mcp-x:0.1.1"
      ],
      "env": {
        "X_API_KEY": "<X_API_KEY>",
        "X_API_KEY_SECRET": "<X_API_KEY_SECRET>",
        "X_ACCESS_TOKEN": "<X_ACCESS_TOKEN>",
        "X_ACCESS_TOKEN_SECRET": "<X_ACCESS_TOKEN_SECRET>",
        "MEDIA_ROOT": "<MEDIA_ROOT>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "mcp-x": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "X_API_KEY",
        "-e",
        "X_API_KEY_SECRET",
        "-e",
        "X_ACCESS_TOKEN",
        "-e",
        "X_ACCESS_TOKEN_SECRET",
        "-e",
        "MEDIA_ROOT",
        "ghcr.io/role1776/mcp-x:0.1.1"
      ],
      "env": {
        "X_API_KEY": "<X_API_KEY>",
        "X_API_KEY_SECRET": "<X_API_KEY_SECRET>",
        "X_ACCESS_TOKEN": "<X_ACCESS_TOKEN>",
        "X_ACCESS_TOKEN_SECRET": "<X_ACCESS_TOKEN_SECRET>",
        "MEDIA_ROOT": "<MEDIA_ROOT>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mcp-x": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "X_API_KEY",
        "-e",
        "X_API_KEY_SECRET",
        "-e",
        "X_ACCESS_TOKEN",
        "-e",
        "X_ACCESS_TOKEN_SECRET",
        "-e",
        "MEDIA_ROOT",
        "ghcr.io/role1776/mcp-x:0.1.1"
      ],
      "env": {
        "X_API_KEY": "<X_API_KEY>",
        "X_API_KEY_SECRET": "<X_API_KEY_SECRET>",
        "X_ACCESS_TOKEN": "<X_ACCESS_TOKEN>",
        "X_ACCESS_TOKEN_SECRET": "<X_ACCESS_TOKEN_SECRET>",
        "MEDIA_ROOT": "<MEDIA_ROOT>"
      }
    }
  }
}
```

## FAQ

### Is X (Twitter) free?

Yes. X (Twitter) is open source, so you can use and self-host it for free.

### How do I add X (Twitter) to Claude Code?

Run this command in your terminal: claude mcp add mcp-x --env X_API_KEY='<X_API_KEY>' --env X_API_KEY_SECRET='<X_API_KEY_SECRET>' --env X_ACCESS_TOKEN='<X_ACCESS_TOKEN>' --env X_ACCESS_TOKEN_SECRET='<X_ACCESS_TOKEN_SECRET>' --env MEDIA_ROOT='<MEDIA_ROOT>' -- 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 ghcr.io/role1776/mcp-x:0.1.1

## Where this comes from

- Description: from the official MCP Registry entry.
- Install steps: from the official MCP Registry entry.

---
Source: https://ai-powered.com/mcp/x-twitter-2
