npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

grok-build-mcp

v0.1.1

Published

MCP server that wraps the xAI Grok CLI. Exposes grok_chat / grok_review / grok_consult / grok_challenge tools to any MCP-compatible host (Claude Code, Cursor, Cline, OpenClaw, ...).

Readme

grok-build-mcp

把 xAI 的 Grok Build CLI 包成 MCP server,讓 Claude Code、Cursor、Cline、OpenClaw 等 MCP host 都能直接調用 Grok 來做 code review、對抗測試、第二意見諮詢。

English: README.md

提供什麼

四個 tool,全部 stateless:

| Tool | 用途 | |------|------| | grok_chat | 一次性問答 | | grok_review | 給 diff(或自動 git diff main...HEAD),回結構化 code review | | grok_consult | 多輪對話,caller 自己重送 history | | grok_challenge | 對抗模式:請 Grok 找 bug、race condition、security hole |

前置需求

  • Node.js ≥ 18
  • 已安裝並登入 Grok CLI:
    curl -fsSL https://x.ai/cli/install.sh | bash
    grok  # 第一次跑會處理登入

安裝

npm install -g grok-build-mcp
# 或直接 npx 不裝
npx grok-build-mcp

串到 MCP host

Claude Code

claude mcp add grok npx -- grok-build-mcp

或直接編輯 ~/.claude.json

{
  "mcpServers": {
    "grok": {
      "command": "npx",
      "args": ["-y", "grok-build-mcp"]
    }
  }
}

Cursor

.cursor/mcp.json(專案)或 ~/.cursor/mcp.json(全域):

{
  "mcpServers": {
    "grok": {
      "command": "npx",
      "args": ["-y", "grok-build-mcp"]
    }
  }
}

Cline (VS Code)

Settings → Cline → MCP Servers:

{
  "grok": {
    "command": "npx",
    "args": ["-y", "grok-build-mcp"]
  }
}

其他 MCP host

grok-build-mcp 跑標準 stdio MCP。任何 client 指向 npx -y grok-build-mcp 即可。

Tool 用法

grok_chat

{ "prompt": "兩句話解釋 consistent hashing。" }

可選 model 覆寫預設 Grok model。

grok_review

{ "base_ref": "main", "focus": "security" }

沒給 diff 就跑 git diff <base_ref>...HEAD。回傳 markdown 評審,含整體判決、五維度評分(correctness / readability / architecture / security / performance)、具體修正建議。

grok_consult

{
  "messages": [
    { "role": "system", "content": "你是資深後端工程師。" },
    { "role": "user", "content": "這個 query 怎麼 cache?" },
    { "role": "assistant", "content": "兩個方案..." },
    { "role": "user", "content": "方案 2 的 failure mode 是什麼?" }
  ]
}

Server 不存 state,caller 每次帶完整 history。一般 MCP host 會自動處理。

grok_challenge

{
  "code": "function transfer(from, to, amount) { from.balance -= amount; to.balance += amount; }",
  "context": "Node.js,HTTP handler 並發呼叫"
}

回傳 severity 分級的問題(Critical / High / Medium / Low),含重現步驟與修補建議。

設定

| 環境變數 | 預設值 | 用途 | |---------|--------|------| | GROK_MCP_BIN | grok | grok binary 路徑 | | GROK_MCP_TIMEOUT | 120000 | 單次 call timeout(毫秒) |

認證與預設 model 在 Grok CLI 自己的 ~/.grok/config.toml

Roadmap

  • v0.1(本版):四個 stateless tool、stdio transport
  • v0.2:server 端 session 持久化,grok_consult 可帶 conversation_id
  • v0.3:透過 MCP progress notification 做 streaming

開發

git clone https://github.com/howardpen9/grok-mcp.git
cd grok-mcp
npm install
npm test
npm run build

License

MIT