#14622·cline

CLI hub mode: MCP server processes are never stopped after /clear or quitting; they accumulate until the hub daemon exits

Author: nnabberCreated Sep 28, 2026Updated Sep 28, 2026
LabelsCLIbeta

Cline Surface

CLI

Cline Version

3.0.65

Beta version

  • I am using a beta version of Cline

What happened?

In the CLI's hub mode, a session's stdio MCP server processes are never stopped when you leave that session, whether by /clear or by quitting the TUI. Each new session starts its own set of MCP servers, and the old ones stay alive under the --cline-hub-daemon process until the hub daemon itself exits.

With Serena configured (it also spawns clangd and lua-language-server), about a day and a half of normal use left 10 Serena instances plus their language servers running, while only 2 sessions were actually in use.

Expected: when a session is cleared or abandoned, or its last client detaches, the hub stops that session's runtime and its MCP servers. At minimum, an idle session should be reaped after a while.

Cause, from reading the 3.0.65 bundle (@cline/core/dist/hub/daemon/entry.js and the CLI binary):

  • MCP servers are loaded per session runtime. They are disposed only by the runtime's shutdown, which is called from shutdownSession / releaseSessionRuntime.
  • Those run only for session.delete (deleteSession → stopSession), a failed session, a finished non-interactive run (finalizeSingleRun), or the hub stopping (sessionHost.dispose("hub_server_stop")).
  • Interactive turns end in completeInteractiveTurn, which never shuts the session down.
  • In hub mode, the CLI client's stopSession(), stopRuntimeSession() and dispose() all just send session.detach, and the hub has no session.stop command.
  • The hub's session.detach handler and detachClientFromSessions() (on client disconnect) only remove the participant from sessionState. They never touch the runtime.
  • On /clear, the hub log shows only a session.create for the new session. Nothing is sent for the previous one.
  • I found no idle-session reaper in the hub.

So cli_interactive_shutdown / "stop session" in hub mode detaches but never stops anything. The MCP child processes, plus any language servers they started, live as long as the hub daemon does.

Steps to reproduce

  1. Configure any stdio MCP server in ~/.cline/data/settings/cline_mcp_settings.json, e.g. {"transport":{"type":"stdio","command":"uvx","args":["mcp-server-time"]}}.
  2. Start cline (interactive TUI, hub mode) and send any prompt so the session starts.
  3. Run /clear and send another prompt. Repeat a few times, and/or quit and restart cline.
  4. pgrep -af <mcp server command> shows one server process per session ever created since the hub started, all still running under the cline --cline-hub-daemon process.
  5. Stopping the hub daemon is the only thing that frees them.

This doesn't depend on the model or provider (the bug is in session lifecycle, not in model output).

Provider/Model

Local OpenAI-compatible endpoint via LiteLLM. The bug doesn't depend on the model.

Diagnostics

cline --version → 3.0.65, Node v24.20.0

System Information

OS: Pop!_OS 24.04 LTS (Linux 7.1.5)