Back to MCP Servers
X MCP logo
mcp-server4

X MCP

X MCP 是 X 官方託管的 Model Context Protocol 伺服器,可讓相容 MCP 的 AI 工具呼叫 X API 端點。它透過 xurl 橋接 OAuth 使用者情境,支援貼文搜尋、使用者查詢、書籤、趨勢、新聞和 Articles 等工作流程。

X MCP preview

About

X MCP 是 X 官方託管的 MCP 伺服器,用於把相容 MCP 的 AI 工具連接到 X API。X 文件將 API MCP 端點標示為 https://api.x.com/mcp ;本地 stdio 用戶端通常透過開源的 xurl mcp 橋接連線。

本條目對應 X API MCP 伺服器,不是單獨用於文件搜尋的 X Docs MCP,也不是名稱相近的社群 Twitter/X MCP 專案。

Key Features

  • 讓相容 MCP 的工具以使用者的 X 帳號權限呼叫 X API 能力。
  • 官方文件列出的能力範圍包括 posts、full-archive search、user search、user lookup、timelines、mentions、bookmarks、bookmark folders、news、trends 和 Articles。
  • 使用 xurl 完成 OAuth 2.0 使用者情境驗證、token 快取和更新。
  • 對可附加靜態 Bearer token 的用戶端,文件也說明了用於讀取端點的 app-only direct URL 模式。

Use Cases

  • 需要即時 X 搜尋或使用者情境的社群監聽與研究工作流程。
  • 由智能代理輔助處理書籤、時間軸查詢、mentions 複查和 Article 草稿。
  • 在 AI 工具裡快速原型化 X API 操作,同時保持連接到 X 官方文件描述的 API 面。

Setup or Requirements

X MCP 需要 X Developer Platform 帳號和啟用 OAuth 的 X app。詳細命令、設定區塊和授權流程見 mcpSetup

Compatibility

X 官方文件提供了 Grok Build、Cursor、Claude Desktop、VS Code with GitHub Copilot Agent mode 以及通用 MCP 用戶端的設定路徑。已檢查的官方 X MCP 頁面未確認 Claude Code、Codex、Windsurf 和 Lovable 的獨立公開設定說明。

Limitations

託管的 X API MCP 伺服器依賴 X API 存取權限、app 設定、OAuth scopes、速率限制和帳號權限。部分操作可能需要特定 API package、Production environment enrollment 或合適的 scopes。

官方頁面說明了能力範圍和設定路徑,但未確認穩定完整的所有 MCP tool 名稱清單。

Sources

  • Official X MCP documentation: https://docs.x.com/tools/mcp
  • X Agent Resources: https://docs.x.com/tools/ai
  • xurl GitHub repository: https://github.com/xdevplatform/xurl
  • X API OpenAPI specification: https://api.x.com/2/openapi.json

MCP Setup

Prerequisites

  • Node.js installed for npx
  • X Developer Platform account
  • OAuth 2.0-enabled X app
  • Redirect URI registered on the X app, default http://localhost:8080/callback
  • CLIENT_ID and CLIENT_SECRET from the X app

Access requirements

  • First-run OAuth 2.0 browser sign-in for user-context access
  • xurl caches and refreshes tokens under ~/.xurl
  • X API access, scopes, app package, environment, and rate limits apply
  • App-only direct URL mode is documented for read endpoints only

Companion app or plugin

Name: xurl CLI / @xdevplatform/xurl Install URL: https://github.com/xdevplatform/xurl

  • Use npx in the MCP client config, or install xurl with Homebrew, npm, shell script, or Go.
  • Run xurl mcp as the local stdio bridge to https://api.x.com/mcp.

xurl handles OAuth, token caching, token refresh, and Bearer-token injection for the hosted X MCP endpoint.

Client setup

Grok Build

Transport: stdio

grok mcp add xapi npx -e CLIENT_ID=YOUR_X_APP_CLIENT_ID -e CLIENT_SECRET=YOUR_X_APP_CLIENT_SECRET -- -y @xdevplatform/xurl mcp https://api.x.com/mcp
[mcp_servers.xapi]
command = "npx"
args = ["-y", "@xdevplatform/xurl", "mcp", "https://api.x.com/mcp"]
enabled = true
startup_timeout_sec = 300

[mcp_servers.xapi.env]
CLIENT_ID = "YOUR_X_APP_CLIENT_ID"
CLIENT_SECRET = "YOUR_X_APP_CLIENT_SECRET"
  • Run the documented grok mcp add command or edit ~/.grok/config.toml.
  • Verify with grok mcp doctor xapi and grok mcp list.

Auth:

  • Complete the first-run X OAuth browser login.

Documented by X for Grok Build.

Cursor

Transport: stdio

npx -y @xdevplatform/xurl mcp https://api.x.com/mcp
{"mcpServers":{"xapi":{"command":"npx","args":["-y","@xdevplatform/xurl","mcp","https://api.x.com/mcp"],"env":{"CLIENT_ID":"YOUR_X_APP_CLIENT_ID","CLIENT_SECRET":"YOUR_X_APP_CLIENT_SECRET"}}}}
  • Create ~/.cursor/mcp.json or .cursor/mcp.json.
  • Open Cursor Settings > MCP and confirm xapi is connected.

Auth:

  • Complete the first-run X OAuth browser login.

Documented by X for Cursor.

Claude Desktop

Transport: stdio

npx -y @xdevplatform/xurl mcp https://api.x.com/mcp
{"mcpServers":{"xapi":{"command":"npx","args":["-y","@xdevplatform/xurl","mcp","https://api.x.com/mcp"],"env":{"CLIENT_ID":"YOUR_X_APP_CLIENT_ID","CLIENT_SECRET":"YOUR_X_APP_CLIENT_SECRET"}}}}
  • Edit claude_desktop_config.json and restart Claude Desktop.

Auth:

  • Complete the first-run X OAuth browser login.

Documented by X for Claude Desktop.

VS Code

Transport: stdio

npx -y @xdevplatform/xurl mcp https://api.x.com/mcp
{"servers":{"xapi":{"type":"stdio","command":"npx","args":["-y","@xdevplatform/xurl","mcp","https://api.x.com/mcp"],"env":{"CLIENT_ID":"YOUR_X_APP_CLIENT_ID","CLIENT_SECRET":"YOUR_X_APP_CLIENT_SECRET"}}}}
  • Add the server to .vscode/mcp.json for GitHub Copilot Agent mode.

Auth:

  • Complete the first-run X OAuth browser login.

Documented by X for VS Code with GitHub Copilot Agent mode.

Claude Code

Exact public Claude Code setup is not documented on the checked official X MCP page.

Codex

Exact public Codex setup is not documented on the checked official X MCP page.

Windsurf

Exact public Windsurf setup is not documented on the checked official X MCP page.

Lovable

Exact public Lovable setup is not documented on the checked official X MCP page.

Other

Transport: stdio

npx -y @xdevplatform/xurl mcp https://api.x.com/mcp
{"mcpServers":{"xapi":{"command":"npx","args":["-y","@xdevplatform/xurl","mcp","https://api.x.com/mcp"],"env":{"CLIENT_ID":"YOUR_X_APP_CLIENT_ID","CLIENT_SECRET":"YOUR_X_APP_CLIENT_SECRET"},"startup_timeout_sec":300}}}
  • Use the universal stdio MCP configuration in any compatible client.
  • Set startup timeout to 300 seconds or more if supported.

Auth:

  • Complete the first-run browser OAuth flow.
  • For headless machines, authenticate first with xurl auth oauth2 --headless.

If xurl is installed natively, X documents replacing command npx with command xurl and args ["mcp", "https://api.x.com/mcp"].

Other

Transport: HTTP

{"mcpServers":{"xapi_direct":{"url":"https://api.x.com/mcp","headers":{"Authorization":"Bearer YOUR_APP_ONLY_BEARER_TOKEN"}}}}
  • Use only with MCP clients that support remote MCP endpoints with custom headers.

Auth:

  • Provide an app-only Bearer token from the X Developer Platform.

Read-endpoint trade-off: no auto-refresh and no user context. The xurl bridge is recommended for full functionality.

Authorization flow

  • Create an OAuth 2.0-enabled X app in the X Developer Portal.
  • Register http://localhost:8080/callback or set and register REDIRECT_URI.
  • Set CLIENT_ID and CLIENT_SECRET in the MCP client environment or register them in xurl.
  • Start the MCP client and complete the one-time browser OAuth flow.
  • For headless hosts, run xurl auth oauth2 --headless first.

Environment variables

  • CLIENT_ID
  • CLIENT_SECRET
  • REDIRECT_URI optional
  • AUTH_URL optional
  • TOKEN_URL optional
  • API_BASE_URL optional
  • INFO_URL optional

Setup docs: https://docs.x.com/tools/mcp

Tags

MCPX APITwittersocial mediaOAuthstdiohosted

Alternatives

Comparable tools and resources explicitly connected to X MCP.

X Docs MCPxdevplatform/xmcpX Twitter MCP ServerGetXAPI MCP ServerTwitterAPI.io MCP

Related Entries

Keep exploring similar tools and resources in this category.

Browse MCP Servers