Bug Description
When connecting to remote MCP servers that implement the Streamable HTTP transport (e.g., Zhipu/BigModel MCP servers at open.bigmodel.cn), OpenCode fails to connect. The server returns HTTP 400 with the error:
"Accept header must include both application/json and text/event-stream"
Steps to Reproduce
- Configure a remote MCP server that uses Streamable HTTP transport in
opencode.json:
{
"mcp": {
"web-search-prime": {
"type": "remote",
"url": "https://open.bigmodel.cn/api/mcp/web_search_prime/mcp",
"headers": {
"Authorization": "Bearer <api_key>"
}
}
}
}
- Start OpenCode
- The MCP server fails to connect — no tools from this server are available in the session
Expected Behavior
OpenCode's MCP client should send requests with the Accept header including both application/json and text/event-stream:
Accept: application/json, text/event-stream
This is required by the MCP Streamable HTTP transport spec for servers that support both response modes.
Actual Behavior
OpenCode sends requests without the required Accept header values, causing the server to reject the connection with HTTP 400.
Verification
Manual curl test confirms the issue:
# Without Accept header → 400
curl -s -o /dev/null -w "%{http_code}" -X POST \
"https://open.bigmodel.cn/api/mcp/web_search_prime/mcp" \
-H "Authorization: Bearer <key>" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}'
# → HTTP 400: "Accept header must include both application/json and text/event-stream"
# With correct Accept header → 200
curl -s -o /dev/null -w "%{http_code}" -X POST \
"https://open.bigmodel.cn/api/mcp/web_search_prime/mcp" \
-H "Authorization: Bearer <key>" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}'
# → HTTP 200 (success)
Environment
- OpenCode version: latest
- OS: macOS (darwin)
- MCP server: Zhipu BigModel web-search-prime / web-reader / zread (all three fail with same error)
- Config type:
"type": "remote"
Affected MCP Servers
Any MCP server using the Spring Boot MCP starter with ZWebFluxStreamableHttpServerTransportProvider enforces this Accept header requirement. This includes all Zhipu/BigModel MCP servers documented at https://docs.bigmodel.cn/cn/coding-plan/mcp/search-mcp-server
Workaround
None currently — the issue is in OpenCode's MCP HTTP client implementation.
Bug Description
When connecting to remote MCP servers that implement the Streamable HTTP transport (e.g., Zhipu/BigModel MCP servers at
open.bigmodel.cn), OpenCode fails to connect. The server returns HTTP 400 with the error:Steps to Reproduce
opencode.json:{ "mcp": { "web-search-prime": { "type": "remote", "url": "https://open.bigmodel.cn/api/mcp/web_search_prime/mcp", "headers": { "Authorization": "Bearer <api_key>" } } } }Expected Behavior
OpenCode's MCP client should send requests with the
Acceptheader including bothapplication/jsonandtext/event-stream:This is required by the MCP Streamable HTTP transport spec for servers that support both response modes.
Actual Behavior
OpenCode sends requests without the required
Acceptheader values, causing the server to reject the connection with HTTP 400.Verification
Manual curl test confirms the issue:
Environment
"type": "remote"Affected MCP Servers
Any MCP server using the Spring Boot MCP starter with
ZWebFluxStreamableHttpServerTransportProviderenforces this Accept header requirement. This includes all Zhipu/BigModel MCP servers documented at https://docs.bigmodel.cn/cn/coding-plan/mcp/search-mcp-serverWorkaround
None currently — the issue is in OpenCode's MCP HTTP client implementation.