X

X MCP AI

by IvanBBaev · io.github.IvanBBaev/x-mcp-ai

Enables MCP clients to interact with the X (Twitter) API v2 through 41 typed tools for reading, searching, engaging, publishing, and managing content, with policy-based access control and session credit budgets to prevent overspending.

npm Local · stdio GlamaOfficial MCP Registry High confidence

Install

Add to ~/Library/Application Support/Claude/claude_desktop_config.json

Windows / Linux path
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "io-github-ivanbbaev-x-mcp-ai": {
      "command": "npx",
      "args": [
        "-y",
        "x-mcp-ai"
      ],
      "env": {
        "X_MCP_AUTH_MODE": "oauth2",
        "X_MCP_CLIENT_ID": "<VALUE>",
        "X_MCP_CLIENT_SECRET": "<YOUR_VALUE>",
        "X_MCP_BEARER_TOKEN": "<YOUR_VALUE>",
        "X_MCP_TOKEN_FILE": "<VALUE>",
        "X_MCP_TOKEN_KEYCHAIN": "0",
        "X_MCP_POLICY": "read-only",
        "X_MCP_POLICY_ALLOW": "<VALUE>",
        "X_MCP_POLICY_DENY": "<VALUE>",
        "X_MCP_HIDE_DENIED": "0",
        "X_MCP_MEDIA_DIR": "<VALUE>",
        "X_MCP_AVAILABILITY": "<VALUE>",
        "X_MCP_PROFILES_FILE": "<VALUE>",
        "X_MCP_PROFILE": "<VALUE>",
        "X_MCP_TIMEOUT_MS": "30000",
        "X_MCP_LOG_LEVEL": "info",
        "X_MCP_CREDIT_BUDGET": "<VALUE>",
        "X_MCP_BUDGET_MODE": "warn",
        "X_MCP_BASE_URL": "https://api.x.com",
        "X_MCP_ALLOW_INSECURE_BASE_URL": "0"
      }
    }
  }
}

Restart Claude Desktop to activate the new server.

Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)

Windows / Linux path
Windows: .cursor\mcp.json (project) or %USERPROFILE%\.cursor\mcp.json (global)
Linux: .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
{
  "mcpServers": {
    "io-github-ivanbbaev-x-mcp-ai": {
      "command": "npx",
      "args": [
        "-y",
        "x-mcp-ai"
      ],
      "env": {
        "X_MCP_AUTH_MODE": "oauth2",
        "X_MCP_CLIENT_ID": "<VALUE>",
        "X_MCP_CLIENT_SECRET": "<YOUR_VALUE>",
        "X_MCP_BEARER_TOKEN": "<YOUR_VALUE>",
        "X_MCP_TOKEN_FILE": "<VALUE>",
        "X_MCP_TOKEN_KEYCHAIN": "0",
        "X_MCP_POLICY": "read-only",
        "X_MCP_POLICY_ALLOW": "<VALUE>",
        "X_MCP_POLICY_DENY": "<VALUE>",
        "X_MCP_HIDE_DENIED": "0",
        "X_MCP_MEDIA_DIR": "<VALUE>",
        "X_MCP_AVAILABILITY": "<VALUE>",
        "X_MCP_PROFILES_FILE": "<VALUE>",
        "X_MCP_PROFILE": "<VALUE>",
        "X_MCP_TIMEOUT_MS": "30000",
        "X_MCP_LOG_LEVEL": "info",
        "X_MCP_CREDIT_BUDGET": "<VALUE>",
        "X_MCP_BUDGET_MODE": "warn",
        "X_MCP_BASE_URL": "https://api.x.com",
        "X_MCP_ALLOW_INSECURE_BASE_URL": "0"
      }
    }
  }
}

Cursor usually picks up config changes automatically; if the server does not appear, reload the window.

Add to .mcp.json (project) or ~/.claude.json (global)

Windows / Linux path
Windows: .mcp.json (project) or %USERPROFILE%\.claude.json (global)
Linux: .mcp.json (project) or ~/.claude.json (global)
{
  "mcpServers": {
    "io-github-ivanbbaev-x-mcp-ai": {
      "command": "npx",
      "args": [
        "-y",
        "x-mcp-ai"
      ],
      "env": {
        "X_MCP_AUTH_MODE": "oauth2",
        "X_MCP_CLIENT_ID": "<VALUE>",
        "X_MCP_CLIENT_SECRET": "<YOUR_VALUE>",
        "X_MCP_BEARER_TOKEN": "<YOUR_VALUE>",
        "X_MCP_TOKEN_FILE": "<VALUE>",
        "X_MCP_TOKEN_KEYCHAIN": "0",
        "X_MCP_POLICY": "read-only",
        "X_MCP_POLICY_ALLOW": "<VALUE>",
        "X_MCP_POLICY_DENY": "<VALUE>",
        "X_MCP_HIDE_DENIED": "0",
        "X_MCP_MEDIA_DIR": "<VALUE>",
        "X_MCP_AVAILABILITY": "<VALUE>",
        "X_MCP_PROFILES_FILE": "<VALUE>",
        "X_MCP_PROFILE": "<VALUE>",
        "X_MCP_TIMEOUT_MS": "30000",
        "X_MCP_LOG_LEVEL": "info",
        "X_MCP_CREDIT_BUDGET": "<VALUE>",
        "X_MCP_BUDGET_MODE": "warn",
        "X_MCP_BASE_URL": "https://api.x.com",
        "X_MCP_ALLOW_INSECURE_BASE_URL": "0"
      }
    }
  }
}

The server will be available in the next Claude Code session.

Add to .vscode/mcp.json

Windows / Linux path
Windows: .vscode\mcp.json
Linux: .vscode/mcp.json
{
  "servers": {
    "io-github-ivanbbaev-x-mcp-ai": {
      "command": "npx",
      "args": [
        "-y",
        "x-mcp-ai"
      ],
      "env": {
        "X_MCP_AUTH_MODE": "oauth2",
        "X_MCP_CLIENT_ID": "<VALUE>",
        "X_MCP_CLIENT_SECRET": "<YOUR_VALUE>",
        "X_MCP_BEARER_TOKEN": "<YOUR_VALUE>",
        "X_MCP_TOKEN_FILE": "<VALUE>",
        "X_MCP_TOKEN_KEYCHAIN": "0",
        "X_MCP_POLICY": "read-only",
        "X_MCP_POLICY_ALLOW": "<VALUE>",
        "X_MCP_POLICY_DENY": "<VALUE>",
        "X_MCP_HIDE_DENIED": "0",
        "X_MCP_MEDIA_DIR": "<VALUE>",
        "X_MCP_AVAILABILITY": "<VALUE>",
        "X_MCP_PROFILES_FILE": "<VALUE>",
        "X_MCP_PROFILE": "<VALUE>",
        "X_MCP_TIMEOUT_MS": "30000",
        "X_MCP_LOG_LEVEL": "info",
        "X_MCP_CREDIT_BUDGET": "<VALUE>",
        "X_MCP_BUDGET_MODE": "warn",
        "X_MCP_BASE_URL": "https://api.x.com",
        "X_MCP_ALLOW_INSECURE_BASE_URL": "0"
      }
    }
  }
}

Reload the VS Code window to activate.

Add to ~/.codeium/windsurf/mcp_config.json

Windows / Linux path
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Linux: ~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "io-github-ivanbbaev-x-mcp-ai": {
      "command": "npx",
      "args": [
        "-y",
        "x-mcp-ai"
      ],
      "env": {
        "X_MCP_AUTH_MODE": "oauth2",
        "X_MCP_CLIENT_ID": "<VALUE>",
        "X_MCP_CLIENT_SECRET": "<YOUR_VALUE>",
        "X_MCP_BEARER_TOKEN": "<YOUR_VALUE>",
        "X_MCP_TOKEN_FILE": "<VALUE>",
        "X_MCP_TOKEN_KEYCHAIN": "0",
        "X_MCP_POLICY": "read-only",
        "X_MCP_POLICY_ALLOW": "<VALUE>",
        "X_MCP_POLICY_DENY": "<VALUE>",
        "X_MCP_HIDE_DENIED": "0",
        "X_MCP_MEDIA_DIR": "<VALUE>",
        "X_MCP_AVAILABILITY": "<VALUE>",
        "X_MCP_PROFILES_FILE": "<VALUE>",
        "X_MCP_PROFILE": "<VALUE>",
        "X_MCP_TIMEOUT_MS": "30000",
        "X_MCP_LOG_LEVEL": "info",
        "X_MCP_CREDIT_BUDGET": "<VALUE>",
        "X_MCP_BUDGET_MODE": "warn",
        "X_MCP_BASE_URL": "https://api.x.com",
        "X_MCP_ALLOW_INSECURE_BASE_URL": "0"
      }
    }
  }
}

Restart Windsurf (or refresh its MCP servers panel) to activate the new server.

Windsurf Next uses ~/.codeium/windsurf-next/mcp_config.json. Devin Desktop (the Windsurf rebrand) uses ~/.config/devin/mcp_config.json and imports the Windsurf file.

Add to ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Windows / Linux path
Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
  "mcpServers": {
    "io-github-ivanbbaev-x-mcp-ai": {
      "command": "npx",
      "args": [
        "-y",
        "x-mcp-ai"
      ],
      "env": {
        "X_MCP_AUTH_MODE": "oauth2",
        "X_MCP_CLIENT_ID": "<VALUE>",
        "X_MCP_CLIENT_SECRET": "<YOUR_VALUE>",
        "X_MCP_BEARER_TOKEN": "<YOUR_VALUE>",
        "X_MCP_TOKEN_FILE": "<VALUE>",
        "X_MCP_TOKEN_KEYCHAIN": "0",
        "X_MCP_POLICY": "read-only",
        "X_MCP_POLICY_ALLOW": "<VALUE>",
        "X_MCP_POLICY_DENY": "<VALUE>",
        "X_MCP_HIDE_DENIED": "0",
        "X_MCP_MEDIA_DIR": "<VALUE>",
        "X_MCP_AVAILABILITY": "<VALUE>",
        "X_MCP_PROFILES_FILE": "<VALUE>",
        "X_MCP_PROFILE": "<VALUE>",
        "X_MCP_TIMEOUT_MS": "30000",
        "X_MCP_LOG_LEVEL": "info",
        "X_MCP_CREDIT_BUDGET": "<VALUE>",
        "X_MCP_BUDGET_MODE": "warn",
        "X_MCP_BASE_URL": "https://api.x.com",
        "X_MCP_ALLOW_INSECURE_BASE_URL": "0"
      }
    }
  }
}

Cline reloads cline_mcp_settings.json automatically; if the server does not appear, reload the VS Code window.

Open it from Cline's MCP Servers panel → Configure. Roo Code uses a different file and format.

Configuration

Environment variables this server reads. Secrets stay on your machine.

NameRequiredDescription
X_MCP_AUTH_MODE No oauth2 | app-only. Default: oauth2
X_MCP_CLIENT_ID No OAuth 2.0 client ID (required for authorize and refresh).
X_MCP_CLIENT_SECRET secret No OAuth 2.0 client secret (confidential clients only).
X_MCP_BEARER_TOKEN secret No App-only bearer token; valid only with app-only.
X_MCP_TOKEN_FILE No Path to the rotating OAuth 2.0 token store (~ expanded).
X_MCP_TOKEN_KEYCHAIN No 1 → store tokens in the OS keychain (macOS security, Linux secret-tool). Mutually exclusive with X_MCP_TOKEN_FILE. Default: 0
X_MCP_POLICY No Preset: read-only | engage | publish | manage | full. Default: read-only
X_MCP_POLICY_ALLOW No Comma-separated operation:domain cells to add.
X_MCP_POLICY_DENY No Comma-separated cells to remove (wins over allow and preset).
X_MCP_HIDE_DENIED No 1 → drop denied tools from registration entirely. Default: 0
X_MCP_MEDIA_DIR No Directory uploads must realpath inside (media default-deny).
X_MCP_AVAILABILITY No Comma-separated availability classes to enable (pilot, premium-user, enterprise).
X_MCP_PROFILES_FILE No Multi-account profiles file.
X_MCP_PROFILE No Active profile name (required with a profiles file).
X_MCP_TIMEOUT_MS No Per-request timeout, milliseconds. Default: 30000
X_MCP_LOG_LEVEL No silent | error | info | debug. Default: info
X_MCP_CREDIT_BUDGET No Session spend cap, USD (e.g. 5.00). Unset = no cap.
X_MCP_BUDGET_MODE No warn | hard. Default: warn
X_MCP_BASE_URL No API base URL; must be https:// and *.x.com. Default: https://api.x.com
X_MCP_ALLOW_INSECURE_BASE_URL No 1 → permit a non-x.com base URL (testing only). Default: 0

Similar servers