Skip to content

MCP client doesn't send Accept header required by Context7 (causes 406 Not Acceptable error) #6972

Closed as not planned

Description

@kamusis

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

  1. 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
    }
    }
    }
  2. Start OpenCode
  3. 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

Activity

  1. github-actions commented on Jan 5, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    You may also want to review:

    Feel free to ignore if none of these address your specific case.

  2. Shivansh-Khunger commented on Jan 9, 2026

    @Shivansh-Khunger

    @kamusis are you still encountering this bug in the latest version ?

  3. kamusis commented on Jan 9, 2026

    @kamusis
    Author

    @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! 🎉"

  4. Shivansh-Khunger commented on Jan 9, 2026

    @Shivansh-Khunger

    @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 😅

  5. github-actions commented on Mar 25, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  6. tanin47 commented on Apr 1, 2026

    @tanin47

    I still encounter this in the Opencode desktop app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions