MCP servers disabled with /mcps reconnect after an idle Location eviction

Aperta
#62,868 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend, devtools

Direzione di ricerca

The report identifies MCP disconnect state being lost when a Location is evicted and rebuilt, and includes a scratch reproduction, but it names no source files or tests. Start by tracing Location service eviction and boot alongside the /mcps disable flow, then reproduce the reported disconnect → eviction → rebuild sequence. Done means disabled servers stay disconnected after rebuilding the Location, without breaking config-based startup.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

reproduced
Description

Disabling MCP servers with /mcps is undone after a Location is evicted and rebuilt. On 2.2.6 the log still shows location services evicted, then on the next request location services booted and mcp connected for every server I had disabled, with a new connectionID. A rebuilt Location initializes MCP from config only, so the runtime disconnect is discarded.

This also kills stateful local stdio MCP servers: rea keeps its project in memory, so the next call starts a new process and a 3–4 hour analysis has to be redone.

This is not the 2.2.6 shutdown-event bug from #60668; that stops MCP events during shutdown, but the next boot still reconnects. It is also not #13763 (V1 restart, closed not planned). #57902 is the same mechanism for ACP-added servers, but an ACP fix would re-add those servers, not preserve a /mcps override.

I reproduced it in the v2.2.6 source (tag dc2ffcf) with a scratch test: MCP.disconnect → status "disabled", close the Location scope as eviction does, rebuild → status "connected" and a second mcp connected with a new connectionID.

Plugins

opencode-loop (from ~/.config/opencode/plugins), not MCP-related.

OpenCode version

2.2.6 (tested at tag v2.2.6 / dc2ffcf; also reproduced on 2.2.5)

Steps to reproduce
  1. Configure a stateful local stdio MCP server (in my case rea with npx -y [email protected] mcp) plus other MCP servers.
  2. Open /mcps and disable all of them.
  3. Use a stateful tool in a session (e.g. rea.open_binary + rea.binary_overview).
  4. Leave the location idle for more than 60 minutes (or run /reload).
  5. Send another prompt and check the log.
Screenshot

2026-11-08T23:30:04 location services evicted ...\Downloads\reatests
2026-11-09T09:39:15 location services booted ...\Downloads\reatests
2026-11-09T09:39:28 mcp connected server=rea tools=229 ... connectionID=0a3bd776-d518-4706-9807-460ac6eca116

Operating System

Windows 10

Terminal

Windows Terminal

Lingua principale
TypeScript
Stelle
225k
Fork
30.4k
Merge medio
4h 16m
PR unite (30g)
528

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anomalyco/opencode

Tutte le issue di anomalyco/opencode

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.