Skip to content

Fail to connect with mongodb local mcp server setup using docker #297

Open
@saadshaikh3

Description

@saadshaikh3

I am using docker to set up a container of mongodb mcp server. It starts properly and the docker logs also indicate the restricted tools as I also pass the read only env.
Here are the docker logs:

2025-06-13 14:06:16 [DEBUG] 1003003 - tool: Prevented registration of create-index because read-only mode is enabled, its operation type, `create`, is disabled in the config
2025-06-13 14:06:16 [DEBUG] 1003003 - tool: Prevented registration of insert-many because read-only mode is enabled, its operation type, `create`, is disabled in the config
2025-06-13 14:06:16 [DEBUG] 1003003 - tool: Prevented registration of delete-many because read-only mode is enabled, its operation type, `delete`, is disabled in the config
2025-06-13 14:06:16 [DEBUG] 1003003 - tool: Prevented registration of update-many because read-only mode is enabled, its operation type, `update`, is disabled in the config
2025-06-13 14:06:16 [DEBUG] 1003003 - tool: Prevented registration of rename-collection because read-only mode is enabled, its operation type, `update`, is disabled in the config
2025-06-13 14:06:16 [DEBUG] 1003003 - tool: Prevented registration of drop-database because read-only mode is enabled, its operation type, `delete`, is disabled in the config
2025-06-13 14:06:16 [DEBUG] 1003003 - tool: Prevented registration of drop-collection because read-only mode is enabled, its operation type, `delete`, is disabled in the config
2025-06-13 14:06:16 [DEBUG] 1003003 - tool: Prevented registration of create-collection because read-only mode is enabled, its operation type, `create`, is disabled in the config

As I started the docker container I specified the ports to be 9091:8080 so now my MCP server is available at http://localhost:9091. But I have tried every possible way to connect to it, but I cannot figure out how I can, i remotely connect to this local MCP server from a local client.

I even tried to connect using MCP Inspector using http protocol but still got the following error:

Received POST message for sessionId undefined
New streamable-http connection
Query parameters: [Object: null prototype] {
  url: 'http://localhost:9091/mcp',
  transportType: 'streamable-http'
}
Connected to Streamable HTTP transport
Connected MCP client to server transport
Created streamable web app transport 065073a4-420f-4975-98d2-f0c81ebaf46f
Error from MCP server: TypeError: fetch failed
    at node:internal/deps/undici/undici:13392:13
    at async StreamableHTTPClientTransport.send (file:///C:/Users/user/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js:248:30) {
  [cause]: SocketError: other side closed
      at Socket.<anonymous> (node:internal/deps/undici/undici:6238:28)
      at Socket.emit (node:events:530:35)
      at endReadableNT (node:internal/streams/readable:1698:12)
      at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
    code: 'UND_ERR_SOCKET',
    socket: {
      localAddress: '::1',
      localPort: 50115,
      remoteAddress: '::1',
      remotePort: 9091,
      remoteFamily: 'IPv6',
      timeout: undefined,
      bytesWritten: 463,
      bytesRead: 0
    }
  }
}

So I am not really sure whats going on.

What's the transport protocol for the mongodb mcp server?
Is there a default port?

I can't find any documentation on connecting remotely to this locally setup mongo mcp server

Metadata

Metadata

Assignees

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