Skip to content

Unable to start MCP via 'npx' when node is installed with 'nvs', but okay if installed globally #101

@thesunlover

Description

@thesunlover

I am using nvs to setup node, so I have the following setup for my vscode:
.vscode\settings.json:

{
  "terminal.integrated.env.windows": {
    "PATH": "%localappdata%/nvs/node/22.17.0/x64;${env:PATH}"
  },
  "eslint.nodePath": "%localappdata%/nvs/node/22.17.0/x64",
  "chat.mcp.discovery.enabled": true,
  "chat.agent.enabled": true
}

.vscode/mcp.json:

{
  "servers": {
      "salesforce": {
          "type": "stdio",
          "command": "npx",
          "args": [
              "-y",
              "@salesforce/mcp",
              "--orgs",
              "myOrg",
              "--toolsets",
              "all"
          ]
      }
  }
}

The error I am getting is:
The command "npx" needed to run salesforce was not found. as on the screenshot below:
Image
The error in the MCP console looks like this:

2025-07-09 18:30:31.081 [info] Connection state: Starting
2025-07-09 18:30:31.087 [info] Starting server from LocalProcess extension host
2025-07-09 18:30:31.139 [info] Connection state: Starting
2025-07-09 18:30:31.140 [info] Connection state: Error spawn npx ENOENT

adding PATH environment still didn't help:

          "env": {
            "PATH": "%localappdata%/nvs/node/22.17.0/x64;${env:PATH}"
          }

Then I finally tried to install globally and update the config to:

{
  "servers": {
      "salesforce": {
          "type": "stdio",
          "command": "C:\\Users\\myuser\\AppData\\Local\\nvs\\node\\22.17.0\\x64\\sf-mcp-server.cmd",
          "args": [
              "--orgs",
              "myOrg",
              "--toolsets",
              "all"
          ]
      }
  }
}

another working mcp.json:

{
  "servers": {
      "salesforce": {
          "type": "stdio",
          "command": "C:\\Users\\myuser\\AppData\\Local\\nvs\\node\\22.17.0\\x64\\npx.cmd",
          "args": [
              "-y",
              "@salesforce/mcp",
              "--orgs",
              "myOrg",
              "--toolsets",
              "all"
          ]
      }
  }
}

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