Skip to content

fix(standalone): use mcp__context-mode__ prefix when CLAUDE_PLUGIN_ROOT is absent#913

Open
eejd wants to merge 1 commit into
mksglu:nextfrom
eejd:fix/standalone-tool-prefix
Open

fix(standalone): use mcp__context-mode__ prefix when CLAUDE_PLUGIN_ROOT is absent#913
eejd wants to merge 1 commit into
mksglu:nextfrom
eejd:fix/standalone-tool-prefix

Conversation

@eejd

@eejd eejd commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Context

Complements #810 (merged) which fixed standalone installs (MacPorts, npm global) silently skipping settings.json hook wiring.

Problem

Standalone installs register the MCP server as context-mode via settings.json, which yields mcp__context-mode__<tool> names. Plugin installs set CLAUDE_PLUGIN_ROOT and yield the plugin-namespaced form instead. Guidance text and ToolSearch bootstraps were hardcoded to the plugin-namespaced form regardless of install mode, so standalone installs got incorrect tool-name references.

Fix

hooks/core/tool-naming.mjs's claude-code branch now checks CLAUDE_PLUGIN_ROOT at runtime and emits the correct prefix for the actual install mode. src/adapters/claude-code/hooks.ts gets a clarifying comment that mcp__ covers both forms. Tests updated to assert the standalone form (no CLAUDE_PLUGIN_ROOT in env).

Testing

  • Existing test suite updated (tests/core/routing.test.ts, tests/hooks/integration.test.ts, tests/hooks/tool-naming.test.ts) to cover both plugin and standalone install modes.
  • Verified live on a MacPorts standalone install: tools now surface as mcp__context-mode__ctx_*.

Affected platforms

  • Claude Code
  • Cursor
  • VS Code Copilot (GitHub Copilot)
  • JetBrains Copilot
  • Gemini CLI
  • Qwen Code
  • OpenCode
  • KiloCode
  • Codex CLI
  • OpenClaw (Pi Agent)
  • Pi
  • Kiro
  • Antigravity
  • Zed

Checklist

  • Tests added/updated (TDD: red → green)
  • npm test passes
  • npm run typecheck passes
  • Docs updated if needed
  • No Windows path regressions (forward slashes only)
  • Targets next branch

…OT is absent

Standalone installs (MacPorts, npm global) register the MCP server as
"context-mode" via settings.json, which yields mcp__context-mode__<tool>
names. Plugin installs set CLAUDE_PLUGIN_ROOT and yield the plugin-
namespaced form. Guidance text and ToolSearch bootstraps now use the
correct prefix based on the install mode at runtime.

- hooks/core/tool-naming.mjs: claude-code branch checks CLAUDE_PLUGIN_ROOT
- src/adapters/claude-code/hooks.ts: comment explaining mcp__ covers both
- tests: updated to assert standalone form (no CLAUDE_PLUGIN_ROOT in env)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.

1 participant