You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Modern HttpServletMcpTransport accepts POST requests with non-JSON Content-Type #1206
The modern HttpServletMcpTransport (#1170) never checks the request Content-Type. A POST with a valid JSON-RPC body is processed when Content-Type is missing, text/plain or application/x-www-form-urlencoded, and the server returns 200. The legacy transports return 415 for this since #1164 (fixes #961). The Go, TypeScript and Python SDKs also return 415.
Environment
java-sdk main @ bb87ddf, Java 25.0.3, embedded Tomcat.
Returns HTTP/1.1 200 and the tool executes. The same happens with no Content-Type and with application/x-www-form-urlencoded.
Expected behavior
415 Unsupported Media Type when the media type isn't application/json, matching the legacy transports. Parameters and case are ignored, so application/json; charset=utf-8 is accepted.
Check Content-Type in doPost before reading the body. HttpServletRequestUtils.isJsonContentType already does the matching but is package-private. Should I make it public, or add a private helper in the modern transport? Happy to send a PR.
Activity