🤖 AI Summary
A new extension to the Model Context Protocol (MCP) SDK—mcp-workflow (npm i @p0u4a/mcp-workflow)—turns MCP servers into lightweight workflow engines so you can define durable, multi-step orchestrations out of individual tool calls. Instead of one-off tool invocations, developers can register McpWorkflow instances as MCP tools ({workflow}_start and {workflow}_continue) and drive complex processes with automatic session/state management, lifecycle hooks, built-in validation, retries, conditional steps and branching. This makes it straightforward to build resilient tool-based pipelines for LLMs and other MCP clients (e.g., Gemini) that need multi-step coordination and observability.
Technically, the library models work as McpActivityTool instances (each with run, onSuccess, onFailure, onComplete callbacks, timeouts, retries, and Zod input/output schemas) that are composed into McpWorkflow sequences. WorkflowSessionManager manages sessions and in-memory memory by default via InMemoryWorkflowStore, but WorkflowStore is an abstract interface so you can plug in Redis, PostgreSQL, etc., for persistence. Activities can return toolCallSuggestions to enable dynamic branching, and workflows support input mapping, conditional skips, and execution history. The API is small and example-driven, making it easy to attach workflows to an MCP server and move from simple tool calls to durable, auditable orchestrations.
Loading comments...
login to comment
loading comments...
no comments yet