feat: add Spring AI MCP tool adapter - #3645
Conversation
|
CLA Not Signed The Contributor License Agreement (CLA) check is currently pending on this PR ( @zgzyq please sign the CLA via the CLA assistant badge in the comment above, or visit https://cla-assistant.io/alibaba/Sentinel. Once signed, the Automated check by github-manager-bot |
oss-sentinel-ai
left a comment
There was a problem hiding this comment.
Summary
This PR adds a decorator for synchronous and reactive Spring AI MCP tool specifications, creating inbound COMMON_RPC Sentinel resources named mcp:tool:<tool-name>, tracing thrown failures, and retaining async entries through completion, error, or cancellation. Its lifecycle pairing and BlockException handling align with the existing Reactor adapter, and its Java 17 and local version conventions match existing optional adapter modules.
LGTM — code changes look good, but this PR cannot be approved/merged until the contributor signs the CLA (see the CLA reminder comment above). Once the CLA is signed, feel free to @mention me for a re-review.
Automated review by github-manager-bot
Describe what this PR does / why we need it
Adds a transport-independent Spring AI MCP adapter that protects individual
tool calls with Sentinel. MCP transports share fixed endpoints, so URL-level
WebMVC/WebFlux interception cannot distinguish tools. Decorating tool
specifications creates stable resources such as
mcp:tool:echo.Does this pull request fix one issue?
Fixes #3581
Describe how you did it
Describe how to verify it
mvn -pl sentinel-adapter/sentinel-spring-ai-mcp-adapter -am test
The tests cover success, blocking, exception tracing, async completion,
cancellation, stateless tool specifications, and actual Sentinel flow rules.
Special notes for reviews
This intentionally leaves HTTP/SSE/WebMVC/WebFlux adapters unchanged. The
protection point is the MCP tool handler, so resource naming remains consistent
across transports.