You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SSE-transport remote MCP: invalid-session 404 never auto-reconnects; unrecoverable on terminal-less hosted deployments #37626
Summary
Remote MCP configured as type: "remote" with an SSE endpoint (https://.../sse) loses its session whenever the server side invalidates it (idle timeout / instance recycle). Every subsequent tool call then fails permanently with:
Error POSTing to endpoint (HTTP 404): {"error":{"message":"Invalid session id."}}
There is no auto-reconnect for the SSE transport, and on terminal-less hosted deployments (opencode-web on ModelScope, no shell) there is no way to run opencode mcp connect/logout/auth, so the only recovery is a full restart of the web service.
Environment
opencode-web v18.0 (latest)
MCP transport: remote SSE (.../sse, ModelScope-hosted MCP, Bearer token)
Deployment: platform-hosted opencode-web, no terminal
Why existing fixes don't cover this #25137 / PR #32088 added session recovery only for StreamableHTTP 404 (Session not found). My server returns Invalid session id over SSE, which is not covered.
PR #25670 ("auto-reconnect on transport errors", which cited SSE) was closed via automated-pr-cleanup (2026-06-04, mergeable unknown) — the SSE reconnect path does not appear to have landed. #29190 (SSE silent death, no reconnect/heartbeat) was closed as not_planned / duplicate of #23997 — so SSE reconnect is still missing. #25287 (the canonical tracker) remains OPEN as of 2026-06-29.
Reproduction
Configure remote SSE MCP:
{ "mcp": { "studio-mcp": { "type": "remote",
"url": "https://mcp.api-inference.modelscope.net//sse",
"headers": { "Authorization": "Bearer " } } } }
Tools work initially.
Server recycles the session (ModelScope idles/recycles the deployed MCP instance; SSE stream stays open at gateway but initialize returns 404 Invalid session id).
Every later tool call fails with the 404 above for the rest of the process.
opencode mcp list still reports connected (stale status, #24855/#25682).
/new does not recover (session state is process-level).
No terminal to run opencode mcp connect (#15209's workaround is unavailable).
Only a full restart of the opencode-web service recovers.
Request
Land session-expiration recovery (404 / Invalid session id) for the SSE transport, not only StreamableHTTP.
Provide a non-shell reconnect path (UI control and/or POST /mcp/:name/connect for web/serve mode) so terminal-less hosted deployments can recover without restarting the whole service.
Related #25287 (OPEN, canonical), #25137 (StreamableHTTP-only fix), #32088, #25670 (SSE reconnect, closed by cleanup), #29190 (SSE, closed not_planned), #24855/#25682 (stale status), #15209 (manual mcp connect workaround, needs terminal).
Activity
github-actions commentedon Sep 18, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.