Implementation:0sec labs 0 Workflow Integration
| Knowledge Sources | |
|---|---|
| Domains | MCP, Workflow_Management, Persistence |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete tool for exposing workflow management tools (list, start, cancel runs; create, send sessions) via the MCP server with SQLite persistence, provided by the 0security CLI and shared packages.
Description
When the --workflows flag is set, the MCP server extends its tool surface with workflow management tools backed by SecurityWorkflowStore (SQLite). The SecurityWorkflowBindingsSchema (Zod) from @0/shared defines the workflow bindings contract. Tools include list_workflows, get_workflow, save_workflow, start_run, get_run, get_run_results, cancel_run, list_sessions, create_session, send_message, resume_session, and more. The workflow runtime is shared between the CLI (0 workflow) and MCP exposure.
Usage
Import this when you need to expose workflow management capabilities to external AI agents via MCP. It is Step 4 (optional) of the MCP server integration workflow.
Code Reference
Source Location
- Repository: 0security
- File: packages/cli/src/commands/mcp-server.ts:L82-86 (MCP_WORKFLOW_TOOL_NAMES), packages/cli/src/commands/workflow.ts, packages/db/
Signature
// Workflow tool names exposed via MCP
const MCP_WORKFLOW_TOOL_NAMES: Set<string>;
// Includes: list_templates, get_template, list_workflows, get_workflow,
// save_workflow, start_run, get_run, get_run_results, cancel_run,
// list_runs, list_sessions, create_session, attach_session, get_session,
// send_message, continue_session, cancel_session, resolve_decision,
// list_saved_sessions, resume_session, get_session_events,
// get_capabilities, resume_scan, start_assessment
// Zod schema from @0/shared
import { SecurityWorkflowBindingsSchema } from "@0/shared";
// SQLite persistence from @0/db
import { SecurityWorkflowStore } from "@0/db";
Import
// Workflow integration is activated via CLI flag:
// 0 mcp-server --workflows --db-path ./0.db
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| workflows | boolean | Yes /// Enable workflow tool exposure (--workflows flag) | |
| dbPath | string | No /// SQLite database path | |
| session | string | No /// Session id | |
| allowApply | boolean | No /// Allow workflow state mutations |
Outputs
| Name | Type | Description |
|---|---|---|
| server | McpServer /// Extended MCP server with workflow management tools |
Usage Examples
Via CLI
# Start MCP server with workflow tools
0 mcp-server --workflows --db-path ./0.db --session research-1
# External agent can now call:
# - list_workflows
# - start_run
# - create_session / send_message
# - get_run_results