Description
App
- Cursor
- Windsurf
- VSCode
- VSCode Insiders
- Claude Desktop
- Other
Affected Models (if applicable)
- Claude 3.5 Sonnet
- Claude 3.7 Sonnet
- GPT-4a
- o4-mini
- Other
Bug Description
I started the mobgodb-mcp-server with the following settings: npx -y mongodb-mcp-server
The environment variable is set: MDB_MCP_CONNECTION_STRING=mongodb://localhost:30017/vpc
Unfortunately, the app tries to connect to MongoDB via the default port 27017, but my MongoDB is accessible via port 30017 (locally within Kubernetes).
I do not need username and pw for the local connection as no credentials are stored. Connection with e.g. MongoDB Compass or other applications works without any problems.
Failed to connect to MongoDB instance using the connection string from the config: MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017 at Socket.<anonymous> (/Users/FOOBAR/.npm/_npx/191c568aa03d4fb8/node_modules/mongodb/lib/cmap/connect.js:285:44) at Object.onceWrapper (node:events:622:26) at Socket.emit (node:events:507:28) at emitErrorNT (node:internal/streams/destroy:170:8) at emitErrorCloseNT (node:internal/streams/destroy:129:3) at process.processTicksAndRejections (node:internal/process/task_queues:90:21) { errorLabelSet: Set(1) { 'ResetPool' }, beforeHandshake: false, [cause]: Error: connect ECONNREFUSED 127.0.0.1:27017 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1634:16) { errno: -61, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 27017 } } {"method":"notifications/message","params":{"level":"emergency","data":"[server]: Fatal error running server: Error: Failed to connect to MongoDB instance using the connection string from the config"},"jsonrpc":"2.0"}