ramu11 opened a new pull request, #2094:
URL: https://github.com/apache/camel-spring-boot/pull/2094
## CAMEL-26360: Add MCP Server parity to Spring Boot
### Description
This PR brings the Spring Boot MCP Server engine closer to feature parity
with the Camel Main MCP Server engine by integrating Camel MCP server
capabilities with Spring AI's MCP Streamable HTTP transport.
It enables Camel MCP server routes to participate in the Spring Boot MCP
server alongside Spring-defined MCP tools, while preserving caller identity and
supporting Spring Security integration.
### Key changes
**1. Spring Boot MCP transport integration**
- Add Spring Boot auto-configuration for the Camel MCP Server transport.
- Integrate with Spring AI's WebMVC Streamable HTTP transport.
- Ensure transport auto-configuration follows the explicitly configured
`STREAMABLE` protocol.
- Support custom Spring AI MCP transport provider implementations.
**2. Caller identity and Spring Security integration**
- Extract the authenticated principal and authorities from the Spring
Security request context.
- Propagate caller identity, principal name, and roles into Camel MCP tool
execution through `McpToolCallContext`.
- Provide a reusable `SpringAiMcpTransportContext` utility for custom
transport providers.
- Enable Camel routes to apply native Camel `AuthorizationPolicy` using the
propagated caller roles.
**3. MCP server capabilities**
- Support Camel MCP tools alongside Spring AI annotation-based tools.
- Support MCP resources and resource templates.
- Support MCP prompts, including multiple user and assistant messages.
- Support structured tool output and tool annotations.
- Cover resource, prompt, and tool lifecycle changes and notifications.
**4. Origin validation and transport security**
- Validate Origin headers for MCP Streamable HTTP requests.
- Cover POST, GET, and DELETE request validation.
- Verify loopback Origin handling and configured remote Origin allowlists.
- Verify that rejected Origin requests do not invoke Camel tool routes.
**5. Documentation**
- Document Spring Boot MCP server configuration and usage.
- Add examples for `ai-tool`, `ai-resource`, and `ai-prompt`.
- Document resource templates and prompt safety considerations.
- Document Spring Security identity propagation and custom transport
provider integration.
- Clarify OAuth resource metadata configuration, including the use of
canonical externally configured resource and metadata URLs.
### Testing
The following focused test suite completed successfully:
```bash
mvn -pl components-starter/camel-mcp-server-starter -am \
-Dtest=SpringBootMcpServerTest,SpringBootMcpServerOriginConfigurationTest,SpringBootMcpServerCustomTransportTest
\
-Dsurefire.failIfNoSpecifiedTests=false \
test
```
Additional focused verification:
- `testAuthorizationPolicyAllowsOnlyMcpAdminRole` — passed.
- `testResourceAndPromptChangeNotificationsAreDelivered` — passed
independently.
- Common MCP Server API caller identity propagation test — verified in the
corresponding Apache Camel PR. https://github.com/apache/camel/pull/29902
### Scope
This PR focuses on the Spring Boot MCP Server engine.
Quarkus parity is intentionally deferred until the Spring Boot integration
and common API changes have been reviewed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]