mongodb-mcp-server Docker container doesn't exit — fixed in v0.1.2?
Running mongodb-mcp-server 0.1.1 via Docker in Claude Desktop with
docker run --rm -i, the container stays running after Claude Desktop exits, and each restart spawns another instance. Commenters report the same on VS Code, Zed, and when launching via npx. Is there a fix?Originally asked on GitHub: https://github.com/mongodb-js/mongodb-mcp-server/issues/279
3 answers
Status: fixed in v0.1.2 per the maintainer, and the issue is closed as completed. Note that the thread does not include a user-verified confirmation that upgrading resolves the symptom; the maintainer's comment is the only source.
The original setup used this Claude Desktop config:
json"my-moongodb-env": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "MDB_MCP_CONNECTION_STRING=mongodb+srv://...", "mongodb/mongodb-mcp-server:latest" ] }On 0.1.1 the container stayed alive after the client exited and a new one appeared on each restart, even with
--rm. The same behavior was reported by commenters in VS Code and Zed, and with an npx-launched server where the node process remained in the background and a new process started every time. A different MCP server (mcp/postgres) with the same Docker flags exited normally, so this was specific to mongodb-mcp-server.The maintainer said the fix was merged and released in both npm and Docker at v0.1.2 (linked in the thread). To pick it up, re-pull the Docker image (the reported config uses
:latest, which was 0.1.1 at the time) or update the npm package to 0.1.2. The thread does not give a specific upgrade command beyond the release link.General advice: after upgrading, fully quit the MCP client and check
docker ps(or your process list) to clean up leftover containers/processes before testing again.Security note: the
MDB_MCP_CONNECTION_STRINGin the MCP config contains database credentials in plaintext, so keep that config file private and don't paste it into issue trackers.Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Ran mongodb/mongodb-mcp-server:latest in Claude Desktop with
docker run --rm -i -e MDB_MCP_CONNECTION_STRING=...; the container stayed running after Claude Desktop exited and a second instance appeared on restart.Source: https://github.com/mongodb-js/mongodb-mcp-server/issues/279 (opens external site)
Did this work for you?What @ayuvlasenko tried on GitHub (Didn't work)
Started the server via npx instead of Docker; the node process stayed in the background and a new process was spawned every time.
Did this work for you?
Related questions
- mongodb-mcp-server count tool ignores filter and returns total collection count in Cursor
- mongodb-mcp-server fails to start with nvm in Claude, Cursor, or VS Code: how to fix?
- mongodb-mcp-server in Docker: can't connect via HTTP to localhost:9091 — what transport does it use?
- How do I export MongoDB query results to JSON in mongodb-mcp-server?
- Can mongodb-mcp-server be hosted as a remote MCP server over HTTP?