Grok MCP logo

Grok MCP

Routes chat, code reviews, consultations, and adversarial checks to xAI Grok through MCP.

Install Grok MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "grok-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "grok-cli-mcp"
      ],
      "env": {
        "XAI_API_KEY": "YOUR_VALUE_HERE",
        "GROK_MCP_TIMEOUT": "YOUR_VALUE_HERE",
        "GROK_MCP_PATH_SECRET": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Automated check passed— started and listed 4 tools correctly (6d ago).

Overview

The grok-mcp MCP server lets an MCP host delegate questions, code reviews, consultations, and adversarial analysis to xAI Grok. It can call xAI directly with an API key or use the official Grok CLI with browser OAuth. The server supports local stdio use and a bundled Streamable HTTP mode for remote connectors. Reach for it when a primary coding agent needs an independent review, PR gate, or second opinion.

Use cases

  • Review a Git diff before opening a pull request
  • Challenge code for races, edge cases, and security issues
  • Consult Grok on an implementation or architecture decision
  • Gate CI changes with machine-readable review output

Key features

  • Direct xAI API and Grok CLI backends
  • Structured diff reviews with scored dimensions
  • Stateless multi-turn consultations
  • Severity-ranked adversarial code analysis
  • Local stdio and remote Streamable HTTP modes
  • JSON output for automated review gates

Tools4

What Grok MCP lets your agent do. Expand a tool for its parameters.

Verified live~748 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 1d ago

Recent health check succeeded.

6/6 checks healthy over the last 39d

What it can do

From the 4 tools this server returned when we ran it.

Read-only tools · 4
Network at startup3 connections
Files written at startupNone
Install scriptsNone
npm provenanceNot published
Package age136 days
Maintainers1

Observed 2026-10-21 in an isolated sandbox. A description of reach, not a security audit.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 3d ago via OSV.dev · grok-cli-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars11Stargazers on the source repository.
npm downloads333Package downloads in the last 30 days.
Last commit3mo agoMost recent push to the default branch.
Availability100%Our rolling endpoint + install checks that succeeded.
Install checkPassedOur sandbox started it and listed its tools.
Tools exposed4Callable tools this server registers over MCP.
Directory activity8 viewsConfig copies, upvotes, and views on AllMCPs.

How Grok MCP works

What grok-mcp MCP server does

The grok-mcp MCP server connects an MCP client to xAI Grok as a secondary reviewer and consultant. It is designed for workflows where a primary agent such as Claude Code, Cursor, or Cline asks another model to inspect code, challenge an approach, or answer a focused question.

Four MCP tools are available:

  • grok_chat sends a single prompt and returns Grok's response.
  • grok_review examines a supplied unified diff, or can obtain a local Git diff when running locally.
  • grok_consult processes a complete message history for multi-turn discussions.
  • grok_challenge looks for bugs, race conditions, edge cases, and security problems in code and its context.

All four tools are stateless. Review output can be returned as Markdown or JSON, making grok_review suitable for automated checks as well as interactive development.

How it works

The grok-mcp MCP server selects its backend from the available authentication setup. When XAI_API_KEY is set, it calls the xAI HTTP API directly and does not require a local Grok executable. Without that variable, it can use the official Grok CLI, which requires an interactive browser OAuth login beforehand.

The server communicates over plain stdio for local MCP hosts. It also includes a Streamable HTTP server for deployments that need a URL, such as Claude web connectors. In HTTP mode, a path secret protects the endpoint, and the server provides a /health route for platform checks.

For local review requests, omitting diff allows the server to run git diff <base_ref>...HEAD in the configured working directory. Remote deployments cannot inspect the caller's local repository, so HTTP clients must provide the diff explicitly. The caller owns the full conversation history for grok_consult and sends it again for each request.

Setup and configuration

Node.js 18 or newer is required. Install the npm package globally with npm install -g grok-cli-mcp, or run it without a permanent installation using npx grok-cli-mcp.

For API mode, provide an XAI_API_KEY from the xAI console. This is the documented option for MCP, CI, and automation. CLI mode requires installing the Grok CLI and completing its browser-based login. The server also accepts GROK_MCP_TIMEOUT for extending request limits, which can matter for longer Grok reasoning calls.

Local clients can start npx -y grok-cli-mcp as a stdio server. Claude Code, Cursor, Cline, and Claude Desktop use configuration entries containing the command, package arguments, and optional environment variables. For remote use, deploy the HTTP process on a Node-capable host, set GROK_MCP_PATH_SECRET, and expose the resulting /mcp/<secret> URL. Keep API keys and the HTTP path secret out of public configuration; the path secret controls access to the xAI-backed endpoint.

Tools and capabilities

grok_chat accepts a prompt and optional model and timeout values. grok_review accepts a base reference, focus, format, working directory, or explicit diff. Its review can include a verdict, scores for correctness, readability, architecture, security, and performance, plus concrete fixes. JSON format is intended for machine-readable PR gating.

grok_consult accepts messages with roles such as system, user, and assistant, allowing the calling agent to preserve the thread. grok_challenge accepts code and contextual information, then returns severity-ranked findings with reproductions and patches.

The grok-mcp MCP server is therefore a fit for second-opinion review, focused design consultation, adversarial code analysis, and CI-oriented diff evaluation rather than general repository hosting or source-control mutation.

Limitations and notes

The server does not maintain conversation state; the caller must provide the complete consultation history. Local Git discovery is unavailable through the remote HTTP endpoint, so remote review calls need an explicit diff. Long reasoning requests may require a timeout compatible with the hosting platform.

API usage is pay-per-call and depends on the xAI account. CLI authentication instead uses the user's Grok plan limits. API credentials placed in an MCP configuration file are stored in that file, so the file should be treated as sensitive. The remote URL should also be treated as a credential because anyone who obtains its secret path may be able to consume the configured xAI access.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Grok MCP

grok-mcp is an MCP server that connects MCP hosts to xAI Grok through the xAI API or official Grok CLI. Its main tools are grok_chat for one-shot questions, grok_review for diffs, grok_consult for caller-managed multi-turn discussions, and grok_challenge for bug, race, edge-case, and security analysis.

Install it with `npm install -g grok-cli-mcp`, or run it directly with `npx grok-cli-mcp`. Node.js 18 or newer is required. Configure the resulting command as a local stdio MCP server in your client.

Set `XAI_API_KEY` to use xAI's HTTP API directly. If the variable is absent, the server falls back to the Grok CLI, which must be installed and authenticated through its interactive browser OAuth flow.

Yes, grok-mcp works with Cursor through its MCP configuration. Add a server entry that runs `npx -y grok-cli-mcp` in `.cursor/mcp.json` for a project or `~/.cursor/mcp.json` for a global setup.

Yes, `grok_review` can return JSON suitable for machine-readable PR gating. Provide a diff or, in local mode, a base reference such as `main`; remote HTTP deployments require the diff explicitly because they cannot access the local repository.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewGrok MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/grok-mcp?style=directory)](https://allmcps.com/mcp/grok-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/grok-mcp"><img src="https://allmcps.com/api/badge/grok-mcp?style=directory" alt="Grok MCP on AllMCPs" /></a>