Hi 👋,
First of all, thank you for the all the good work done on the SDK.
I would like to discuss a potential compatibility enhancement regarding content-type validation
Is your feature request related to a problem? Please describe.
While upgrading to github.com/modelcontextprotocol/go-sdk v1.6.0, we noticed that POST requests are now rejected unless they include:
Content-Type: application/json
This seems stricter than previous behavior, and it creates a compatibility problem for servers that need to continue supporting existing clients that send valid JSON bodies but do not explicitly set the Content-Type header. This could previously be opted out using
MCPGODEBUG=disablecrossoriginprotection=1
Because of that, upgrading to v1.6.0 is difficult as it break communication with these non controlled clients (ex. we had a case with Copilot Studio).
Reproduce
- Create a streamable HTTP MCP server using
go-sdk v1.6.0.
- Send a
POST request with a valid JSON-RPC / MCP payload.
- Omit the
Content-Type header.
- The server responds with
415 Unsupported Media Type.
Example:
curl -i \
-X POST http://localhost:8080/mcp \
--data '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}'
Describe the solution you'd like
It would be helpful if this validation was an opt-in / compatibility option for SDK users. That would give server implementers a migration path so they can adopt newer SDK versions without immediately breaking older clients.
WDYT? Happy to submit a PR for this
Hi 👋,
First of all, thank you for the all the good work done on the SDK.
I would like to discuss a potential compatibility enhancement regarding
content-typevalidationIs your feature request related to a problem? Please describe.
While upgrading to
github.com/modelcontextprotocol/go-sdk v1.6.0, we noticed thatPOSTrequests are now rejected unless they include:Content-Type: application/jsonThis seems stricter than previous behavior, and it creates a compatibility problem for servers that need to continue supporting existing clients that send valid JSON bodies but do not explicitly set the
Content-Typeheader. This could previously be opted out usingMCPGODEBUG=disablecrossoriginprotection=1Because of that, upgrading to
v1.6.0is difficult as it break communication with these non controlled clients (ex. we had a case with Copilot Studio).Reproduce
go-sdk v1.6.0.POSTrequest with a valid JSON-RPC / MCP payload.Content-Typeheader.415 Unsupported Media Type.Example:
curl -i \ -X POST http://localhost:8080/mcp \ --data '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}'Describe the solution you'd like
It would be helpful if this validation was an opt-in / compatibility option for SDK users. That would give server implementers a migration path so they can adopt newer SDK versions without immediately breaking older clients.
WDYT? Happy to submit a PR for this