MCP client doesn't send Accept header required by Context7 (causes 406 Not Acceptable error)
Description
The OpenCode MCP client fails to connect to Context7's MCP server because it doesn't send the required Accept: application/json, text/event-stream HTTP header. Context7 requires both content types to be accepted, and returns HTTP 406 "Not Acceptable" when this header is missing or incorrect.
Plugins
oh-my-opencode
OpenCode version
v1.1.2
Steps to reproduce
- Configure Context7 MCP server in ~/.config/opencode/opencode.json: { mcp: { context7: { type: remote, url: https://mcp.context7.com/mcp, headers: { CONTEXT7_API_KEY: your-api-key }, enabled: true } } }
- Start OpenCode
- Observe error: "context7 Failed to get tools"
Screenshot and/or share link
Root Cause Investigation: I tested the Context7 endpoint manually using curl:
Without Accept header (fails with 406)
curl -X POST https://mcp.context7.com/mcp
-H "Content-Type: application/json"
--data '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Result: HTTP/1.1 406 Not Acceptable
With correct Accept header (works)
curl -X POST https://mcp.context7.com/mcp
-H "Content-Type: application/json"
-H "Accept: application/json, text/event-stream"
--data '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Result: Returns tools successfully (resolve-library-id, query-docs)
Context7 returns: {"jsonrpc":"2.0","error":{"code":-32000,"message":"Not Acceptable: Client must accept both application/json and text/event-stream"},"id":null} The server also sends these CORS headers indicating acceptable headers: Access-Control-Allow-Headers: Content-Type, MCP-Session-Id, MCP-Protocol-Version, X-Context7-API-Key, Context7-API-Key, X-API-Key, Authorization Environment:
- OpenCode version: v1.1.2 (released Jan 5, 2026)
- Operating System: Windows
- MCP Server: Context7 (https://mcp.context7.com/mcp) Suggested Fix: Update the OpenCode MCP client to send Accept: application/json, text/event-stream header when making requests to remote MCP servers, or at minimum, allow configuring custom Accept headers in the MCP server configuration.
Operating System
Windows 11
Terminal
Windows Terminal
This issue might be a duplicate of existing issues. Please check:
- #834: Remote MCP servers using Server-Sent Events (SSE) fail to start with 'UnknownError Server error' - This is the same root cause: missing Accept: application/json, text/event-stream headers
You may also want to review:
- #5371: [FEATURE]: Support MCP servers that require POST-based or non-standard SSE handshake - Related to MCP transport improvements
Feel free to ignore if none of these address your specific case.
@kamusis are you still encountering this bug in the latest version ?
@kamusis are you still encountering this bug in the latest version ?
Just wanted to update this - that issue isn't happening anymore. Context7 is working smoothly now, no problems at all! 🎉"
@kamusis are you still encountering this bug in the latest version ?
Just wanted to update this - that issue isn't happening anymore. Context7 is working smoothly now, no problems at all! 🎉"
actually was gonna work on this issue, but saw context7 connected by default in dev mode 😅