Implement MCP consumer for HTTP/WebSocket server endpoints#5
Merged
Conversation
Contributor
|
Use Java 21 |
- Enhanced McpConfiguration with consumer-specific options (websocket, sendToAll, allowedOrigins, httpMethodRestrict) - Implemented McpConsumer.doStart() to programmatically create Undertow HTTP/WebSocket endpoints - Added processor chain integration: request size guard, rate limit, JSON-RPC envelope parsing, user processor - Added automatic JSON serialization of response bodies - Implemented proper shutdown in McpConsumer.doStop() - Created McpConsumerTest with HTTP and WebSocket test scenarios - Consumer wraps Undertow component to provide MCP server functionality via component URIs Co-authored-by: rdobrik <8812511+rdobrik@users.noreply.github.com>
- Fixed test to include proper MCP headers (Content-Type, Accept) - Added error handling and logging in consumer processor chain - Updated WebSocket test to verify context and route startup - All 4 McpConsumer tests now pass - Full test suite (86 tests) passes successfully - Consumer correctly serializes JSON responses - Consumer properly integrates MCP processor pipeline Co-authored-by: rdobrik <8812511+rdobrik@users.noreply.github.com>
- Updated README.md with consumer/server mode examples (Java and YAML) - Added consumer configuration options to Configuration section - Updated docs/architecture.md with detailed consumer flow diagram - Extended docs/TEST_PLAN.md with consumer test scenarios and automation info - Updated CAMEL_MCP_APPS_BRIDGE_PLAN.md with consumer implementation status - Documented exchange properties set by consumer - Included usage examples for HTTP and WebSocket servers - All tests still passing (86/86) Co-authored-by: rdobrik <8812511+rdobrik@users.noreply.github.com>
- Improved JSON serialization error messages with body type and preview - Removed debug print statement from test - Refactored duplicated query parameter appending logic into helper method - All 86 tests passing Co-authored-by: rdobrik <8812511+rdobrik@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement fully compatible MCP consumer processors
Implement MCP consumer for HTTP/WebSocket server endpoints
Feb 9, 2026
- Introduced `McpComponentConfigurer` and `McpEndpointConfigurer` for configuring component and endpoint properties. - Created `McpEndpointUriFactory` to support URI creation for MCP endpoints. - Added logging configuration for the MCP consumer. - Generated JSON metadata for the MCP component, including properties and supported methods. - Implemented Karavan metadata generation for MCP component and kamelets. - Added documentation for the MCP component, including usage examples for producer and consumer. - Created kamelet descriptors for MCP REST and WebSocket services.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds consumer implementation enabling Camel routes to act as MCP protocol servers via component URIs.
Changes
Consumer Implementation
McpConsumer.doStart()creates Undertow HTTP/WebSocket endpoints programmaticallyMcpConsumer.doStop()handles cleanup and server shutdownmcp.jsonrpc.method,mcp.jsonrpc.id,mcp.jsonrpc.type,mcp.tool.nameConfiguration
McpConfiguration:websocket,sendToAll,allowedOrigins,httpMethodRestrictMcpComponentto set URI from remaining path parameterTesting
McpConsumerTestcovers HTTP/WebSocket startup, JSON-RPC parsing, lifecycle managementUsage
YAML:
Requests require headers:
Content-Type: application/json,Accept: application/json, text/event-streamOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.