Skip to content

MCP SSE client missing Accept header for text/event-stream #2651

Closed

Description

@circuitsenatortrench

Description

When connecting to remote MCP servers that use SSE (Server-Sent Events), nanobot does not send the required Accept header that includes both application/json and text/event-stream.

Affected MCP Servers

This issue affects Z.ai MCP servers:

  • https://api.z.ai/api/mcp/web_search_prime/mcp
  • https://api.z.ai/api/mcp/web_reader/mcp

These servers require:

Accept: application/json, text/event-stream

Current Behavior

Nanobot sends only Accept: application/json, causing the server to reject the connection with an error like:

Accept header must include both application/json and text/event-stream

Expected Behavior

Nanobot should send:

Accept: application/json, text/event-stream

Workaround

Using curl with the correct headers works:

curl -X POST "https://api.z.ai/api/mcp/web_reader/mcp" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{...}}"

Environment

  • nanobot v0.1.4.post6
  • Ubuntu 22.04
  • Config:
{
  "mcpServers": {
    "web-reader": {
      "type": "sse",
      "url": "https://api.z.ai/api/mcp/web_reader/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Related

Activity

  1. chengyongru commented on Mar 31, 2026

    @chengyongru
    Collaborator

    see: #2656

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

Metadata

Metadata

Assignees

No one assigned

    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