Repository navigation
plugin: wrap .mcp.json in mcpServers and document Grok Build install - #1100
Conversation
Prepare the agent plugin for the xAI catalog scanner. Nest the hosted MCP server under mcpServers, resolve the pre-PR hook from GROK_PLUGIN_ROOT with a Claude Code fallback, and document the Grok Build install plus the hook's security contract. Co-authored-by: Zach Dunn <zachdunn@users.noreply.github.com>
|
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (2)
🚫 Excluded labels (none allowed) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Resolve the pre-PR screenshot script from GROK_PLUGIN_ROOT, then PLUGIN_ROOT, then CLAUDE_PLUGIN_ROOT, still as a shell command so the fallback expands. Co-authored-by: Zach Dunn <zachdunn@users.noreply.github.com>
Prep for listing the uploads plugin in the xAI plugin marketplace (Grok Build). This is step 1, in this repo only. After it merges, a catalog PR to
xai-org/plugin-marketplacepins the commit SHA. That catalog change is not in this pull request.What it does
plugins/claude/uploads/.mcp.jsoninmcpServers. xAI's catalog scanner reads that key and reports zero MCP servers for the flat form. Claude Code loads both shapes. The server is stillhttps://agents.uploads.sh/mcp.${GROK_PLUGIN_ROOT:-${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}}, so Grok Build, Codex, and Claude Code each find the plugin root. MatcherBash,PreToolUse, the 15s timeout, and the status message stay.pre-pr-screenshot.shis unchanged: ifuploadsis onPATHit runsuploads hook pre-pr-screenshot, otherwise it exits 0.uploads), an Apache-2.0 license section, and a direct description of what the hook does.What it is not
xai-org/plugin-marketplacechanges here.hooks/register.tsx) both stay.PLUGIN_ROOTin the path cascade.0.4.0.Hooks, on purpose
The
Bashmatcher can only key the tool name, so the hook starts before Bash commands. The filter is inside the CLI: the script acts only ongh pr create. It runs the localuploadsCLI and does nothing if the CLI is missing or not signed in.UPLOADS_HOOK_DISABLE=1turns it off.The plugin root cascade is
GROK_PLUGIN_ROOT, then Codex-nativePLUGIN_ROOT, thenCLAUDE_PLUGIN_ROOT. Codex also aliasesCLAUDE_PLUGIN_ROOT, so the previous form already ran there. PreferringPLUGIN_ROOTkeeps the path on Codex's own variable.hooks/register.tsxis a Claude Code mod (the band above the prompt). It needs Claude Code 2.1.287 or later. It is not the portable hooks contract Grok Build runs.Other plugins already listed in the xAI marketplace ship hooks. Railway uses this same
PreToolUse+Bashpattern. Vercel shipsSessionStart,PostToolUse, andSessionEnd. Superpowers shipsSessionStart.The path sits in the shell
command, not anargsarray. Claude Code treats a presentargsarray as exec form and does not run a shell, so${VAR:-fallback}would be a literal filename there. Grok Build readscommandonly and runs it withsh -c, which expands the fallback. Railway's marketplace hook uses that same shell form.How to try it
From a checkout of this branch, in Claude Code:
The uploads HTTP server should show up in
claude mcp list. Claude Code is not installed in the environment that prepared this branch, so that check is still open.Test plan
.mcp.jsonparses, andmcpServers.uploadsis the HTTP server athttps://agents.uploads.sh/mcpGROK_PLUGIN_ROOT, thenPLUGIN_ROOT, thenCLAUDE_PLUGIN_ROOTpre-pr-screenshot.shexits 0 whenuploadsis not onPATH, and execsuploads hook pre-pr-screenshotwhen a stub CLI isclaude plugin validate plugins/claude/uploads(a missing version-pin warning is expected and fine)