Skip to content

Claude: MCP server does not start with nvm version #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Gervwyk opened this issue May 2, 2025 · 3 comments
Open

Claude: MCP server does not start with nvm version #192

Gervwyk opened this issue May 2, 2025 · 3 comments

Comments

@Gervwyk
Copy link

Gervwyk commented May 2, 2025

A pain to get it working in Cluade. Some co-workers got it working by adding env.PATH:

"MongoDB": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server",
        "--connectionString",
        "<xxx>"
      ],
      "env": {
        "PATH": "/Users/<xxx>/.nvm/versions/node/v22.15.0/bin:/bin"
      }
    }

I tried all advice in https://github.com/mongodb-js/mongodb-mcp-server with no luck.

@gagik
Copy link
Collaborator

gagik commented May 2, 2025

Hey, thank you for the report. Could you share part of the error logs from Claude you're getting, if possible?

Couple things that could help:

  • Set your nvm alias default to be a version >=20.0.0.
  • Check what node version your original npx installation was done under and re-install it globally.

@shashank-yelluri
Copy link

shashank-yelluri commented May 5, 2025

@gagik - similar thing for the cursor code editor as well, here is the config which is not working,

"MongoDB": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server",
        "--connectionString",
        "mongodb://<username>:<password>@localhost:27017/<db-name>?directConnection=true"
      ],
      "env": {
        "PATH": "/opt/homebrew/bin/npx"
      }
    }

Here are the logs,
2025-05-05 23:59:19.996 [info] goDB: Handling CreateClient action
2025-05-05 23:59:19.997 [info] goDB: Starting new stdio process with command: npx -y mongodb-mcp-server --connectionString mongodb://:@localhost:27017/?directConnection=true
2025-05-05 23:59:20.516 [info] goDB: Client closed for command
2025-05-05 23:59:20.516 [error] goDB: Error in MCP: Client closed
2025-05-05 23:59:20.516 [info] -mcp: Handling ListOfferings action
2025-05-05 23:59:20.516 [info] -mcp: Listing offerings
2025-05-05 23:59:20.516 [info] -mcp: Connected to stdio server, fetching offerings
2025-05-05 23:59:20.517 [error] user-clickup-mcp: [05/05/25 23:59:20] INFO Processing request of type server.py:534
ListToolsRequest

2025-05-05 23:59:20.518 [info] listOfferings: Found 3 tools
2025-05-05 23:59:20.518 [info] -mcp: Found 3 tools, 0 resources, and 0 resource templates
2025-05-05 23:59:20.521 [info] -mcp: Handling ListOfferings action
2025-05-05 23:59:20.521 [info] -mcp: Listing offerings
2025-05-05 23:59:20.521 [info] -mcp: Connected to stdio server, fetching offerings
2025-05-05 23:59:20.522 [info] listOfferings: Found 3 tools
2025-05-05 23:59:20.522 [info] -mcp: Found 3 tools, 0 resources, and 0 resource templates
2025-05-05 23:59:20.523 [info] ext7: Handling ListOfferings action
2025-05-05 23:59:20.523 [info] ext7: Listing offerings
2025-05-05 23:59:20.523 [info] ext7: Connected to stdio server, fetching offerings
2025-05-05 23:59:20.523 [info] listOfferings: Found 2 tools
2025-05-05 23:59:20.523 [info] ext7: Found 2 tools, 0 resources, and 0 resource templates
2025-05-05 23:59:20.524 [info] goDB: Handling ListOfferings action
2025-05-05 23:59:20.524 [error] goDB: No server info found

@gagik
Copy link
Collaborator

gagik commented May 6, 2025

@shashank-yelluri Thanks for the logs! Can you try verifying that npx is available in your terminal generally as well as running npx -y mongodb-mcp-server --connectionString mongodb://:@localhost:27017/?directConnection=true directly in your terminal and see if that reports any errors?

I wouldn't expect npx to be installed through homebrew. You may benefit setting PATH to "/opt/homebrew/bin/node" if you installed Node through homebrew, but this shouldn't generally be necessary.
I'd recommend installing it through instructions at https://nodejs.org/en/download. I would then recommend removing the PATH environment you have set.

If all else is failing, a workaround is to use npm install --global mongodb-mcp-server and set { command: "mongodb-mcp-server" ... } directly but then updating would be more manual, so through npx is best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants