
Grok Mcp
io.github.howardpen9由 GitHub 帳號 howardpen9 發布v0.2.0更新於 Oct 24, 2026
Use xAI Grok as a peer reviewer + PR gate from Claude Code, Cursor, Cline and any MCP host.
發布方自己的服務:Surface
概覽
讓編碼助理把程式碼審查、缺陷排查與第二意見交給 xAI 的 Grok,可透過 xAI API 或 Grok CLI 呼叫。
- 可以做什麼
- 向 Grok 提出一次性問題並取得回覆
- 審查統一 diff 或本機 git diff(對比基準分支),給出結論與各面向評分
- 針對程式碼片段排查缺陷、競態、邊界情況與安全性問題,並依嚴重程度排序
- 進行多輪諮詢,由呼叫方傳入完整訊息歷史
- 審查結果可輸出為 Markdown 或供 CI 判定的 JSON
- 適用情境
- 適合希望由另一個模型複核助理自身產出、找出單一模型迴圈容易漏掉的問題,或依 Grok 結論對 PR 做閘門的場景。可用於 Claude Code、Cursor、Cline 等 MCP 宿主。
- 執行需求
- 需要 Node.js 18 或更新版本,透過 npx 或全域 npm 安裝後在本機執行。需要 console.x.ai 的 XAI_API_KEY(API 模式,建議使用),或安裝 Grok CLI 並以瀏覽器 OAuth 登入。選用環境變數可指定後端、模型、基礎 URL、二進位檔路徑與逾時。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Grok Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[grok-mcp — MCP server that lets Claude use Grok as a peer reviewer and second-opinion consultant]
grok-mcp
Use Grok as a peer code reviewer and rigorous second-opinion consultant inside Claude Code, Cursor, Cline, OpenClaw, and any other MCP host — talking to xAI's API directly (just an
XAI_API_KEY, no install) or via the official Grok CLI.
grok-mcp (npm: grok-cli-mcp) is a Model Context Protocol server for Grok. It gives your primary agent (Claude, Cursor, etc.) four tools so it can delegate to Grok for high-quality second opinions and rigorous validation without leaving the session. As of v0.3.0 it talks to xAI's API directly — no grok binary required — and still supports the CLI for OAuth users:
grok_review— structured diff review with per-dimension scoresgrok_challenge— thorough analysis for bugs, races, edge cases and security issuesgrok_consult— multi-turn consultation (caller owns history)grok_chat— one-shot questions
English | 繁體中文
Why grok-mcp?
Most "Grok MCP" packages expose Grok's chat/search/image capabilities so Claude can use Grok. grok-mcp lets your main coding agent (Claude/Cursor/…) ask Grok for a rigorous second opinion on its own work. A different model providing thorough review often catches issues that single-model loops miss.
What you get
Four tools, all stateless, all stdout-only:
Prerequisites
- Node.js ≥ 18
- A backend (the server picks one automatically — see Backends):
- API mode (recommended, zero install): an
XAI_API_KEYfrom console.x.ai. The server calls xAI's HTTP API directly — no extra binary needed. - CLI mode: the Grok CLI installed, used when no
XAI_API_KEYis set: Then authenticate with browser OAuth (rungrokonce interactively). See Authentication below.
- API mode (recommended, zero install): an
Install
Why the npm name is
grok-cli-mcpinstead ofgrok-mcp? The baregrok-mcpname on npm was already taken by an unrelated project (a Grok HTTP-API integration). The brand, GitHub repo, and MCP server identity staygrok-mcp; only the npm install identifier isgrok-cli-mcp— chosen to highlight that this server wraps the official Grok CLI.
Authentication
There are two auth methods, each tied to a backend:
Setting XAI_API_KEY switches the server to API mode, so you can keep your browser login for interactive grok use and use a key just for this MCP server via its env block:
Treat the key file as a secret — it ends up in your MCP host's config (e.g. ~/.claude.json), which is plain JSON on disk.
Wire it into your MCP host
Claude Code
Recommended — use add-json so the env block parses cleanly:
Why
add-jsonnotclaude mcp add -e ...? The-e KEY=valflag is variadic and will greedily consume the server name as another env value if you pass more than one.add-jsonsidesteps that footgun entirely.
Or edit ~/.claude.json directly. Minimal (OAuth fallback):
Cursor
Create .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):
Cline (VS Code)
Settings → Cline → MCP Servers:
Claude Desktop (local, no hosting needed)
Claude Desktop still supports local stdio servers: Settings → Developer → Edit Config (claude_desktop_config.json), then paste the same JSON block as Claude Code above.
Claude Web / Claude Desktop connectors (remote, v0.4+)
Claude's Settings → Connectors → Add custom connector dialog needs an HTTPS URL, not a command — so deploy the bundled Streamable HTTP server and paste its URL:
Then add the connector in Claude with the URL:
No OAuth needed — leave the Client ID/Secret fields blank. Claude only starts an OAuth flow if the server asks for it.
Remote-mode notes:
- Treat the URL as a credential. The path secret is what stands between the internet and your xAI bill. Rotate it by changing the env var.
grok_reviewneeds an explicitdiffover HTTP — the server can't see your local repo, so autogit diffis disabled in remote mode.- Keep
GROK_MCP_TIMEOUTbelow your platform's request timeout (and disable scale-to-zero) — grok-4 reasoning can run for minutes. GET /healthis available for platform health checks; see.env.examplefor all knobs (GROK_MCP_ALLOWED_HOSTS,GROK_MCP_CORS_ORIGINS, ...).
Any other MCP host
grok-mcp speaks plain stdio MCP. Point any client at npx -y grok-cli-mcp and it works. HTTP hosts can point at the remote endpoint above instead.
Tool reference
grok_chat
Optional: model to override the default Grok model; timeout (seconds) to extend the per-call limit for long grok-4 reasoning. All four tools accept timeout.
grok_review
If diff is omitted, runs git diff <base_ref>...HEAD in cwd (defaults to your host's working directory). Returns a markdown review by default with verdict, per-dimension scores (correctness / readability / architecture / security / performance), and concrete fix-it items.
Pass "format": "json" to get machine-parseable output suitable for CI gating — see Use as a PR gate.
grok_consult
The server is stateless — the caller passes the full thread each time. Most MCP hosts handle this naturally.
grok_challenge
Returns severity-ranked issues (Critical / High / Medium / Low) with concrete reproductions and patches.
Configuration
Backends
The server can reach Grok two ways and chooses one at startup (it logs which to stderr):
- API mode — calls xAI's OpenAI-compatible
/chat/completionsendpoint directly using Node's built-infetch. Nogrokbinary required, cleaner errors, pay-per-call. Selected whenXAI_API_KEYis set, or forced withGROK_MCP_BACKEND=api. - CLI mode — shells out to the installed
grokbinary (supports browser OAuth). Selected when noXAI_API_KEYis set, or forced withGROK_MCP_BACKEND=cli.
Force a mode with GROK_MCP_BACKEND. In API mode, set the model with GROK_MCP_MODEL; in CLI mode, model defaults live in ~/.grok/config.toml.
Timeouts
grok-4 is a reasoning model and long prompts routinely take longer than two minutes. The server's default per-call limit is 300s (5 min). You can change it three ways:
- Per call — pass
timeout(seconds) to any tool:{ "prompt": "...", "timeout": 600 }. - Per server — set
GROK_MCP_TIMEOUT(milliseconds) in the MCP server's env. - Host side — the MCP host has its own request timeout that can fire before the server's. If calls still time out after raising the above, raise the host limit too. In Claude Code that's
MCP_TIMEOUT(server startup) andMCP_TOOL_TIMEOUT(per tool call), both in milliseconds.
On timeout the error includes any partial output Grok produced before the deadline, so you don't lose a near-complete answer.
Use as a PR gate (CI)
grok-mcp ships a grok-review-ci bin and a composite GitHub Action so Grok can review every PR and fail the check on block.
Drop this into .github/workflows/grok-review.yml in your repo:
The action posts a sticky PR comment with verdict + per-dimension scores + concrete blockers, and exits non-zero (failing the check) when the verdict matches gate-on. Full example with comments: examples/workflows/grok-review.yml.
Want JSON straight from the tool instead? Pass format: "json" to grok_review — same schema as the bin emits, suitable for any pipeline:
Roadmap
- v0.1 — four stateless tools, stdio transport
- Discoverability push (v0.1.3, shipped) — naming unification, MCP Registry, Smithery, glama.ai, stronger positioning. See
docs/improvement-plan.mdandCHANGELOG.md. - v0.2 (shipped) —
grok_reviewJSON mode +grok-review-cibin + GitHub Action for PR gating. - v0.3 (shipped) — direct xAI API backend (no
grokCLI required);GROK_MCP_BACKENDapi/cli/auto. - v0.4 (current) — remote MCP mode:
grok-mcp-httpStreamable HTTP server for Claude Web / Claude Desktop custom connectors, with path-secret auth, Dockerfile, and.env.example. - v0.5 — server-side session persistence so
grok_consultcan take aconversation_id - v0.6 — streaming responses through MCP
progressnotifications; OAuth + per-user key store for shared hosted instances
Development
Contact
Bug reports & feature requests → GitHub issues. DMs welcome on X: @0xHoward_Peng.
License
MIT
來源:README.md,提交 4386c44
工具
0版本歷史
1- v0.2.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Grok 整合

Surface
me.grok.nova-otter-delta-cloud官方發布者
遠端 MCP 伺服器,用來展開短連結,並在助理開啟使用者貼上的網址前給出 fetch 或 skip 的判斷。
Grok Crypto Quant API
dev.fly.grok-backtest-api官方發布者
遠端 MCP 伺服器,提供按次付費的加密量化工具:無倖存者偏差回測、每日市場訊號、策略參數最佳化與代幣詐騙檢查。

Server Track Lab
由 GitHub 帳號 Surface-ops 發布
將伺服器端轉換事件送往廣告平台(Meta 即時、Google 與 LinkedIn 僅預覽),並查看工作區事件統計。

API Meter
由 GitHub 帳號 Surface-ops 發布
API Meter 依客戶、端點與方案統計 API 請求量,讓助理註冊 API、取得接入程式碼並讀取或匯出用量。
three.ws for Grok
由 GitHub 帳號 nirholas 發布
three.ws 遠端伺服器,讓助理依文字或圖片生成、綁定骨架、迭代與檢視 3D 模型和虛擬形象,並賦予其可持續沿用的代理人格。