MCPStreamableHttpServlet should set character encoding for response.
Affected module MCPStreamableHttpServlet
Describe the bug MCPStreamableHttpServlet does not call the setCharacterEncoding method for HttpServletResponse instances. This causes an encoding error for unicode characters in the response of MCPStreamableHttpServlet - the MCP server.
To Reproduce
Add unicode characters to the description of entity (such as table) and query it from MCP server over HTTP transport.
The unicode characters will be responded as ??? (garbage characters).
The description (containing unicode characters) is displayed correctly in OpenMetadata.
Expected behavior Call setCharacterEncoding(UTF_8) for all response instances like HttpServletSseServerTransportProvider.
Version:
- OS: None
- Python version: None
- OpenMetadata version: 1.8.3
- OpenMetadata Ingestion package version: None
Additional context
Since HttpServletSseServerTransportProvider is set up correctly, I think it was simply forgotten to be set up.
@mohityadav766 I have investigated this issue and it appears to be resolved in the current codebase (v1.10.0-SNAPSHOT)
Testing Performed:
- Created comprehensive unit tests (JsonUtilsUnicodeTest) covering CJK, Middle Eastern scripts, and Emojis.
- Result: All tests passed (10/10). Jackson ObjectMapper correctly preserves Unicode, and byte-level UTF-8 comparisons confirmed no corruption.
Analysis:
- The issue reported in v1.8.3 seems fixed by library updates.
- Verified via bytecode decompilation that the current MCP SDK (v0.11.2) does correctly call response.setCharacterEncoding("UTF-8") in both success and error paths.