fix: use relative path in .mcp.json to silence CLAUDE_PLUGIN_ROOT warning#253
Merged
mksglu merged 13 commits intomksglu:nextfrom Apr 13, 2026
Merged
fix: use relative path in .mcp.json to silence CLAUDE_PLUGIN_ROOT warning#253mksglu merged 13 commits intomksglu:nextfrom
mksglu merged 13 commits intomksglu:nextfrom
Conversation
${CLAUDE_PLUGIN_ROOT} is only defined when the repo is loaded as an installed
Claude Code plugin. When contributors open the repo as a regular project, the
variable is undefined and Claude Code prints:
[Warning] mcpServers.context-mode: Missing environment variables: CLAUDE_PLUGIN_ROOT
Use a relative path so the MCP entry works for repo-as-project usage. Plugin
install path is unaffected — it still uses .claude-plugin/plugin.json.
Closes mksglu#251
Co-authored-by: Ercan Ermis <eposta@ercanermis.com>
…not repo-root
The prior assertion required `${CLAUDE_PLUGIN_ROOT}` in repo-root
`.mcp.json`, but that file is only read when contributors open the repo
as a regular project — marketplace installs resolve paths from
`.claude-plugin/plugin.json` instead. The repo-root file now uses a
relative path to silence the "Missing environment variable" warning.
Split the original test into two:
- Plugin manifest must keep the placeholder (real marketplace contract).
- Repo-root .mcp.json must use a relative path (this PR's behavior).
Co-authored-by: Ercan Ermis <eposta@ercanermis.com>
Contributor
Author
|
CI failure was a stale test assertion, not a regression from this PR.
Fixed in 3f66152 by splitting the test in two:
Local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
${CLAUDE_PLUGIN_ROOT}/start.mjswith./start.mjsin repo-root.mcp.json..claude-plugin/plugin.json.Why
${CLAUDE_PLUGIN_ROOT}is only defined when Claude Code loads the repo as an installed plugin. Opening the repo as a normal project leaves the var undefined, so every session starts with:A relative path resolves correctly when Claude Code spawns the MCP server from the project root. Plugin-mode continues to use
.claude-plugin/plugin.json, which is unchanged.Pros / Cons
Pros
Cons
.mcp.jsonfiles in the wild.Test plan
CLAUDE_PLUGIN_ROOTwarning./context-mode:ctx-doctorstill passes on a normal plugin install.node ./start.mjsstarts successfully from the repo root.Closes #252