Skip to main content
Glama
grok-mcp

grok-mcp

by TuTouPower

grok-mcp

把本机 Grok Build 的 grok-bridge.mjs 暴露为 MCP stdio server,任意支持 MCP 的 code agent(Claude Code / OpenCode / …)可调用。

MCP client
  │ stdio
  ▼
grok-mcp
  │
  ▼
grok-bridge.mjs → grok headless

不是 Claude Code 插件本体;不打包 slash commands / hooks。只包 bridge CLI。

工具

Tool

Bridge

说明

grok_check

check --json

就绪探测(node / grok / auth)

grok_run

run …

主路径;background / write / model / effort

grok_runs

runs --json

列表或指定 run

grok_show

show --json

状态/结果

grok_stop

stop --json

取消

grok_bridge_path

—

解析到的 bridge 路径

审阅类任务:write=false(默认),需要改文件时再 write=true。

Related MCP server: grok-mcp

前置

  • Node ≥ 18

  • 本机已装 grok CLI 并登录(grok / bridge check 通过)

  • 可找到 grok-bridge.mjs(见路径解析)

安装

cd ~/karson_ubuntu/grok-mcp
npm install
npm run build

路径解析(GROK_BRIDGE)

按顺序找 grok-bridge.mjs:

  1. 环境变量 GROK_BRIDGE

  2. ~/github_repo/grok-build-plugin-cc/plugins/grok-build/scripts/grok-bridge.mjs

  3. ~/.claude/plugins/cache/xai-grok-build/grok-build/<ver>/scripts/grok-bridge.mjs(最新 ver)

  4. $CLAUDE_PLUGIN_ROOT/scripts/grok-bridge.mjs

接入 Claude Code

claude mcp add grok -s user \
  -e GROK_BRIDGE=$HOME/github_repo/grok-build-plugin-cc/plugins/grok-build/scripts/grok-bridge.mjs \
  -- node $HOME/karson_ubuntu/grok-mcp/dist/index.js
  • 前台 grok_run 默认超时 15 分钟(timeout_ms 可改)。

  • background=true:只等 bridge 入队并返回 jobId(默认最长 60s),不跑满 agent;完成靠 grok_show / 报告文件。

  • Prompt 经 --prompt-file 写在 tmpdir(不污染项目 cwd)。

重启 Claude Code 后 /mcp 应见 grok。工具名形如 mcp__grok__grok_check。

接入 OpenCode

在 ~/.config/opencode/opencode.json 的 mcp 段增加等价 stdio 配置(command/args/env 同上)。

multi-model-review

skill 的 Grok 路:优先 MCP grok_run(background=true, write=false, model=grok-4.5);无 MCP 时回退 Bash 调 bridge。

开发

npm run typecheck
npm run build
node dist/index.js   # stdio MCP;不要手动交互跑

手动验 bridge(不经 MCP):

node "$GROK_BRIDGE" check --json

Available Tools

6 tools
grok_bridge_pathA

Resolve which grok-bridge.mjs path this MCP server will use.

Inputs: no named parameters.

grok_checkA

Probe whether Grok Build bridge + CLI are ready (node, grok binary, auth). Returns {rows: [{label, ok, detail}]} envelope; the raw bridge JSON is preserved in the 'bridge output' row's detail for callers that parsed the old shape.

Inputs: cwd.

grok_runA

Run a Grok Build task via bridge (run). background=true: bridge enqueues detached worker and exits; this tool only waits for that enqueue JSON (jobId), default max 60s — not the full agent run. Poll grok_show / report files for completion. write=false default (read-only). Prompt via --prompt-file under tmpdir. Foreground default timeout 900000ms (15 min). Pass cwd for project paths.

Inputs: prompt (required), cwd, fresh, model, +5 more.

grok_runsC

List tracked Grok bridge runs, or one run by id (runs).

Inputs: all, cwd, run_id.

grok_showC

Show status/result of a Grok bridge run (show).

Inputs: cwd, run_id.

grok_stopC

Stop a running Grok bridge job (stop).

Inputs: cwd, run_id.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: check readiness, run a task, list runs, show status, stop a job, and resolve bridge path. No overlap or ambiguity.

    Naming Consistency5/5

    All tools follow a consistent 'grok_' prefix with descriptive verb/noun names (check, run, runs, show, stop, bridge_path). No mixing of conventions.

    Tool Count5/5

    Six tools is ideal for the domain, covering readiness, execution, listing, status, stopping, and configuration. Each tool earns its place without excess.

    Completeness5/5

    The tool surface covers the full lifecycle of Grok build runs: check (readiness), run (create), runs (list), show (read), stop (delete/stop), plus configuration (bridge_path). No obvious gaps.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      Exposes the local Gemini CLI as an MCP stdio server, providing tools for prompting, web search, file operations, and MCP management, enabling AI clients like Codex CLI and Claude Code to interact with Gemini.
      22
      7
      MIT
    • F
      license
      B
      quality
      B
      maintenance
      Local stdio MCP bridge that delegates coding work to the Grok CLI agent via isolated git worktrees and typed receipts. Provides MCP tools for interacting with the Grok CLI across stdio, WebSocket, and legacy transports.
      24
      2
      -