Skip to content

fix(mcp): MCP server loses connection mid-session causing intermittent failures #23997

@herjarsa

Description

@herjarsa

Pre-flight Checks

  • I have searched existing issues and this is not a duplicate
  • I understand this issue needs status:approved before a PR can be opened

Bug Description

The MCP server intermittently loses connection mid-session, causing multiple MCP tools to return "Not connected". This happens after the connection was successfully established and used.

Steps to Reproduce

  1. Start an OpenCode session
  2. Verify MCPs work (e.g., supabase_list_projects returns data)
  3. Use multiple MCP calls over several minutes
  4. Eventually, MCPs like Supabase, Desktop Commander, n8n, and Universal Brain return Not connected
  5. Other MCPs with persistent connections (Telegram, MetaTrader 5) continue working

Expected Behavior

MCP connections should remain stable throughout the session, or auto-reconnect transparently.

Actual Behavior

Multiple MCPs simultaneously fail with Not connected:

  • supabase_list_projectsNot connected
  • desktop-commander_list_directoryNot connected
  • n8n_n8n_health_checkNot connected
  • universal-brain_pingNot connected

Meanwhile, MCPs with their own persistent connections remain functional:

  • telegram-mcp_get_me → ✅ Works
  • metatrader_get_account_info → ✅ Works

Operating System

Windows 11

Agent / Client

OpenCode

Shell

PowerShell 5.1

Relevant Logs

# Initial connection established:
> supabase_list_projects
[
  {"name":"Signalyn","id":"sglwgnwidhzddnuwewps"},
  {"name":"alpha-forge-mt5","id":"wjnoiuliovtdngtgskeq"}
]

# Later in same session:
> supabase_list_projects
Not connected

> desktop-commander_list_directory
Not connected

Additional Context

  • The failure appears to be a session drop in the OpenCode MCP server, not individual MCP config issues
  • A previous memory entry confirms this happened before: "Restored and stabilized all MCPs after context compaction" (project: opencode-mcps)
  • Workaround: None found. Session must be restarted.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions