Skip to content

[VS Code] MCP tools don't reconnect to existing Copilot Chat session after extension host restart #160

@mfraile

Description

@mfraile

Description

When the VS Code extension host shuts down and restarts (which can happen for various reasons — extension updates, memory pressure, crashes), the Engram MCP stdio server is killed along with it. The server restarts successfully and re-discovers all 15 tools, but existing Copilot Chat sessions lose access to all mem_* tools permanently.

The only fix is to close the chat and start a new one — but there's no visible indicator to the user that tools have disconnected. This causes silent memory loss for the affected session.

Evidence from MCP output log

2026-04-06 11:27:19.994 [warning] Extension host shut down, server will stop.
2026-04-06 11:27:19.994 [info] Connection state: Stopped
2026-04-06 11:28:17.569 [info] Starting server engram
2026-04-06 11:28:17.569 [info] Connection state: Starting
2026-04-06 11:28:17.570 [info] Connection state: Running
2026-04-06 11:28:17.770 [info] Discovered 15 tools

Server restarts and discovers tools, but the active Copilot Chat session reports tools as "disabled by the user" when the agent tries to call them.

Environment

  • Engram: v1.11.0 (Homebrew)
  • VS Code: 1.113.0
  • OS: macOS 26.3.1 (Mac Mini M4 Pro)
  • MCP config: Workspace .vscode/mcp.json with stdio transport
{
  "servers": {
    "engram": {
      "type": "stdio",
      "command": "engram",
      "args": ["mcp"],
      "env": {
        "ENGRAM_PROJECT": "naos-factory"
      }
    }
  }
}

Impact

  • Silent session memory loss — user has no idea Engram disconnected. An entire day's work can go unrecorded (happened April 5, 2026 — full session lost)
  • No self-healing — restarting the server from MCP panel doesn't re-bind tools to the active chat
  • User must know the workaround — close chat and open a new one

Suggested improvements

  1. Document this limitation in docs/AGENT-SETUP.md under VS Code — warn users that extension host restarts break MCP tool bindings in active chats
  2. Consider VS Code Chat Plugin API support (chat.pluginLocations + chat.plugins.enabled) which provides lifecycle hooks with health checks and auto-restart (ref: felifranco/engram-vscode-plugin)
  3. This may also warrant a VS Code upstream issue — the MCP runtime should re-bind tools to active chat sessions after server reconnection

Note

This is likely a VS Code MCP runtime limitation rather than an Engram bug. However, since VS Code is a documented first-class agent in Engram's setup guide, it's worth tracking here and documenting the workaround. The OpenCode plugin doesn't have this problem because it manages its own session resilience via ensureSession().

Metadata

Metadata

Assignees

No one assigned

    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