Not Acceptable: Client must accept both application/json and text/event-stream
Node.js · updated 2026-11-11
Returned with HTTP 406 and code -32000 by the TypeScript SDK's Streamable HTTP server transport when a POST's Accept header doesn't list both application/json and text/event-stream (a GET for the event stream needs text/event-stream: "Not Acceptable: Client must accept text/event-stream"). Real MCP clients send both, so this almost always means a hand-written curl or fetch test, an HTTP client with a default Accept, or a proxy or gateway that rewrites the header.
HTTP/1.1 406 Not Acceptable
Content-Type: application/json
{"jsonrpc":"2.0","error":{"code":-32000,"message":"Not Acceptable: Client must accept both application/json and text/event-stream"},"id":null}Quick fix
Send Accept: application/json, text/event-stream with every POST to the MCP endpoint, plus Content-Type: application/json. If a real MCP client gets this error, something between it and your server is rewriting Accept: check your reverse proxy, API gateway or edge function.
- Add both media types to Accept in your test request (see the curl below).
- Keep Content-Type: application/json on the POST body.
- For the GET event stream, send Accept: text/event-stream.
- If Claude Code or Cursor hits it, log the Accept header your server receives to find the proxy that changes it.
curl -i https://example.com/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'Paste this into Claude Code, Cursor or Codex in the project that throws it. The agent reads this guide in plain text and applies the fix that matches your stack.
Read https://runheed.com/errors/mcp-not-acceptable-client-must-accept.md and fix this error in this project.Why it happens
A curl or fetch test without the header
curl sends Accept: */* by default, which the transport rejects.
An HTTP library's default
Some clients send Accept: application/json only, which is not enough for a Streamable HTTP endpoint.
A proxy rewrites Accept
API gateways, edge functions and some CDNs normalize or replace Accept before the request reaches your server.
Other fixes
- The SDK's own client transport already sends both types, so a real MCP client hitting this points at something in between.
- The v2 server package (@modelcontextprotocol/server) returns the same message.
Same error, other wording
- Not Acceptable: Client must accept text/event-stream
- 406 Not Acceptable (code -32000)
Let your coding agent catch the next one
Your MCP server answers this with an HTTP error response and throws nothing, so unless your handler reports it Runheed doesn't record it. What it does record is the exceptions your running server code throws (route handlers, server rendering, API errors and background jobs) with the stack trace and the breadcrumbs before them, and serves those errors to Claude Code, Cursor or any MCP client.
Setup for Node.js and Express or Vercel Functions, then have your agent fix and resolve it.
Building an MCP server? Track the errors your tools raise, in TypeScript or Python, so a failing tool shows up with its line instead of only in your users' client logs.
Related errors
- Bad Request: No valid session ID provided
- McpError: MCP error -32000: Connection closed
- Access to fetch at 'https://api.example.com/orders' from origin 'https://app.example.com'...
More in MCP servers and clients
- McpError: MCP error -32001: Request timed outNode.js
- MCP error -32602: Input validation error: Invalid arguments for tool get_orderNode.js
- Error: spawn npx ENOENTNode.js
- ModuleNotFoundError: No module named 'mcp.server.fastmcp'Python
- Error executing tool get_orderPython
- Bad Request: Unsupported protocol version: 2026-07-28Node.js
References: MCP specification: Streamable HTTP transport (sending messages to the server), MCP TypeScript SDK repository
Spotted a mistake? Email hello@greatwork.company. About Runheed.