-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for MCP Camel consumer over WebSockets #1
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature Request: MCP Camel Consumer Over WebSockets
Goal:
Enable the MCP Camel consumer to receive and process messages over WebSockets, allowing real-time bidirectional MCP JSON-RPC communication in addition to existing HTTP flows.
Background:
- The core MCP Camel consumer logic resides in
src/main/java/io/dscope/camel/mcp/McpConsumer.java, which currently acts as a stub with a placeholder for Undertow listener integration. - The MCP endpoint and component classes (
McpEndpoint,McpComponent) are found in the same package and are responsible for configuration and consumer instantiation. - Existing sample flows for HTTP and WebSocket endpoints are managed in
samples/mcp-serviceand described in the sample README. WebSocket endpoints are exposed atws://localhost:8090/mcp. - The sample service boots both HTTP and WebSocket helper routes, using YAML configuration (
routes/mcp-service-ws.yaml).
Proposed Solution:
- Implement the missing WebSocket server logic in McpConsumer using Undertow (or Camel’s built-in WebSocket support).
- Ensure compatibility with existing MCP JSON-RPC methods (
initialize,ping,resources/get,tools/list,tools/call). - Support per-connection replies according to the documented
wscatusage:- Example:
{ "jsonrpc": "2.0", "id": "ws-1", "method": "resources/get", ... }
- Example:
- Add configuration options to select HTTP or WebSocket consumer mode.
- Document sample usage and update the integration tests.
Relevant Code:
public class McpConsumer extends DefaultConsumer {
private final McpEndpoint endpoint;
public McpConsumer(McpEndpoint endpoint, Processor processor) {
super(endpoint, processor);
this.endpoint = endpoint;
}
@Override
protected void doStart() throws Exception {
super.doStart();
// Placeholder for Undertow listener integration
}
}public class McpEndpoint extends DefaultEndpoint {
...
@Override public Consumer createConsumer(Processor processor) { return new McpConsumer(this, processor); }
...
}samples/mcp-service/README.md- Describes both HTTP and WebSocket flows; WebSocket endpoint is
ws://localhost:8090/mcp.
- Describes both HTTP and WebSocket flows; WebSocket endpoint is
Acceptance Criteria:
- MCP Camel consumer supports WebSocket connections and processes MCP JSON-RPC requests and notifications.
- WebSocket endpoint is configurable and documented.
- Sample flows and integration tests validate WebSocket support.
References:
Copilot is powered by AI, so mistakes are possible. Leave a comment via the 👍 👎 to share your feedback and help improve the experience.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request