Some docker based MCPs prevent opencode shutdown #841

Closed
opened 2026-02-16 17:28:31 -05:00 by yindo · 0 comments
Owner

Originally created by @ucirello on GitHub (Jul 21, 2025).

Originally assigned to: @thdxr on GitHub.

Take this opencode.json configuration as an example:

{
        "$schema": "https://opencode.ai/config.json",
        "autoupdate": true,
        "share": "disabled",
        "instructions": [
                ".opencode.instructions.md"
        ],
        "mcp": {
                "clickhouse": {
                        "type": "local",
                        "command": [
                                "docker",
                                "run",
                                "--net", "host",
                                "-i",
                                "--rm",
                                "-e", "CLICKHOUSE_HOST",
                                "-e", "CLICKHOUSE_PORT",
                                "-e", "CLICKHOUSE_USER",
                                "-e", "CLICKHOUSE_SECURE",
                                "-e", "CLICKHOUSE_VERIFY",
                                "-e", "CLICKHOUSE_CONNECT_TIMEOUT",
                                "-e", "CLICKHOUSE_SEND_RECEIVE_TIMEOUT",
                                "-e", "CLICKHOUSE_PASSWORD",
                                "mcp/clickhouse"
                        ],
                        "environment": {
                                "CLICKHOUSE_HOST": "localhost",
                                "CLICKHOUSE_PORT": "8123",
                                "CLICKHOUSE_USER": "chuser",
                                "CLICKHOUSE_SECURE": "false",
                                "CLICKHOUSE_VERIFY": "false",
                                "CLICKHOUSE_CONNECT_TIMEOUT": "30",
                                "CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30",
                                "CLICKHOUSE_PASSWORD": "chpassword"
                        }
                }
        }
}

Once the session is initiated and the docker container starts, it will prevent the normal shutdown of opencode. When I manually executedocker rm -f $CONTAINER, then opencode correctly stops.

And interestingly enough (probably because it correctly traps SIGINT), if I call /exit and then ˆC it out, the docker container is also correctly stopped.

More info:

$ opencode --version
0.3.48
$ uname -a
Darwin MBP.local 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:52:00 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6031 arm64
Originally created by @ucirello on GitHub (Jul 21, 2025). Originally assigned to: @thdxr on GitHub. Take this opencode.json configuration as an example: ``` { "$schema": "https://opencode.ai/config.json", "autoupdate": true, "share": "disabled", "instructions": [ ".opencode.instructions.md" ], "mcp": { "clickhouse": { "type": "local", "command": [ "docker", "run", "--net", "host", "-i", "--rm", "-e", "CLICKHOUSE_HOST", "-e", "CLICKHOUSE_PORT", "-e", "CLICKHOUSE_USER", "-e", "CLICKHOUSE_SECURE", "-e", "CLICKHOUSE_VERIFY", "-e", "CLICKHOUSE_CONNECT_TIMEOUT", "-e", "CLICKHOUSE_SEND_RECEIVE_TIMEOUT", "-e", "CLICKHOUSE_PASSWORD", "mcp/clickhouse" ], "environment": { "CLICKHOUSE_HOST": "localhost", "CLICKHOUSE_PORT": "8123", "CLICKHOUSE_USER": "chuser", "CLICKHOUSE_SECURE": "false", "CLICKHOUSE_VERIFY": "false", "CLICKHOUSE_CONNECT_TIMEOUT": "30", "CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30", "CLICKHOUSE_PASSWORD": "chpassword" } } } } ``` Once the session is initiated and the docker container starts, it will prevent the normal shutdown of opencode. When I manually execute`docker rm -f $CONTAINER`, then opencode correctly stops. And interestingly enough (probably because it correctly traps SIGINT), if I call `/exit` and then ˆC it out, the docker container is also correctly stopped. More info: ``` $ opencode --version 0.3.48 $ uname -a Darwin MBP.local 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:52:00 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6031 arm64 ```
yindo closed this issue 2026-02-16 17:28:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#841