Fix #620: New MCP server module proposal#621
Conversation
baldimir
left a comment
There was a problem hiding this comment.
I didn't read through the implementation details (classes etc.) however I like it. I agree, we should definitely have MCP and the architecture looks fine based on what I read.
|
|
||
| The Model Context Protocol (MCP) is an open-source standard protocol (governed by the Linux Foundation's Agentic AI Foundation since December 2025) that enables AI applications to connect to external data sources, tools, and workflows through a standardized interface. MCP uses JSON-RPC 2.0 and defines three core primitives: tools (executable functions), resources (data sources), and prompts (reusable templates). | ||
|
|
||
| Quarkus Flow is a workflow engine based on the CNCF Serverless Workflow specification. Currently, there is no standard way for AI systems to discover, execute, and monitor Quarkus Flow workflows. Adding MCP support would enable: |
There was a problem hiding this comment.
| Quarkus Flow is a workflow engine based on the CNCF Serverless Workflow specification. Currently, there is no standard way for AI systems to discover, execute, and monitor Quarkus Flow workflows. Adding MCP support would enable: | |
| Quarkus Flow is a workflow engine based on the Serverless Workflow specification, a CNCF project. Currently, there is no standard way for AI systems to discover, execute, and monitor Quarkus Flow workflows. Adding MCP support would enable: |
|
|
||
| 3. **Prompts**: Assist with workflow operations and generation | ||
| - `construct_workflow_input` - Help construct valid input for a workflow | ||
| - `analyze_workflow_schema` - Help understand workflow input requirements |
There was a problem hiding this comment.
maybe this could be split into:
analyze_workflow_input_schema- Help understand workflow input requirementsanalyze_workflow_schema- Help understand workflow steps
| /** | ||
| * List all workflow definitions, optionally filtered by namespace. | ||
| */ | ||
| public Stream<WorkflowDefinition> listWorkflows(String namespace) { |
There was a problem hiding this comment.
I am thinking about cases where there are lots of workflows, we could consider introducing alternative with paging
|
|
||
| return TextResourceContents.create( | ||
| "workflow://definitions", | ||
| toJson(defs) |
There was a problem hiding this comment.
This could result in huge context depending on List<WorkflowDefinitionInfo> defs, not sure how this is handled later, still 1300 lines to go 😄
| * Find workflow by namespace, name, and optional version. | ||
| * If version is null, returns the latest version using WorkflowVersionComparator. | ||
| */ | ||
| public Optional<WorkflowDefinition> findWorkflow(String namespace, String name, String version) { |
There was a problem hiding this comment.
We could consider some caching mechanism here.
| ); | ||
| } catch (WorkflowNotFoundException e) { | ||
| throw new McpException(-32602, e.getMessage()); | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Could be later expanded with more specific exceptions to improve the error handling experience.
| ```java | ||
| @Tool(description = "Execute a dynamically generated workflow from YAML definition") | ||
| public WorkflowExecutionResult executeYamlWorkflow( | ||
| @ToolArg(description = "Workflow definition in YAML format (CNCF Serverless Workflow spec)") String yamlDefinition, |
There was a problem hiding this comment.
What if the YAML has infinite loop or some malicious code etc.? Can this be handled somehow?
| 1. **User**: "Create a workflow that fetches user data from API A, transforms it, and sends to API B" | ||
| 2. **AI**: Reads `workflow://spec/schema` and `workflow://spec/examples` | ||
| 3. **AI**: Generates YAML workflow definition | ||
| 4. **AI**: Calls `validate_yaml_workflow` to check syntax |
There was a problem hiding this comment.
Imho there should always be something like **User**: Reviews the generated workflow definition in these scenarios
domhanak
left a comment
There was a problem hiding this comment.
I have reached Phase 5 - Left some comments. Will try to finish tomorrow.
There was a problem hiding this comment.
It looks really a great feature @ricardozanini!
Considering we have currently some features in DevUI which we can call via MCP in dev mode (methods annotated with @JsonRpcDescription on ManagementLifecycleRPCService and WorkflowRPCService), I think we need to put into the roadmap the reuse of quarkus-flow-api on those classes.
See https://quarkus.io/guides/dev-mcp#mcp-tools-against-the-runtime-classpath.
| - Uses shared `WorkflowExecutionService` and `WorkflowDefinitionService` | ||
|
|
||
| 2. **Resources**: Query workflow metadata and specifications | ||
| - `workflow://definitions` - List all registered workflow definitions |
There was a problem hiding this comment.
I think the use of workflow so generic, why not flow://?
Description
Fixes #620
@quarkiverse/quarkiverse-flow-triage please review and add your considerations.
Changes