3.0 KiB
3.0 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 01-expose-workflow-export | Expose workflow export through MCP | done | 1 | plan.md | ../../specs/integrations/external-mcp.md |
Task 01: Expose Workflow Export Through MCP
Intent
Add export_workflow_kandev to the configuration and external MCP surfaces. Reuse the existing single-workflow export service.
Acceptance
- Configuration and external clients receive the new tool with one required
workflow_idargument. Task and Office clients do not receive it. - A successful call returns one version 1
kandev_workflowJSON document. The import handler accepts the text unchanged within its size limit. - Missing, unknown, or inaccessible workflow IDs return tool errors without a partial document.
Verification
cd apps/backend && go test ./internal/mcp/handlers ./internal/mcp/server ./pkg/websocket
Files likely touched
apps/backend/pkg/websocket/actions.goapps/backend/internal/mcp/handlers/handlers.goapps/backend/internal/mcp/handlers/config_workflow_handlers.goapps/backend/internal/mcp/handlers/config_workflow_handlers_test.goapps/backend/internal/mcp/server/config_handlers.goapps/backend/internal/mcp/server/config_handlers_test.goapps/backend/internal/mcp/server/server_test.goapps/backend/config/prompts/config-context.md
Dependencies
None.
Parallelism
Sequential. This task owns the MCP action, handler, registration, prompt contract, and focused backend tests.
Inputs
docs/specs/integrations/external-mcp.md, workflow export sections and scenarios.docs/plans/workflow-mcp-export/plan.md, Backend and Tests sections.- The
import_workflow_kandevaction, handler, server bridge, and tests as the nearest pattern. workflow.Service.ExportWorkflowas the only workflow export assembly path.
Risks
- Do not bypass the scoped request context.
- Do not create a second portable format or a new size limit.
- Keep internal service errors out of the MCP result.
Output contract
Report the files changed, the red and green test results, remaining risks, and task status. Update this task and plan.md in the same conversation.
Results
- Added
export_workflow_kandevto the configuration and external MCP surfaces. - Reused
workflow.Service.ExportWorkflowand the existing JSON-text bridge. - Added coverage for registration, portable output, unchanged import round trips, missing IDs, and service errors.
- Verification:
cd apps/backend && go test ./internal/mcp/handlers ./internal/mcp/server ./pkg/websocketpassed with 696 tests. - PR fixup added read-only, non-destructive, idempotent, closed-world tool annotations; documented the 1 MiB import limit in the tool description; and rejected empty or whitespace-only IDs before forwarding.
- Fixup regression verification: the new annotation and whitespace-ID tests failed before the patch, then passed after it.
- Fixup verification:
go test ./internal/mcp/handlers ./internal/mcp/server ./pkg/websocketpassed with 698 tests andmake -C apps/backend lintreported 0 issues.