Skip to content

Desktop app local MCP can fail when PATH resolves an older Node, while CLI works #22299

Closed as not planned

Description

@tlerbao

Summary

When using the desktop app, a local MCP configured as npx -y @mcp_router/cli@latest connect fails with MCP error -32000: Connection closed.

The same config works from the terminal with opencode mcp list.

This looks like a desktop/runtime environment bug rather than an mcp-router bug. The desktop app appears to launch the MCP child process with a different Node/PATH resolution than the terminal.

Environment

  • OpenCode version: 1.4.3
  • macOS: 13.3 (22E252)
  • Terminal Node: v22.19.0
  • Also installed on machine: /usr/local/bin/node -> v16.16.0

MCP config

{
  "mcp": {
    "mcp-router": {
      "command": ["npx", "-y", "@mcp_router/cli@latest", "connect"],
      "environment": {
        "MCPR_TOKEN": "<redacted>"
      },
      "type": "local"
    }
  }
}

What happens

In the desktop UI, mcp-router shows as failed / disconnected.

OpenCode log shows:

file:///Users/.../.npm/_npx/.../node_modules/@hono/node-server/dist/index.mjs:23
var Request = class extends GlobalRequest {
              ^

TypeError: Class extends value undefined is not a constructor or null

And then:

MCP error -32000: Connection closed

Why this seems like a PATH / Node version issue

The failure is consistent with @mcp_router/cli being started under an older Node runtime where global.Request is not available.

On this machine:

  • terminal node -v -> v22.19.0
  • /usr/local/bin/node -v -> v16.16.0

The same mcp-router config works fine when run from terminal via opencode mcp list, but fails in the desktop app. That strongly suggests desktop and terminal are resolving a different Node / PATH for local MCP child processes.

Workaround

I was able to make the desktop app connect by forcing the MCP command to run with a PATH that puts Node 22 first, for example:

{
  "command": [
    "/bin/zsh",
    "-c",
    "export PATH="/Users/<user>/.nvm/versions/node/v22.19.0/bin:/usr/local/bin:/usr/bin:/bin"; exec npx -y @mcp_router/cli@latest connect"
  ]
}

After that, the desktop app connected successfully.

Expected

Desktop app local MCP startup should behave consistently with terminal opencode mcp list, or at least use a predictable Node runtime / PATH resolution strategy.

Possible fix direction

  • Make local MCP child processes use a controlled PATH / runtime instead of inheriting an ambiguous desktop environment
  • Or log the exact resolved executable / PATH / Node version used for local MCP startup to make this diagnosable

If useful, I can provide a cleaned log excerpt.

Activity

  1. github-actions commented on Apr 13, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct (e.g. it affects a version where #15195 was supposedly fixed, or the behavior is different), please add a comment clarifying how it differs.

  2. mcfarljw commented on May 8, 2026

    @mcfarljw

    I was having issues with both MCP and it being able to run my pnpm commands for linting fixes. #26321 (comment) fixes both issues for me on Mac as a workaround.

  3. github-actions commented on Jul 9, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions