Skip to content

MCP servers: npx not recognized when installed with nvm #282

@mahdi-malv

Description

@mahdi-malv

Describe the bug

When tying to add an mcp that uses nvx, and the nvx is accessible through .nvm, the path will not be recognozed

# where npx
~/.nvm/versions/node/v22.14.0/bin/npx

Versions

  • Copilot for Xcode: 0.34.117
  • Xcode: 16.0
  • macOS: 15.4.1

Steps to reproduce

  1. Have your npx command accessible through node version manager

  2. Import an nvx server such as brave-search

    {
        "servers": {
            "brave-search": {
              "command": "npx",
              "args": ["-y", "@modelcontextprotocol/server-brave-search"],
              "env": {
                "BRAVE_API_KEY": "API_KEY"
              }
            }
        }
    }
  3. Save and reload

Screenshots

Image

Logs

...

[2025-05-13T11:43:47.158Z] [info] [GitHubCopilot] [70572] window/logMessage: {
  "message" : "[CopilotMCP] Error initializing MCP server brave-search: Error: spawn npx ENOENT\n    at Process.ChildProcess._handle.onexit (node:internal\/child_process:285:19)\n    at onErrorNT (node:internal\/child_process:483:16)\n    at processTicksAndRejections (node:internal\/process\/task_queues:82:21) {\n  errno: -2,\n  code: 'ENOENT',\n  syscall: 'spawn npx',\n  path: 'npx',\n  spawnargs: [ '-y', '@modelcontextprotocol\/server-brave-search' ]\n}",
  "type" : 1
}

...

Additional context

  • Issue doesn't occur for uvx servers such as fetch
# where uvx
/opt/homebrew/bin/uvx

Metadata

Metadata

Assignees

No one assigned

    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