{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibj3dnc4as7sg34azjnzc3wxl3rb3f6bl4cb7uyeyzlj6pykkwl34",
"uri": "at://did:plc:lk3jfj3zq4k4wxnk474axylu/app.bsky.feed.post/3mfrnjl5jg2c2"
},
"path": "/t/stdio-mcp-servers-docker-cmd-per-sub-agent-never-release-until-codex-is-exited-entirely/1375209#post_1",
"publishedAt": "2026-02-26T16:32:00.000Z",
"site": "https://community.openai.com",
"textContent": "So when using MCP Servers from a Docker command they are spawned per sub agent that is used, naturally. However, those instances are not released nor shutdown until Codex itself is exited (`/exit`) and so can eat up system resources via Docker. Each sub agent will receive it’s own STDIO (as configured) MCP server SET (let’s say I have 3) every sub agent spawn.\n\nWhen running long sessions in Codex CLI, this can potentially, and has, led to 10’s if not a 100 instances of MCP servers because they aren’t being released.\n\nForcing an exit out of Codex isn’t desirable to clean these resources up. I presume this is a bug in the CLI sub agent handling.\n\nAn example configuration in this scenario is as follows:\n\n\n [mcp_servers.github]\n command = \"docker\"\n args = [\"run\",\"-i\",\"--rm\",\n \"--env-file\",\n \"~/.config/mcp/github.env\",\n \"mcp/github\"\n ]\n",
"title": "STDIO MCP Servers (Docker cmd) per sub-agent never release until Codex is exited entirely"
}