Skip to content

Remote MCP servers require header #17713

Closed as duplicate
Closed as duplicate

Description

@nndn

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

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 16, 2026
  2. github-actions commented on Mar 16, 2026

    @github-actions
    Contributor

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

    Please review these issues before proceeding, as they describe the same underlying problem.

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

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions