Skip to content

Some docker based MCPs prevent opencode shutdown #1195

Closed

Description

@ucirello

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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