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

Aberta
#62,868 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
backend, devtools

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
TypeScript
Estrelas
225k
Forks
30.4k
Merge médio
4h 16min
PRs com merge (30d)
528

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de anomalyco/opencode

Todas as issues de anomalyco/opencode

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.