anomalyco / anomalyco/opencode

fernando-brain MCP SSE transport: tools/call returns -32602 after successful handshake

Open
#38,845 0 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Jul 25, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

Description

The fernando-brain MCP server over SSE transport returns -32602 on all tools/call requests from the opencode client (v1.18.5). The SSE handshake succeeds (HTTP 200, correct endpoint event), but every tool invocation fails.

Steps to reproduce

  1. Configure a remote MCP server with SSE transport:
    {
      "mcp": {
        "fernando-brain": {
          "type": "remote",
          "url": "https://srv1300387.hstgr.cloud/sse",
          "enabled": true
        }
      }
    }
    
  2. Start opencode. The server connects (endpoint event received, tools list populated).
  3. Call any MCP tool (e.g., retrieve_context). Result: -32602 (Invalid params).

Evidence

  • The SSE handshake succeeds (HTTP 200, endpoint event for message?sessionId=...).
  • tools/list returns correctly (tools are visible in the client).
  • tools/call fails with -32602.
  • Using curl directly against the SSE endpoint works fine — the server responds correctly.
  • The issue is specifically in the opencode client SSE transport layer.

Root cause hypothesis

Two possibilities:

  1. Missing initialize handshake: opencode may skip the JSON-RPC initialize/initialized handshake for SSE transport (as opposed to Streamable HTTP). The server may reject calls without prior initialization.
  2. Parameter encoding mismatch: opencode may encode the arguments field differently than the server expects over SSE.

Related upstream issues

  • #25287
  • #37626

Workaround

Test manually with curl, or switch to streamable-http transport if the server supports it.

Environment

  • opencode version: 1.18.5
  • Platform: macOS
  • MCP transport: SSE (remote)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.