Skip to content

fix(install): resolve MCP command ~ to an absolute path#24

Merged
Lyther merged 1 commit into
mainfrom
fix/mcp-command-absolute-path
Jul 5, 2026
Merged

fix(install): resolve MCP command ~ to an absolute path#24
Lyther merged 1 commit into
mainfrom
fix/mcp-command-absolute-path

Conversation

@Lyther

@Lyther Lyther commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Bug

MCP servers failed to launch on most runtimes (Claude Code, etc.):

ENOENT: no such file or directory, posix_spawn '~/.local/bin/grimoire-server'

Root cause

Generated MCP configs used a literal ~/.local/bin/<bin> command (from registry/optional-services.json). Hosts posix_spawn/execvp the stdio command directly, with no shell, so ~ is never expanded → ENOENT. (A bare command name wouldn't fix it either: GUI-launched hosts have a minimal PATH without ~/.local/bin.) The reliable form is an absolute path.

Fix

  • selectedMcpServiceEntries (targets.mjs): at install mode only, resolve a leading ~/ in the MCP command to an absolute $HOME path (cloning the service so the cached registry object is untouched). build/check modes keep ~, so dist/ stays machine-agnostic and reproducible (byte-identical + the droid generated-check unaffected).
  • install.mjs: thread mode: "install" through the kilo config-merge path (its selectedMcpServiceEntries call lacked it).

Proof

  • Regression test (tests/agent-surface.test.mjs): install MCP commands must be absolute and contain no literal ~ (droid JSON + kilo array + the fixture merge loop). Failed before, passes after. Build/dist assertions still expect ~.
  • check · check generated · check rules · check commands · check subagents · build --target all · test — all green.
  • Re-installed to real host configs: 17 config merges; claude-code/cursor/codex/droid now show /Users/<user>/.local/bin/grimoire-server.

by mass-energy equivalence

Hosts posix_spawn the stdio MCP command directly (no shell), so the literal
~/.local/bin/<bin> in generated configs was never expanded -> ENOENT, MCP servers
failed to launch on most runtimes (Claude Code, etc.). At install time, expand a
leading ~/ in the MCP command to an absolute $HOME path in selectedMcpServiceEntries
(install mode only); dist/build keeps ~ so generated output stays machine-agnostic
and reproducible. Also thread mode:install through the kilo config-merge path.

Regression: tests assert install MCP commands are absolute (no literal ~); the
build/dist assertions still expect ~. check/generated/rules/commands/subagents +
build + test all green.

by mass-energy equivalence
@Lyther
Lyther merged commit baa2c64 into main Jul 5, 2026
2 checks passed
@Lyther
Lyther deleted the fix/mcp-command-absolute-path branch July 5, 2026 12:01
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