Skip to content

fix(mcp): reuse configured response json mapper - #7116

Merged
Aias00 merged 5 commits into
apache:masterfrom
dengliming:fix-6749-mcp-response-json-mapper
Sep 22, 2026
Merged

Aias00 merged 5 commits into
apache:masterfrom
dengliming:fix-6749-mcp-response-json-mapper

Conversation

@dengliming

Copy link
Copy Markdown
Member

Summary

  • inject the configured MCP JSON mapper into streamable HTTP results
  • serialize MCP response objects with the transport mapper instead of a plain ObjectMapper
  • route every streamable result construction through the configured mapper and add regression tests

Testing

  • mvn -q -pl shenyu-plugin/shenyu-plugin-mcp-server -am -DskipTests=false -Dcheckstyle.skip=false -Dtest=MessageHandlingResultTest,ShenyuStreamableHttpServerTransportProviderTest -DfailIfNoTests=false test

Fixes #6749

@Aias00 Aias00 left a comment

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.

Approved as PMC (Aias00). Reviewed the diff — small, well-scoped fix with regression tests; mergeable.

@Voyagerroc-Lab Voyagerroc-Lab left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed the MCP transport result construction and mapper injection. All response-result creation paths now route through the configured McpJsonMapper, preserving framework-specific serialization while string bodies still bypass serialization; the focused test verifies both behaviors. I found no blocking issue.

@Aias00
Aias00 merged commit de6d663 into apache:master Sep 22, 2026
22 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.

[BUG] MessageHandlingResult.getResponseBodyAsJson serializes MCP types with plain ObjectMapper (wrong serializer)

3 participants