Skip to content

fix(mcp): migrate to MCP SDK 0.18.3 JSON APIs - #16442

Open
skrcode wants to merge 2 commits into
apache:dependabot/maven/io.modelcontextprotocol.sdk-mcp-0.18.3from
skrcode:jaipilot/fix-dubbo-16342-mcp-sdk
Open

fix(mcp): migrate to MCP SDK 0.18.3 JSON APIs#16442
skrcode wants to merge 2 commits into
apache:dependabot/maven/io.modelcontextprotocol.sdk-mcp-0.18.3from
skrcode:jaipilot/fix-dubbo-16342-mcp-sdk

Conversation

@skrcode

@skrcode skrcode commented Aug 27, 2026

Copy link
Copy Markdown

What is the purpose of the change?

This companion PR completes the MCP SDK 0.18.3 upgrade in #16342. The SDK replaced its Jackson-specific APIs with McpJsonMapper/TypeRef and removed the deprecated string-schema Tool constructors, leaving the Dependabot head unable to compile.

The change:

  • adapts Dubbo's existing ObjectMapper instances through the SDK-provided JacksonMcpJsonMapper;
  • uses the SDK's new TypeRef transport contract;
  • migrates tool creation to the mapper-aware builder, preserving the previous JSON Schema parsing behavior;
  • removes a redundant Mockito @InjectMocks path that constructed the SSE provider with a null mapper before the test's explicit setup; and
  • carries the already merged test-isolation fix from fix: make SpringBootConfigPropsTest immune to leaked metrics System properties #16420 onto this older Dependabot branch. Without that fix, all five unit-test jobs fail because leaked dubbo.metrics.* System properties override the Spring test's Prometheus configuration.

No public API or MCP wire behavior is intentionally changed.

Verification

  • Reproduced 8 Java compilation errors on exact Dependabot head 09795dcd58e0137c63ea5307b025893cd1aa0c48 with ./mvnw -pl dubbo-plugin/dubbo-mcp -DskipTests compile.
  • Confirmed the five red GitHub jobs all fail at SpringBootConfigPropsTest with expected: <prometheus> but was: <disabled>, then traced the exact defect to the maintainer-approved and merged fix: make SpringBootConfigPropsTest immune to leaked metrics System properties #16420.
  • Ran SpringBootConfigPropsTest and SpringBootMultipleConfigPropsTest while deliberately injecting -Ddubbo.metrics.protocol=disabled -Ddubbo.metrics.enabled=false; both passed with the accepted isolation fix.
  • ./mvnw -T 4 -pl dubbo-plugin/dubbo-mcp -am clean install -DskipTests ... — all 53 reactor modules compiled, packaged, and installed successfully on JDK 17.
  • ./mvnw -pl dubbo-plugin/dubbo-mcp clean test verify -Pjacoco,... — all 89 MCP tests passed and the JaCoCo report was generated on JDK 17.
  • git diff --check passed.

Checklist

@codecov-commenter

codecov-commenter commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.41379% with 8 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (dependabot/maven/io.modelcontextprotocol.sdk-mcp-0.18.3@09795dc). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...transport/DubboMcpStreamableTransportProvider.java 40.00% 6 Missing ⚠️
...bo/mcp/transport/DubboMcpSseTransportProvider.java 71.42% 2 Missing ⚠️
Additional details and impacted files
@@                                    Coverage Diff                                     @@
##             dependabot/maven/io.modelcontextprotocol.sdk-mcp-0.18.3   #16442   +/-   ##
==========================================================================================
  Coverage                                                           ?   60.82%           
  Complexity                                                         ?    11769           
==========================================================================================
  Files                                                              ?     1953           
  Lines                                                              ?    89219           
  Branches                                                           ?    13458           
==========================================================================================
  Hits                                                               ?    54268           
  Misses                                                             ?    29389           
  Partials                                                           ?     5562           
Flag Coverage Δ
integration-tests-java21 32.19% <0.00%> (?)
integration-tests-java8 32.24% <0.00%> (?)
samples-tests-java21 32.19% <0.00%> (?)
samples-tests-java8 29.77% <0.00%> (?)
unit-tests-java11 59.09% <ø> (?)
unit-tests-java17 58.52% <72.41%> (?)
unit-tests-java21 58.56% <72.41%> (?)
unit-tests-java25 58.53% <72.41%> (?)
unit-tests-java8 59.08% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…roperties (apache#16420)

SpringBootConfigPropsTest intermittently fails in CI with 'expected: <prometheus> but was: <disabled>'. The module's metrics-disabling tests set the JVM System property dubbo.metrics.protocol=disabled, and Dubbo's config resolution gives System properties the highest precedence, so depending on test execution order it overrides the test's @SpringBootTest property dubbo.metrics.protocol=prometheus.

Changes:
- SpringBootConfigPropsTest / SpringBootMultipleConfigPropsTest: clear the leaked dubbo.metrics.protocol / dubbo.metrics.enabled System properties in @BeforeAll before DubboBootstrap.reset(), so prometheus is bound regardless of prior test state.
- SysProps (dubbo-config-spring and dubbo-config-api test helpers, dubbo-test-common): make reset() also clear the recorded System properties (previously it only cleared the internal map), removing the footgun that could leak such properties between tests.

(cherry picked from commit d2c4bd7)
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.

3 participants