Skip to content

MLD-1307 - Claude rewrite mcp.json - #59

Open
arielamitjfrog wants to merge 5 commits into
mainfrom
feature/MLD-1307-claude-review-mcp-json
Open

MLD-1307 - Claude rewrite mcp.json#59
arielamitjfrog wants to merge 5 commits into
mainfrom
feature/MLD-1307-claude-review-mcp-json

Conversation

@arielamitjfrog

Copy link
Copy Markdown

Summary

  • Adds Claude Code hooks that discover installed-plugin .mcp.json files and rewrite stdio MCP entries through JFrog Agent Guard (npx @jfrog/agent-guard --rewrite-mcp-json) on every SessionStart and when installed_plugins.json / known_marketplaces.json change.
  • Splits Claude-specific discovery/adapters into scripts/ (safe across modules sync) and shared rewrite orchestration into vendored modules/core/ (rewrite-mcp-json.mjs, agent-guard-check.mjs, entry.mjs).
  • Soft-fails by design (missing project key, gate failure, or rewrite errors log and exit 0) so sessions are never broken; emits /reload-plugins guidance when files were rewritten.
  • Bumps plugin version to 0.2.20, documents the feature and env knobs in README/VENDOR, and adds CI unit tests for discovery + align scripts.

What changed

Area Details
Hooks SessionStart: register FileChanged watch paths, then run align; FileChanged: re-align on plugin install metadata changes
Discovery Marketplace live trees + installed_plugins.json install paths under $CLAUDE_CONFIG_DIR (default ~/.claude)
Kill switch JF_AGENT_REWRITE_MCP_JSON_DISABLE=1
CI node --test for claude-mcp-json-discover and claude-align-mcp-json

Related PRs:

Test plan

  • Fresh session with Agent Guard available: SessionStart discovers plugin .mcp.json paths and rewrites stdio MCP entries
  • After rewrite, hook additionalContext asks for /reload-plugins; after reload, plugin MCPs reconnect via Agent Guard
  • Install/update a marketplace plugin mid-session → FileChanged fires → configs re-aligned
  • Remote url / http / sse / ws MCP entries are left unchanged
  • Soft-fail cases (no project key, Agent Guard unavailable, kill switch set) exit 0 and do not break the session
  • node --test scripts/claude-mcp-json-discover.test.mjs scripts/claude-align-mcp-json.test.mjs passes locally / in validate workflow

@arielamitjfrog
arielamitjfrog requested a review from a team as a code owner August 17, 2026 11:07
Comment thread modules/core/agent-guard-check.mjs Outdated
Comment thread VENDOR.md Outdated
Comment thread hooks/hooks.json Outdated
Comment thread modules/core/rewrite-mcp-json.mjs
Comment thread modules/core/rewrite-mcp-json.mjs
Comment thread modules/core/rewrite-mcp-json.mjs Outdated
Comment thread modules/core/rewrite-mcp-json.mjs Outdated
Comment thread scripts/claude-align-mcp-json.mjs Outdated
YoniMelki
YoniMelki previously approved these changes Aug 19, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
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.

3 participants