grok-build-mcp
MCP server that wraps the Grok CLI to enable code review, adversarial testing, and chat with xAI's Grok model, integrating into any MCP host as a peer reviewer, adversary, and consultant.
README
grok-build-mcp
Bring xAI's Grok Build CLI into any MCP host as a peer reviewer, adversary, and consultant — alongside whatever main model you're already running.
grok-build-mcp is a small Model Context Protocol server that wraps the grok CLI. Your existing agent (Claude Code, Cursor, Cline, OpenClaw, …) can call into Grok for second-opinion code review, adversarial testing, or extended chat — without leaving its session.
繁體中文版:README.zh-TW.md
What you get
Four tools, all stateless, all stdout-only:
| Tool | Use it for |
|---|---|
grok_chat |
One-shot prompt → Grok's reply |
grok_review |
Pass a unified diff (or auto-grab git diff main...HEAD) and get a per-dimension code review |
grok_consult |
Replay a message history for multi-turn — caller owns the thread |
grok_challenge |
Adversarial: ask Grok to find every bug, race, edge case, and security hole |
Prerequisites
- Node.js ≥ 18
- The Grok CLI installed and authenticated:
curl -fsSL https://x.ai/cli/install.sh | bash grok # first run handles auth
Install
npm install -g grok-build-mcp
# or use npx — no install needed
npx grok-build-mcp
Wire it into your MCP host
Claude Code
claude mcp add grok npx -- grok-build-mcp
Or edit ~/.claude.json directly:
{
"mcpServers": {
"grok": {
"command": "npx",
"args": ["-y", "grok-build-mcp"]
}
}
}
Cursor
Create .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):
{
"mcpServers": {
"grok": {
"command": "npx",
"args": ["-y", "grok-build-mcp"]
}
}
}
Cline (VS Code)
Settings → Cline → MCP Servers:
{
"grok": {
"command": "npx",
"args": ["-y", "grok-build-mcp"]
}
}
Any other MCP host
grok-build-mcp speaks plain stdio MCP. Point any client at npx -y grok-build-mcp and it works.
Tool reference
grok_chat
{ "prompt": "Explain consistent hashing in two sentences." }
Optional: model to override the default Grok model.
grok_review
{ "base_ref": "main", "focus": "security" }
If diff is omitted, runs git diff <base_ref>...HEAD in cwd (defaults to your host's working directory). Returns a markdown review with verdict, per-dimension scores (correctness / readability / architecture / security / performance), and concrete fix-it items.
grok_consult
{
"messages": [
{ "role": "system", "content": "You are a senior backend engineer." },
{ "role": "user", "content": "How would you cache this query?" },
{ "role": "assistant", "content": "Two options..." },
{ "role": "user", "content": "What's the failure mode of option 2?" }
]
}
The server is stateless — the caller passes the full thread each time. Most MCP hosts handle this naturally.
grok_challenge
{
"code": "function transfer(from, to, amount) { from.balance -= amount; to.balance += amount; }",
"context": "Node.js, called concurrently from HTTP handlers"
}
Returns severity-ranked issues (Critical / High / Medium / Low) with concrete reproductions and patches.
Configuration
| Env var | Default | Purpose |
|---|---|---|
GROK_MCP_BIN |
grok |
Path to the grok binary |
GROK_MCP_TIMEOUT |
120000 |
Per-call timeout in milliseconds |
Authentication and model defaults live in the Grok CLI itself (~/.grok/config.toml).
Roadmap
- v0.1 (this release): four stateless tools, stdio transport
- v0.2: server-side session persistence so
grok_consultcan take aconversation_id - v0.3: streaming responses through MCP
progressnotifications
Development
git clone https://github.com/howardpen9/grok-mcp.git
cd grok-mcp
npm install
npm test
npm run build
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.