OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

MCPStreamableHttpServlet should set character encoding for response.

Open fuzmish opened this issue 1 year ago • 1 comments

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).

Image

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.

fuzmish avatar Jul 17 '25 10:07 fuzmish

@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.

Vishnuujain avatar Dec 15 '25 11:12 Vishnuujain