When using remote MCP servers (e.g., Z.AI's web_search_prime), OpenCode doesn't send the required `Accept` header, causing requests to fail. ### Error Messages **Before fix**: ``` "message":"Accept header must include both application/json and text/event-stream" ``` **After adding Accept header manually to config**: ``` "message":"Session ID missing in request header" ``` This indicates the Accept header fix partially worked, but there's an additional issue with session management. ### Affected Services - `web_search_prime` from Z.AI (`https://api.z.ai/api/mcp/web_search_prime/mcp`) - `zread` from Z.AI (`https://api.z.ai/api/mcp/zread/mcp`) ### Expected Behavior OpenCode should send proper headers when making requests to remote MCP servers: 1. `Accept: application/json, text/event-stream` for SSE streaming support 2. Proper session management headers if required by the remote server ### Workaround Adding `Accept` header to the remote MCP config in `opencode.json` partially resolves the issue, but session management still fails. ### Steps to Reproduce 1. Configure a remote MCP server in `opencode.json` 2. Try to use any tool from that server 3. Observe empty results or error messages ### Config Example \`\`\`json "web_search_prime": { "type": "remote", "url": "https://api.z.ai/api/mcp/web_search_prime/mcp", "headers": { "Authorization": "Bearer <API_KEY>", "Accept": "application/json, text/event-stream" } } \`\`\` ### Environment - OpenCode version: 1.2.27 - macOS arm64 (Apple Silicon)
Activity
github-actions commentedon Mar 16, 2026
This issue might be a duplicate of existing issues. Please check:
Accept: application/json, text/event-streamheader to remote MCP servers (open, same symptoms)StreamableHTTPClientTransportmissing theAccept: text/event-streamheader (closed)Please review these issues before proceeding, as they describe the same underlying problem.