Repository navigation
Description
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.
Activity
github-actions commentedon May 3, 2026
This issue might be a duplicate of existing issues. Please check:
Accept: application/json, text/event-streamheader, causing remote MCP servers to reject the connection (reported for Context7, same fix needed)StreamableHTTPClientTransportmissingAccept: text/event-streamheader causing 406 errors from SSE-over-POST serversPlease review those issues to see if they cover your case, and consider adding a
+1or additional context there if so.kagura-chen commentedon May 4, 2026
I'd like to work on this. The root cause is that the MCP SDK's initial GET request for SSE only sets
Accept: text/event-stream, but some servers validate that all requests include bothapplication/jsonandtext/event-stream. The fix is to pass a customfetchtoStreamableHTTPClientTransportthat ensures both values are always present in the Accept header.rekram1-node commentedon Jun 22, 2026
no it definitely sends them just tested w/ http proxy