continue icon indicating copy to clipboard operation
continue copied to clipboard

NPX not available to start MCP server, but available in VSCode Terminal

Open andreimirt opened this issue 8 months ago • 15 comments

Before submitting your bug report

Relevant environment info

- OS: Windows 11
- Continue version: pre-release
- IDE version: 1.98.2
- Model: not relevant
- config:
  

  
  OR link to assistant in Continue hub:

Description

The image below shows the issue the best. npx is available in the system and in the terminal in VSCode, but the continue.dev can't see it to run npx for the brave search MPC. Image

To reproduce

No response

Log output


andreimirt avatar Mar 24 '25 19:03 andreimirt

me too

zjh-nuc-AIOT avatar Mar 25 '25 07:03 zjh-nuc-AIOT

I've tried to adjust the command to point to the actual path, but I still cannot run with npx.

limslmao avatar Mar 31 '25 03:03 limslmao

Same problem for me, plese help

FRitaRr avatar Apr 03 '25 21:04 FRitaRr

I found a workaround to this. Go to your assistant definition on the web and define the MCP server manually, ensuring you run it with cmd instead of powershell, as such:

mcpServers:
  - name: Memory MCP
    command: cmd.exe
    args:
      - /c
      - npx
      - -y
      - "@modelcontextprotocol/server-memory"

psimsa avatar Apr 07 '25 07:04 psimsa

I used this after npx cli not found error

Vscode continue config

  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "docker",
          "args": [
            "run", 
            "-i", 
            "--rm", 
            "mcp/postgres", 
            "postgresql://postgres:[email protected]:54322/postgres"]
        }
      }
    ]
  },

AkifAycicek avatar Apr 15 '25 11:04 AkifAycicek

Same problem here.

kije avatar May 05 '25 11:05 kije

Hi all, apologies for the delay here, we'll be digging into this shortly.

In the meantime, the solution from @ozshen in this post worked:

mcpServers:
  - name: Server Memory
-   command: npx
+   command: "cmd"
    args:
+     - /c
+     - npx
      - "-y"
      - "@modelcontextprotocol/server-memory"

Patrick-Erichsen avatar May 05 '25 22:05 Patrick-Erichsen

Hi all, apologies for the delay here, we'll be digging into this shortly.

In the meantime, the solution from @ozshen in this post worked:

mcpServers:

  • name: Server Memory
  • command: npx
  • command: "cmd" args:
  • - /c
    
  • - npx
    - "-y"
    - "@modelcontextprotocol/server-memory"
    

On Mac/Linux, this unfortunately does not work (as obviously cmd.exe is not available). Also with something like sh for the command with -c as the argument does not work (for me at least)

kije avatar May 05 '25 22:05 kije

I have a similar problem on linux. MCP servers suing npx or docker showing this:

Image Note that the same MCP servers work with copilot (on vscode) This is the config:

 "experimental": {
    "modelContextProtocolServers": [
      {
        "name": "github",
        "transport": {
          "type": "stdio",
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "GITHUB_PERSONAL_ACCESS_TOKEN",
            "ghcr.io/github/github-mcp-server"
          ],
          "env": {
            "GITHUB_PERSONAL_ACCESS_TOKEN": "XXX"
          }  
        }
      },
      {
        "name": "kubernetes",
        "transport": {
          "type": "stdio",
          "name": "kubernetes",
          "command": "npx",
          "args": ["-y", "kubernetes-mcp-server@latest"]
        }  
      }
    ]
  },

eranco74 avatar May 08 '25 08:05 eranco74

The issue is resolved in the pre-release version

eranco74 avatar May 08 '25 08:05 eranco74

This is NOT solved for macOS! I still have the problem!

IngLP avatar May 26 '25 08:05 IngLP

@IngLP same issue on latest release? I believe this was just an issue for JetBrains + macOS but lmk if you're having issues

Patrick-Erichsen avatar Jun 10 '25 01:06 Patrick-Erichsen

Yes, same issue. Now the error is Failed to connect to "Memory" Error: MCP error -32000: Connection closed Process output: STDERR: env: node: No such file or directory

IngLP avatar Jun 10 '25 08:06 IngLP

Same Here with docker

2025-06-14 17:17:35.186 [info] Starting server from Remote extension host 2025-06-14 17:17:35.197 [info] Connection state: Starting 2025-06-14 17:17:35.198 [info] Connection state: Error spawn docker ENOENT

Iyadomry avatar Jun 14 '25 14:06 Iyadomry

I just started encountering this original issue on Linux after switching my primary shell from zsh to fish. My terminal, including the one inside VSCode and RustRover, can detect npx at /usr/bin/npx, but Continue is giving the "npx not found" error in both IDEs.

shssoichiro avatar Jun 15 '25 06:06 shssoichiro

I have tried running it as an installed package using cmd, moving to different node, npm and npx version and had no luck. Reading above docker-ising doesn't work. Anyone found a work around? Anyone has an update? MCP seems to be more and more important but I really dont want to move from Continue

GoffAC avatar Jun 20 '25 14:06 GoffAC

@GoffAC are you on latest release? I thought that this had been fixed with #6157 but if you're still having the issue would be curious to know the following:

  • Continue version
  • OS
  • Shell
  • IDE (VS Code or JetBrains)

Patrick-Erichsen avatar Jun 30 '25 23:06 Patrick-Erichsen

hey so I am using Continue on Agent mode with all the configuration wrote above here and no luck. let's assume some configuration will work, how do i use it? just type a prompt and it should work? i am confused. ty

seab4ng avatar Jul 03 '25 15:07 seab4ng

I find the way to fix this question in Mac, you can screenshot the question to AI, such as vscode plugins---augment, it help me check and give me answer: It found, when use '' which node", it can't find "node", because I use "nvm". It ask me, change "command" to : /bin/zsh -c "source ~/.nvm/nvm.sh && npx -y @upstash/context7-mcp@latest"

or /Users/mac/.nvm/versions/node/v23.9.0/bin/npx -y @upstash/context7-mcp@latest

Then it works!

Image

Jennifer249 avatar Jul 05 '25 08:07 Jennifer249

found a "MAYBE" workaround way.

{
  "servers": {
    "Framelink Figma MCP": {
      "command": "npx",
      "args": ["-y", " figma-developer-mcp", "--figma-api-key=xxx", "--stdio"],
    }
  }
}

Problem When configuring the Framelink Figma MCP server, using "command": "npx" results in “npx not found.” If you specify the full path to npx, it then complains that node is not found. This makes it a dead end on some setups (e.g., when using nvm or non-global Node.js installs).

Workaround Instead of calling npx directly, use a shell script that sets up the correct Node.js environment and then runs the command. Update your server config

{
  "servers": {
    "Framelink Figma MCP": {
      "command": "sh",
      "args": ["<path-to-your>/.vscode/figmaMcp.sh"],
    }
  }
}
# Add nvm Node.js bin to $PATH
NODE_PATH=<your-nvm-path>/.nvm/versions/node/v20.14.0/bin
export PATH="$NODE_PATH:$PATH"
node -v
npx -y figma-developer-mcp --figma-api-key=xxxx --stdio

kpchen104 avatar Jul 10 '25 14:07 kpchen104

Thank you @kpchen104 it worked on MacOS 🥳

AlefAlfa avatar Jul 20 '25 09:07 AlefAlfa

I had the same issue on linux using vscodium-wayland.

The issue appeared to be privilege related. I noticed I was able to set the command to bash or zsh and have it run npx via its absolute path (pulled from which npx) (other attempts to run npx directly or via other commands would resolve to command not found)

Part of the output when trying to run npx via bash/zsh appeared to be privilege related so I ran vscodium as root (which is not recommended) with vscodium --no-sandox --user-data-dir

After running as root I was able to use other commands again like npx and setup the MCP. I didn't have to play around with proxy-ing npx through bash or zsh, etc.

For additional context: I setup the MCP in the config.yaml file

Basketballforce avatar Aug 03 '25 05:08 Basketballforce

running into this same issue i with rider 2025.2.2.1 plugin 1.0.46 - i am not sure from this thread if this issue is resolved or what the actual work around is ( dopey me )

Image

germgerm avatar Oct 04 '25 13:10 germgerm

@dosubot you are either missing labels for macOS and Linux or should remove specific one for Windows. @eranco74 issue is currently resolved only for Windows.

jagomf avatar Oct 16 '25 13:10 jagomf

Hi @jagomf! I'm Dosu and I’m helping the continue team.

You're right—the issue is currently resolved only for Windows, while macOS and Linux are still affected. The labels should reflect this so users on all platforms are aware of the current status. Thanks for pointing out the need to update or correct the platform labels.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

dosubot[bot] avatar Oct 16 '25 13:10 dosubot[bot]

Hey everyone! After analyzing this issue, I've identified a clear solution that would help all the users experiencing this problem across Windows, macOS, and Linux.

The Problem

The root cause is that Continue's child processes don't inherit the full PATH environment that includes Node.js binaries - especially when using version managers like nvm, fnm, or volta. This is why npx works in your terminal but not in Continue.

The Solution Path

We need to enhance PATH discovery in 3 focused areas:

  1. core/util/shellPath.ts - Enhance getEnvPathFromUserShell() to:

    • Add Windows support (currently returns undefined on Windows!)
    • Search common Node.js installation directories
    • Support fish shell and other shells beyond bash/zsh
    • Auto-detect nvm, fnm, volta, asdf installations
  2. core/util/commandUtils.ts (new file) - Add utilities to:

    • Find commands using which/where
    • Check common installation paths as fallback
    • Resolve Windows batch files (.cmd/.bat)
  3. core/context/mcp/MCPConnection.ts - Minor update to:

    • Use the enhanced PATH from step 1
    • Apply command resolution from step 2

Good First Contribution

  • Clear scope: The changes are isolated to specific files
  • Testable: Each component can be unit tested independently
  • High impact: Fixes a critical issue affecting many users
  • Learning opportunity: Great way to understand how Continue handles system integration

Implementation Notes

The core logic is adding path detection for common Node.js locations:

  • Windows: %APPDATA%\npm, %ProgramFiles%\nodejs, Scoop paths
  • macOS/Linux: ~/.nvm, ~/.fnm, /opt/homebrew/bin, etc.

Getting Started

  1. The existing Windows batch command handling in MCPConnection already works
  2. The main work is enhancing PATH discovery for all platforms
  3. Tests can use vitest (already in the project) to verify the path detection

There are many users blocked by this issue, and a contribution here would be greatly appreciated by the community. This fix would unblock everyone who wants to use MCP servers but is stuck with the "npx not found" error.

@psimsa @Jennifer249 @kpchen104 - your workarounds show you understand the problem well - would any of you be interested in turning those insights into a proper fix?

cc @Patrick-Erichsen for a second review on this.

bdougie avatar Oct 17 '25 03:10 bdougie

@germgerm I believe JB launches under a different scope than VS Code so the errors there are different. Any chance you're able to try it out on VSC to verify this in your case?

Patrick-Erichsen avatar Oct 20 '25 20:10 Patrick-Erichsen