Skip to content

resolve-pnpm.js skips standalone binary MCP servers (e.g. codegraph) #1

@kylebrodeur

Description

@kylebrodeur

Problem

The resolve-pnpm.js resolver only rewrites entries that use pnpm dlx (or have an existing command/args shape it recognizes). Standalone Node.js binaries installed globally via npm — such as @colbymchenry/codegraph — end up with a bare command name and no wsl.exe prefix after running the resolver.

Affected config (before fix)

"codegraph": {
  "type": "stdio",
  "command": "codegraph",
  "args": ["serve", "--mcp"]
}

VS Code (Windows host) launches this via wsl.exe with no login shell, so codegraph is not on PATH → server exits immediately / never responds to initialize.

Manual fix applied

"codegraph": {
  "type": "stdio",
  "command": "wsl.exe",
  "args": [
    "-e",
    "env",
    "PATH=/home/kylebrodeur/.local/share/fnm/aliases/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
    "/home/kylebrodeur/.local/share/fnm/aliases/default/bin/codegraph",
    "serve",
    "--mcp"
  ]
}

Suggested fix

When the resolver encounters a stdio server whose command is a bare binary name (no path separators, not wsl.exe, not node, not pnpm) and we are in WSL writing to a Windows target:

  1. Run which <command> inside WSL to resolve the absolute path.
  2. Wrap it with the same wsl.exe -e env PATH=<fnm-bin>:<std-paths> <abs-path> ...args prefix used for pnpm servers.
  3. Preserve the original args array unchanged (the binary's own subcommands/flags).

This would make the resolver idempotent and comprehensive for any npm-installed global binary, not just pnpm-launched packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions