Skip to content

[3.3] Adapt MCP integration to sdk 0.18.2 APIs#16267

Open
zrlw wants to merge 10 commits into
apache:3.3from
zrlw:3.3-upgrade-mcp
Open

[3.3] Adapt MCP integration to sdk 0.18.2 APIs#16267
zrlw wants to merge 10 commits into
apache:3.3from
zrlw:3.3-upgrade-mcp

Conversation

@zrlw
Copy link
Copy Markdown
Contributor

@zrlw zrlw commented May 12, 2026

What is the purpose of the change?

Adapt MCP integration to sdk 0.18.2 APIs

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 12, 2026

Codecov Report

❌ Patch coverage is 76.19048% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.79%. Comparing base (6916d1b) to head (85d80e2).

Files with missing lines Patch % Lines
...transport/DubboMcpStreamableTransportProvider.java 53.84% 6 Missing ⚠️
...bo/mcp/transport/DubboMcpSseTransportProvider.java 75.00% 2 Missing ⚠️
...e/dubbo/mcp/core/McpApplicationDeployListener.java 80.00% 1 Missing ⚠️
...pache/dubbo/mcp/tool/DubboServiceToolRegistry.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16267      +/-   ##
============================================
+ Coverage     60.78%   60.79%   +0.01%     
+ Complexity    11763    11762       -1     
============================================
  Files          1953     1953              
  Lines         89186    89181       -5     
  Branches      13454    13454              
============================================
+ Hits          54209    54218       +9     
+ Misses        29400    29386      -14     
  Partials       5577     5577              
Flag Coverage Δ
integration-tests-java21 32.16% <0.00%> (+<0.01%) ⬆️
integration-tests-java8 32.32% <0.00%> (+0.09%) ⬆️
samples-tests-java21 32.19% <0.00%> (+<0.01%) ⬆️
samples-tests-java8 29.85% <0.00%> (+0.04%) ⬆️
unit-tests-java11 59.04% <ø> (+0.02%) ⬆️
unit-tests-java17 58.50% <76.19%> (-0.01%) ⬇️
unit-tests-java21 58.56% <76.19%> (+0.05%) ⬆️
unit-tests-java25 58.46% <76.19%> (+<0.01%) ⬆️
unit-tests-java8 58.99% <ø> (-0.03%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@zrlw zrlw requested review from RainYuY and Copilot May 12, 2026 03:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adapts the Dubbo MCP integration to the Model Context Protocol SDK 0.18.2 API changes (JSON mapping, schema/tool representations).

Changes:

  • Bumps MCP SDK dependency from 0.11.2 to 0.18.2.
  • Migrates transports to use McpJsonMapper/TypeRef instead of Jackson ObjectMapper/TypeReference.
  • Updates tool/schema construction to use McpSchema.Tool.builder() and McpSchema.JsonSchema (and adjusts tests accordingly).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
dubbo-plugin/dubbo-mcp/pom.xml Bumps MCP SDK version to 0.18.2.
dubbo-plugin/dubbo-mcp/src/main/java/org/apache/dubbo/mcp/core/McpApplicationDeployListener.java Wires JacksonMcpJsonMapper into transport providers.
dubbo-plugin/dubbo-mcp/src/main/java/org/apache/dubbo/mcp/transport/DubboMcpStreamableTransportProvider.java Switches JSON handling to McpJsonMapper/TypeRef and updates init parsing.
dubbo-plugin/dubbo-mcp/src/main/java/org/apache/dubbo/mcp/transport/DubboMcpSseTransportProvider.java Switches JSON handling to McpJsonMapper/TypeRef.
dubbo-plugin/dubbo-mcp/src/main/java/org/apache/dubbo/mcp/tool/DubboServiceToolRegistry.java Builds tools via builder and returns JsonSchema objects instead of JSON strings.
dubbo-plugin/dubbo-mcp/src/main/java/org/apache/dubbo/mcp/tool/DubboOpenApiToolConverter.java Builds tools via builder and returns JsonSchema objects instead of JSON strings.
dubbo-plugin/dubbo-mcp/src/test/java/org/apache/dubbo/mcp/transport/DubboMcpStreamableTransportProviderTest.java Updates tests to pass JacksonMcpJsonMapper.
dubbo-plugin/dubbo-mcp/src/test/java/org/apache/dubbo/mcp/transport/DubboMcpSseTransportProviderTest.java Updates tests to pass JacksonMcpJsonMapper.
dubbo-plugin/dubbo-mcp/src/test/java/org/apache/dubbo/mcp/tool/DubboServiceToolRegistryTest.java Updates tests to use Tool.builder() + JsonSchema.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

zrlw and others added 2 commits May 12, 2026 16:07
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

dubbo-plugin/dubbo-mcp/src/main/java/org/apache/dubbo/mcp/transport/DubboMcpSseTransportProvider.java:80

  • The public constructors now require McpJsonMapper, which is a source/binary breaking change for any external code instantiating this transport provider. If backward compatibility is a goal for the 3.3 line, consider keeping an overload that accepts a Jackson ObjectMapper (deprecated) and wraps it with JacksonMcpJsonMapper internally.
    public DubboMcpSseTransportProvider(McpJsonMapper mcpJsonMapper, Integer expireSeconds) {
        if (expireSeconds != null) {
            if (expireSeconds < 60) {
                expireSeconds = 60;
            }

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

dubbo-plugin/dubbo-mcp/src/main/java/org/apache/dubbo/mcp/transport/DubboMcpStreamableTransportProvider.java:562

  • In this sendMessage(...) implementation you guard responseObserver for onNext, but the catch path below still calls responseObserver.onError(e) unconditionally. If responseObserver is null (which this method already anticipates), this will throw an NPE and mask the original error. Please null-check before calling onError/onCompleted, or return a Mono.error(...) so the error is propagated without dereferencing a null observer.
                        String jsonText = mcpJsonMapper.writeValueAsString(message);
                        responseObserver.onNext(ServerSentEvent.<byte[]>builder()
                                .event("message")
                                .data(jsonText.getBytes(StandardCharsets.UTF_8))
                                .build());

dubbo-plugin/dubbo-mcp/src/main/java/org/apache/dubbo/mcp/transport/DubboMcpStreamableTransportProvider.java:580

  • Same issue as the other overload: responseObserver is checked before onNext, but the catch path calls responseObserver.onError(e) without a null check. If responseObserver can be null, this will throw NPE during error handling. Please guard onError similarly or propagate errors via Mono.error(...).
                        String jsonText = mcpJsonMapper.writeValueAsString(message);
                        ServerSentEvent<byte[]> event = ServerSentEvent.<byte[]>builder()
                                .event("message")
                                .data(jsonText.getBytes(StandardCharsets.UTF_8))
                                .id(messageId)
                                .build();

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.

4 participants