fix(plugin): resolve MCP entrypoint from plugin root - #8
Merged
Conversation
The Claude adapter's .mcp.json used cwd "." with a relative
./dist/standalone.mjs. Claude Code resolves that relative path against
the session's working directory, not the plugin root, so every session
started outside the plugin directory died at startup:
Error: Cannot find module '/Users/<user>/dist/standalone.mjs'
Point args at ${CLAUDE_PLUGIN_ROOT}/dist/standalone.mjs and drop cwd,
matching the pattern other Claude Code plugins use. Also regenerates
plugin/dist/standalone.mjs, which was stale against its own source.
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.
Problem
The Claude adapter's
plugin/.mcp.jsonusedcwd: "."with a relative./dist/standalone.mjs. Claude Code resolves that relative path against the session's working directory, not the plugin root, so any session started outside the plugin directory failed at startup:Observed in
~/Library/Caches/claude-cli-nodejs/<cwd>/mcp-logs-plugin-agentmemory-agentmemory/. All 54 MCP tools were unavailable; only the SessionStart hook still worked, which is why context injection kept succeeding and masked the failure.Codex is unaffected — it reaches the server through
[mcp_servers.agentmemory](npx -y @agentmemory/mcp), which never depends on cwd.Fix
Point
argsat${CLAUDE_PLUGIN_ROOT}/dist/standalone.mjsand dropcwd, matching the pattern other Claude Code plugins use (e.g. agent-lcm, which resolves correctly for exactly this reason).Also regenerates
plugin/dist/standalone.mjs, which was stale against its own source at 84b5590.Verification
Headless session from an unrelated cwd, before and after:
MODULE_NOT_FOUND, CONNECTION_CLOSED0.9.29-codex.1Successfully connected (transport: stdio) in 95mstools/listreturns 54 tools (full mode, not the 7-tool reduced LOCAL fallback).