Skip to content

fix: make Claude plugin MCP startup portable#42

Merged
KHAEntertainment merged 1 commit intomasterfrom
codex/marketplace-mcp-wrapper
Apr 17, 2026
Merged

fix: make Claude plugin MCP startup portable#42
KHAEntertainment merged 1 commit intomasterfrom
codex/marketplace-mcp-wrapper

Conversation

@KHAEntertainment
Copy link
Copy Markdown
Owner

@KHAEntertainment KHAEntertainment commented Apr 17, 2026

Summary

  • replace the Claude plugin MCP config with standard mcpServers.grok-swarm shape using ${CLAUDE_PLUGIN_ROOT}
  • add a plugin-local MCP wrapper that bootstraps .venv before starting src/mcp/grok_server.py
  • stop setup from re-adding duplicate manual grok-swarm MCP entries when plugin MCP is visible
  • bump all version metadata to 1.3.6 and add release checks that block machine-local MCP paths

Verification

  • npm ci
  • npm test
  • npm run verify:release
  • temp plugin-copy smoke test for scripts/bootstrap-runtime.sh
  • temp plugin-copy smoke test for scripts/mcp-server.sh startup/EOF exit

Notes

  • This intentionally does not include the local unfinished xAI/httpx commit on codex/claude-command-bootstrap-fix.
  • bd tracking is unavailable in this checkout because no beads database is present.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed MCP configuration portability across different environments
    • Improved runtime initialization on first start
    • Prevented duplicate server entry creation
    • Added validation to ensure configurations use portable paths
  • Chores

    • Bumped version to 1.3.6

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 17, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e1c035b5-cded-4b26-98a9-a9c9c94ad539

📥 Commits

Reviewing files that changed from the base of the PR and between 765005f and 2b9c20d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • .claude-plugin/marketplace.json
  • CHANGELOG.md
  • CLAWHUB.md
  • VERSION
  • package.json
  • platforms/claude/.claude-plugin/plugin.json
  • platforms/claude/.claude-plugin/setup.sh
  • platforms/claude/.mcp.json
  • platforms/claude/commands/setup.sh
  • platforms/claude/scripts/bootstrap-runtime.sh
  • platforms/claude/scripts/mcp-server.sh
  • platforms/claude/skills/grok-swarm/SKILL.md
  • platforms/claude/src/mcp/grok_server.py
  • pyproject.toml
  • scripts/test.js
  • scripts/verify-release.js
  • src/mcp/grok_server.py

Walkthrough

Version 1.3.6 release bumps plugin metadata across all manifests and introduces a portable MCP entrypoint architecture with plugin-local Python runtime bootstrapping. Setup flow migrates from direct virtualenv creation to a wrapper entrypoint pattern with first-start bootstrap and release-time portability validation.

Changes

Cohort / File(s) Summary
Version Metadata Bumps
.claude-plugin/marketplace.json, CLAWHUB.md, VERSION, package.json, platforms/claude/.claude-plugin/plugin.json, platforms/claude/skills/grok-swarm/SKILL.md, pyproject.toml, src/mcp/grok_server.py, platforms/claude/src/mcp/grok_server.py
Updated version from 1.3.5 to 1.3.6 across all manifest and package files.
Changelog Documentation
CHANGELOG.md
Added entry for v1.3.6 documenting four fixes: portable MCP config wrapper, first-start runtime bootstrapping, duplicate server prevention, and release-time portability checks.
Claude MCP Configuration
platforms/claude/.mcp.json
Restructured root key from grok-swarm to mcpServers; replaced direct Python invocation with bash wrapper at ${CLAUDE_PLUGIN_ROOT}/scripts/mcp-server.sh; updated PYTHONPATH to use ${CLAUDE_PLUGIN_ROOT}/src.
Runtime Bootstrap Scripts
platforms/claude/scripts/bootstrap-runtime.sh, platforms/claude/scripts/mcp-server.sh
Added new bash scripts: bootstrap-runtime.sh (~81 lines) creates/manages plugin-local virtualenv with dependency stamping and openai validation; mcp-server.sh (~9 lines) wraps the bootstrap call and execs the MCP server process.
Setup & Installation Flow
platforms/claude/.claude-plugin/setup.sh, platforms/claude/commands/setup.sh
Refactored setup.sh to call bootstrap-runtime.sh instead of inline virtualenv creation; removed claude mcp add/remove logic and replaced with legacy entry detection and removal; extended MCP visibility regex to handle plugin:grok-swarm:grok-swarm: prefix.
Release & Testing Validation
scripts/test.js, scripts/verify-release.js
Enhanced test.js to verify portable MCP config presence and absence of ${PLUGIN_ROOT} or absolute paths; added new assertPortableClaudeMcpConfig() function in verify-release.js with constraints requiring mcpServers.grok-swarm, ${CLAUDE_PLUGIN_ROOT}/scripts/mcp-server.sh reference, and rejection of machine-local absolute paths.

Sequence Diagram

sequenceDiagram
    participant Claude as Claude<br/>(Invoker)
    participant Setup as setup.sh<br/>(Orchestrator)
    participant Bootstrap as bootstrap-runtime.sh<br/>(Runtime Setup)
    participant VEnv as .venv/<br/>(Virtual Env)
    participant MCPWrapper as mcp-server.sh<br/>(Entrypoint)
    participant Server as grok_server.py<br/>(MCP Server)

    Claude->>Setup: Execute on first start
    Setup->>Bootstrap: Call scripts/bootstrap-runtime.sh
    Bootstrap->>VEnv: Check/create virtualenv
    Bootstrap->>VEnv: Validate requirements.txt hash
    Bootstrap->>VEnv: Install dependencies if needed
    Bootstrap->>Setup: Return Python interpreter path
    Setup->>Claude: Setup complete
    
    Claude->>MCPWrapper: Invoke mcp-server.sh (MCP launcher)
    MCPWrapper->>Bootstrap: Call bootstrap-runtime.sh for runtime
    Bootstrap->>VEnv: Return cached Python path
    MCPWrapper->>Server: Exec Python with grok_server.py
    Server->>Claude: MCP protocol ready
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Possibly related PRs

Poem

🐚 A version ascends, from 1.3.5's shore,
To 1.3.6, with portability galore—
Bootstrap at dawn, virtualenv takes flight,
Wrapper entrypoints keep paths out of sight. ✨
No more machine-local, just portable grace,
MCP servers find their rightful place.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/marketplace-mcp-wrapper

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@KHAEntertainment KHAEntertainment merged commit 0dc81bd into master Apr 17, 2026
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant