MongoDB MCP Doesn't Remove Containers on Disabling

Describe the Bug

I am using the MongoDB Docker MCP, with a config as follows:

        "mongodb": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "MDB_MCP_CONNECTION_STRING",
                "mcp/mongodb"
            ],
            "env": {
                "MDB_MCP_CONNECTION_STRING": "mongodb://host.docker.internal:27017"
            }
        }

Enabling this MCP server in the Cursor UI starts a Docker container with a random name. Disabling the MCP server doesn’t --rm this container, despite that being set in the arguments. As a result, a new container is created every time the connection is enabled/disabled.

Steps to Reproduce

Install the MongoDB MCP in Docker, add this config, enable/disable the server repeatedly.

Expected Behavior

It should destroy the container upon disabling.

Screenshots / Screen Recordings

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.2.4 (user setup)
VSCode Version: 1.99.3
Commit: a8e95743c5268be73767c46944a71f4465d05c90
Date: 2025-07-10T17:09:01.383Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.22631

Does this stop you from using Cursor

No - Cursor works, but with this issue

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.