Title: Docker stdio MCP servers duplicated on /new and /resume (v1.0.68) · Issue #4049 · github/copilot-cli · GitHub
Open Graph Title: Docker stdio MCP servers duplicated on /new and /resume (v1.0.68) · Issue #4049 · github/copilot-cli
X Title: Docker stdio MCP servers duplicated on /new and /resume (v1.0.68) · Issue #4049 · github/copilot-cli
Description: Summary On v1.0.68, running /new or /resume (resuming a session not started during the current CLI run) spawns a fresh set of stdio MCP docker run clients without tearing down the previous set. Duplicates accumulate within the same CLI p...
Open Graph Description: Summary On v1.0.68, running /new or /resume (resuming a session not started during the current CLI run) spawns a fresh set of stdio MCP docker run clients without tearing down the previous set. Dup...
X Description: Summary On v1.0.68, running /new or /resume (resuming a session not started during the current CLI run) spawns a fresh set of stdio MCP docker run clients without tearing down the previous set. Dup...
Opengraph URL: https://github.com/github/copilot-cli/issues/4049
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Docker stdio MCP servers duplicated on /new and /resume (v1.0.68)","articleBody":"## Summary\n\nOn **v1.0.68**, running `/new` or `/resume` (resuming a session not started during the current CLI run) spawns a **fresh set of stdio MCP `docker run` clients without tearing down the previous set**. Duplicates accumulate within the **same** CLI process for its entire lifetime.\n\nThis looks related to #3440 but is a **different code path**: #3440 was about `session.disconnect()` not killing stdio processes (fixed in 1.0.51). Here, **no disconnect happens at all** — the CLI re-initializes MCP servers on `/new`/`/resume` and spawns a new set while the old set stays connected, so the kill-on-disconnect logic never runs.\n\n## Environment\n\n- Copilot CLI **1.0.68**\n- macOS (Darwin arm64)\n- MCP servers configured as stdio Docker containers (`docker run -i --rm …`) in `~/.copilot/mcp-config.json` — one `github-mcp-server` + three `grafana` instances\n\n## Actual behavior\n\nEvery configured stdio MCP server is duplicated per `/new` or `/resume`. `docker ps` shows 2× (or more) of every server, all parented to the same live `copilot` process. Because the containers run with `--rm`, they only self-remove when the whole CLI exits — so they pile up for the entire CLI session.\n\n## Affected version\n\n1.0.68\n\n## Steps to reproduce the behavior\n\n1. Configure one or more stdio Docker-based MCP servers.\n2. Start the CLI (session A) → one set of `docker run` clients spawns.\n3. Run `/new`, **or** `/resume` a session that was **not** opened during the current CLI run.\n4. A second set of clients spawns; the first set is **not** disconnected.\n\n## Expected behavior\n\nOn `/new` or `/resume`, the CLI should either **reuse** the existing MCP server connections or **disconnect** the outgoing session's stdio MCP servers before starting new ones.\n\n## Additional context\n\n### Evidence\n\nSingle `copilot` PID `71692`, alive ~19 min, holding **two full sets** spawned ~2 min apart — none orphaned, all share that PID as parent:\n\n```console\n$ ps -eo pid,ppid,etime,command | grep '[d]ocker run'\n72222 71692 19:12 docker run -i --rm --network host … github-mcp-server\n72225 71692 19:11 docker run -i --rm … grafana/mcp-grafana -t stdio\n72226 71692 19:11 docker run -i --rm … grafana/mcp-grafana -t stdio\n72227 71692 19:11 docker run -i --rm … grafana/mcp-grafana -t stdio\n72869 71692 17:32 docker run -i --rm --network host … github-mcp-server\n72870 71692 17:31 docker run -i --rm … grafana/mcp-grafana -t stdio\n72871 71692 17:31 docker run -i --rm … grafana/mcp-grafana -t stdio\n72880 71692 17:30 docker run -i --rm … grafana/mcp-grafana -t stdio\n\n$ docker ps --format '{{.Image}}' | sort | uniq -c\n 6 grafana/mcp-grafana\n 2 nexus…/github/github-mcp-server\n```\n\n### Impact\n\nResource leak: duplicated containers consume memory/CPU and, for named containers, cause `container \"x\" already exists` errors on the next spawn. The only reliable cleanup today is fully exiting the CLI.\n\n### Related\n\n- #3440 (fixed the disconnect path in 1.0.51; this is the `/new` + `/resume` re-init path, still leaking on 1.0.68)","author":{"url":"https://github.com/rjvq85","@type":"Person","name":"rjvq85"},"datePublished":"2026-07-07T13:00:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/4049/copilot-cli/issues/4049"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6b023219-fc37-78b2-189d-a6cb857576b2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B2C6:2EEEB5:C596EC:10DCB90:6A4D55EF |
| html-safe-nonce | cd77c38b3edfd1ec50556dc65f93e1451d7e16cb46eeac567eeab75248a63321 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkM2OjJFRUVCNTpDNTk2RUM6MTBEQ0I5MDo2QTRENTVFRiIsInZpc2l0b3JfaWQiOiI4OTQ3NDE1NzM4NDIwNjQ3NDA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1961a7ab90bd3197d69b82acfaed0c8519451dad3a849a5806442da534ad0d09 |
| hovercard-subject-tag | issue:4828743692 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/copilot-cli/4049/issue_layout |
| twitter:image | https://opengraph.githubassets.com/365693dd7d57f96d5f805a7e3995bac5848c862f277c7842ced4d00765a93bda/github/copilot-cli/issues/4049 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/365693dd7d57f96d5f805a7e3995bac5848c862f277c7842ced4d00765a93bda/github/copilot-cli/issues/4049 |
| og:image:alt | Summary On v1.0.68, running /new or /resume (resuming a session not started during the current CLI run) spawns a fresh set of stdio MCP docker run clients without tearing down the previous set. Dup... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rjvq85 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6 |
| turbo-cache-control | no-preview |
| go-import | github.com/github/copilot-cli git https://github.com/github/copilot-cli.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 585860664 |
| octolytics-dimension-repository_nwo | github/copilot-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 585860664 |
| octolytics-dimension-repository_network_root_nwo | github/copilot-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 56fc8347865a14e2ec811533d68f929cf4e0ec19 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width