Skip to content

fix(plugin): resolve MCP entrypoint from plugin root - #8

Merged
davidrobertson merged 1 commit into
mainfrom
fix/claude-plugin-mcp-root
Sep 1, 2026
Merged

fix(plugin): resolve MCP entrypoint from plugin root#8
davidrobertson merged 1 commit into
mainfrom
fix/claude-plugin-mcp-root

Conversation

@davidrobertson

Copy link
Copy Markdown
Owner

Problem

The Claude adapter's plugin/.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 any session started outside the plugin directory failed at startup:

Error: Cannot find module '/Users/<user>/dist/standalone.mjs'
    code: 'MODULE_NOT_FOUND'
Connection failed (CONNECTION_CLOSED): Connection closed

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 args at ${CLAUDE_PLUGIN_ROOT}/dist/standalone.mjs and drop cwd, 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:

server version result
before MODULE_NOT_FOUND, CONNECTION_CLOSED
after 0.9.29-codex.1 Successfully connected (transport: stdio) in 95ms

tools/list returns 54 tools (full mode, not the 7-tool reduced LOCAL fallback).

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.
@davidrobertson
davidrobertson merged commit 62ed44f into main Sep 1, 2026
0 of 8 checks passed
@davidrobertson
davidrobertson deleted the fix/claude-plugin-mcp-root branch September 1, 2026 14:05
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