fix(install): resolve MCP command ~ to an absolute path#24
Merged
Conversation
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
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.
Bug
MCP servers failed to launch on most runtimes (Claude Code, etc.):
Root cause
Generated MCP configs used a literal
~/.local/bin/<bin>command (fromregistry/optional-services.json). Hostsposix_spawn/execvpthe 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$HOMEpath (cloning the service so the cached registry object is untouched).build/checkmodes keep~, sodist/stays machine-agnostic and reproducible (byte-identical + the droid generated-check unaffected).install.mjs: threadmode: "install"through the kilo config-merge path (itsselectedMcpServiceEntriescall lacked it).Proof
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./Users/<user>/.local/bin/grimoire-server.by mass-energy equivalence