Skip to content

Fixed StreamableHttpClientSessionTransport.cs for netstandard #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

lucapivato
Copy link
Contributor

Fixed exception 'The format of value 'application/json; charset=utf-8' is invalid

Motivation and Context

Without this fix it doesn't work at all with .NET Framework.

"application/json; charset=utf-8" is an invalid header when the encoding is already specified. It fails immediately when creating the McpClient instance with the SseClientTransport using netstandard builds.

How Has This Been Tested?

Works. Without the fix doesn't work at all.

Breaking Changes

Not a breaking change.

Fixed exception 'The format of value 'application/json; charset=utf-8' is invalid

"application/json; charset=utf-8" is an invalid header.  the correct one is "application/json".
Copy link
Contributor

@halter73 halter73 left a comment

Choose a reason for hiding this comment

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

Thanks. I made this same change in #377.

@eiriktsarpalis I know we run our tests on net9.0 and net8.0, do you think we should include net472? If we did that, we would need to write multi-process tests so ASP.NET Core can still run to get good coverage for the HTTP-based client code.

@halter73 halter73 merged commit cd8e5d5 into modelcontextprotocol:main Jul 2, 2025
5 of 6 checks passed
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.

2 participants