Mongodb-mcp-server fails to connect to mongodb database

I am running mongodb and mcp as docker containers. mongodb is accessible via mongosh, and connects, authenticates fine. I am getting mongosh shell.
But, I am not able to connect using MCP server.

I am trying to run mongodb database with MCP for a AI use case.
I started mongodb:
podman run -d
–name mongo8
-p 27017:27017
-e MONGO_INITDB_ROOT_USERNAME=admin
-e MONGO_INITDB_ROOT_PASSWORD=secret
mongo

I tried to run MCP:
export MDB_MCP_CONNECTION_STRING=“mongodb://admin:secret@0.0.0.0:27017/test”

podman run -i --rm -p 8081:8081 |
-e MDB_MCP_CONNECTION_STRING=mongodb://admin:secret@0.0.0.0:27017/test?authSource=admin |
-e MDB_MCP_READ_ONLY=true |
mongodb://admin:secret@0.0.0.0:27017 |
–transport http --httpHost=0.0.0.0 --httpPort=8081
mongodb/mongodb-mcp-server:latest

I don’t see any logs in mongodb when MCP is started.
Do I need to enable more flags or some missing config?

Hi @Balakrishna_Bhamidipati, the short version is that it looks like it’s a misconfiguration with the network. One of our engineering team members has put together a sample repo with readme that should help you here:

Hope that helps!

1 Like

Thanks, it worked. Is there any python based MCP client to run from cli ?

Great to hear you’re up and running. We don’t provide a python-based MCP client ourselves, but have you tried one - there are a few in this list, for example that should work for your requirements: GitHub - punkpeye/awesome-mcp-clients: A collection of MCP clients.