Skip to content

Connection to MongoDB MCP Server always show error despite being successful #670

@olishiz

Description

@olishiz

Describe the bug
The bug is about making a connection and listening between MongoDB MCP Server and MCP Inspector. I have my Windsurf serving my mongodb mcp server using the following mcpServers:

    "MongoDB": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server",
        "--connectionString",
        "mongodb://localhost:27017/",
        "--readOnly"
      ]
    },

To Reproduce
Steps to reproduce the behavior:

  1. Use Windsurf and append ur mcpServers here as follow:
{
  "mcpServers": {
    "MongoDB": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server",
        "--connectionString",
        "mongodb://localhost:27017/",
        "--readOnly"
      ]
    },
    "time": {
      "command": "uvx",
      "args": [
        "mcp-server-time"
      ],
      "env": {}
    },
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    },
    "browsermcp": {
      "command": "npx",
      "args": ["@browsermcp/mcp@latest"]
    }
  }
}

Expected behavior
I want to go into the portal - without having this DEBUG issue or not allowing me to inspect my mongodb collections - i want to test out the tools

Logs
If applicable, add logs to help explain your problem.

Opening browser...
New STDIO connection request
Query parameters: {"command":"npx","args":"-y mongodb-mcp-server@latest --connectionString mongodb://localhost:27017 --readOnly","env":"{\"HOME\":\"/Users/00140216oliversimchoohowe\",\"LOGNAME\":\"00140216oliversimchoohowe\",\"PATH\":\"/Users/00140216oliversimchoohowe/Development/inspector/node_modules/.bin:/Users/00140216oliversimchoohowe/Development/inspector/server/node_modules/.bin:/Users/00140216oliversimchoohowe/Development/inspector/node_modules/.bin:/Users/00140216oliversimchoohowe/Development/node_modules/.bin:/Users/00140216oliversimchoohowe/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/00140216oliversimchoohowe/Development/inspector/node_modules/.bin:/Users/00140216oliversimchoohowe/Development/node_modules/.bin:/Users/00140216oliversimchoohowe/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/opt/homebrew/opt/postgresql@14/bin:/Users/00140216oliversimchoohowe/.codeium/windsurf/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/00140216oliversimchoohowe/.nvm/versions/node/v22.15.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/sbin:/opt/homebrew/opt/postgresql@14/bin:/Users/00140216oliversimchoohowe/.codeium/windsurf/bin:/Users/00140216oliversimchoohowe/Library/Application Support/JetBrains/Toolbox/scripts\",\"SHELL\":\"/bin/zsh\",\"TERM\":\"xterm-256color\",\"USER\":\"00140216oliversimchoohowe\"}","transportType":"stdio"}
STDIO transport: command=/opt/homebrew/bin/npx, args=-y,mongodb-mcp-server@latest,--connectionString,mongodb://localhost:27017,--readOnly
Created server transport
Created client transport
Received POST message for sessionId de65190b-7463-4bfb-9c91-3d6df390c54c
Received POST message for sessionId de65190b-7463-4bfb-9c91-3d6df390c54c
Received POST message for sessionId de65190b-7463-4bfb-9c91-3d6df390c54c

As you can see, the MongoDB MCP Server is connected and able to listen to the MCP client

Additional context

As seen here:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions