Skip to content

mcp: accept parameterized Content-Type types #890

Open
kalvinnchau wants to merge 1 commit intomodelcontextprotocol:mainfrom
kalvinnchau:main
Open

mcp: accept parameterized Content-Type types #890
kalvinnchau wants to merge 1 commit intomodelcontextprotocol:mainfrom
kalvinnchau:main

Conversation

@kalvinnchau
Copy link
Copy Markdown
Contributor

Use a shared helper for Content-Type parsing in streamable transport request validation and client response handling.

Follow up to #853, where we did this for Accept headers.

This allows the streamable mcp server to validate the following header Content-Type: application/json;charset=utf-8

@kalvinnchau kalvinnchau changed the title mcp: simplify Content-Type parsing in streamable transport mcp: accept parameterized Content-Type types Apr 9, 2026
default:
resp.Body.Close()
return fmt.Errorf("%s: unsupported content type %q", requestSummary, contentType)
return fmt.Errorf("%s: unsupported content type %q", requestSummary, resp.Header.Get("Content-Type"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be baseMediaType.
So put it in a variable before the switch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the review, updated and rebased into a single commit

Use a shared helper for Content-Type parsing in streamable transport
request validation and client response handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants