Set UTF-8 character encoding in server transport by bhsz · Pull Request #881 · modelcontextprotocol/java-sdk

Set character encoding on servlet request before getting reader.

Fixes #880

Motivation and Context

Default request reader silently corrupts non-ASCII characters.

How Has This Been Tested?

Integration test.

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

N/A