Grok Build Bridge
An MCP server that wraps the local Grok Build CLI, enabling Codex to delegate code reviews, bounded coding tasks, and setup diagnostics to Grok for a second opinion or parallel processing.
README
Grok Build Bridge
A Codex CLI plugin that lets you delegate reviews and bounded coding tasks from an OpenAI
Codex session to the local, subscription-authenticated Grok Build CLI (xAI). It ships a
bundled stdio MCP server that wraps the local grok binary, plus a skill that tells Codex
when to reach for it. Grok is an explicit second-opinion / review / task channel — not a
model swap for Codex's own work.
Codex session → grok-build-delegate skill routes → MCP tools → local `grok` CLI → results back under Codex approvals
Requirements
- Node.js >= 18.18
- The Grok Build CLI, installed and logged in:
curl -fsSL https://x.ai/cli/install.sh | bash grok login - The OpenAI Codex CLI with plugin support.
Install (local dev)
npm install
codex plugin marketplace add /path/to/grok-build-codex-plugin
codex plugin add grok-build@grok-build-dev
node scripts/install-codex-config.mjs
The repository root doubles as the marketplace (.agents/plugins/marketplace.json).
Run npm install before adding it — the MCP server needs @modelcontextprotocol/sdk
at runtime and the plugin is cached with its node_modules. codex plugin add is still
needed to register the grok-build-delegate skill.
The last step, node scripts/install-codex-config.mjs, installs the MCP server itself. On
codex-cli 0.144.1, ${PLUGIN_ROOT} in .mcp.json does not resolve when Codex's session
cwd is outside this checkout (openai/codex#22842),
so relying on .mcp.json alone leaves the server unreachable from other repos. The installer
writes an absolute-path [mcp_servers.grok-build] entry to ~/.codex/config.toml (or
$CODEX_HOME/config.toml) instead — reliable regardless of session cwd. .mcp.json stays in
the repo for when upstream fixes resolution. Run node scripts/install-codex-config.mjs --remove to uninstall; see dev/README.md for the full flag reference.
Codex sometimes launches plugin MCP servers with a minimal PATH (e.g. GUI/launchd
contexts), where a bare node command isn't found. The installed config runs the server
through a bundled launcher (mcp-server/bin/grok-build-mcp) that locates node in common
install locations on its own; set GROK_BUILD_NODE=/path/to/node to force a specific binary.
Tools
The MCP server exposes seven tools. Each takes a cwd (the target repository's absolute
path).
| Tool | Purpose |
|---|---|
grok_build_setup |
Check the local Grok CLI, authentication, model, fallback, and state storage. |
grok_build_prompt |
Run a foreground, strictly read-only Grok prompt in a workspace. |
grok_build_review |
Collect safe Git context and run a read-only Grok code review. |
grok_build_task |
Run or queue a bounded Grok task, optionally with gated workspace writes. |
grok_build_status |
List active or all stored jobs for a repository, with process liveness. |
grok_build_result |
Return the stored result and evidence for a finished job. |
grok_build_cancel |
Cancel an active job, terminate its process tree, and release its write lock. |
grok_build_task runs in the foreground by default; pass background: true for long runs,
then poll grok_build_status and read grok_build_result when the job finishes.
Configuration
Environment variables read by the MCP server:
| Variable | Purpose |
|---|---|
GROK_BUILD_DEFAULT_MODEL |
Default Grok model passed to the CLI. Unset uses Grok's own default. |
GROK_BUILD_PLUGIN_DATA |
Directory for job state and review inputs. Defaults to a temp dir. |
GROK_BUILD_API_FALLBACK |
true to permit the read-only xAI API fallback globally. Defaults to false. |
GROK_BUILD_ALLOW_WRITE |
true to allow write-mode tasks. Defaults to off. |
XAI_API_KEY |
xAI API key. Required for the API fallback. |
GROK_BUILD_XAI_BASE_URL |
xAI API base URL. Defaults to https://api.x.ai/v1. |
GROK_BUILD_XAI_TIMEOUT_MS |
xAI API request timeout in ms. Defaults to 120000. |
GROK_BUILD_NODE |
Absolute path to a node binary for the bundled launcher to use, bypassing its own PATH search. |
Codex's own sandbox and approval policy governs applying any patch Grok proposes. A
per-tool approval snippet for ~/.codex/config.toml lives in
dev/config-snippet.toml — it sets grok_build_review to
approve and keeps the write-capable grok_build_task on prompt.
API fallback
By default all work runs through your local grok CLI. The read-only xAI API fallback
fires only when all of these hold:
- it is explicitly allowed —
allow_api_fallback: trueon the call, orGROK_BUILD_API_FALLBACK=true; XAI_API_KEYis set;- the local
grokCLI is missing or unauthenticated; and - the request is read-only.
Fallback results are marked source: "xai_api_fallback". The fallback is never used for
write-mode tasks — it uses your xAI API credits, so it stays an explicit, read-only opt-in.
Write mode
Write mode is gated in v1 and off by default. Both gates must be satisfied:
- the server environment has
GROK_BUILD_ALLOW_WRITE=true, and - the call sets
write: trueongrok_build_task.
--always-approve is never implied; always_approve only takes effect for a write task and
only when explicitly requested. Each write job captures git status before and after the
run as evidence, so you can see exactly what changed. Applying anything further still goes
through Codex's normal edit/approval flow.
See USAGE.md for concise criteria on what to delegate to Grok versus keep in Codex.
Try it
Once the plugin is enabled, ask Codex:
- "Use Grok Build to run its setup diagnostics for this repo."
- "Use Grok Build to explain what this repository does (read-only)."
- "Use Grok Build to review my working tree."
- "Ask Grok Build for an adversarial review of this branch against
main."
Development
npm test # node --test over tests/*.test.mjs
npm run build # tsc type-check (JSDoc types, no emit)
Drive the tools without Codex using the dev runner or the server self-test:
node mcp-server/src/dev-runner.mjs setup --cwd "$PWD"
node mcp-server/src/server.mjs --self-test
npm run bump-version / npm run check-version manage the coupled version strings.
Status
The Grok Build CLI is early beta — its flags and JSON output may change. Output parsing is
kept deliberately tolerant, and job success is read from Grok's stopReason
(EndTurn = clean) rather than exit codes. Expect rough edges.
License
Apache-2.0
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。