β‘
Automation
Automation utilities for Model Context Protocol (MCP) workflows
0 installs
Trust: 37 β Low
Automation
Ask AI about Automation
Powered by Claude Β· Grounded in docs
I know everything about Automation. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Loading tools...
Reviews
Documentation
@9d9/mcp-automation
Automation utilities for Model Context Protocol (MCP) workflows
Why?
Building MCP-based automation? This package provides a declarative workflow engine:
- Workflow builder β Define multi-step workflows with a fluent API
- Tool & resource definitions β Type-safe MCP tool/resource schemas
- Workflow execution engine β Run workflows with timeout, retry, and error handling
- Server config builder β Configure MCP servers (stdio, SSE, WebSocket)
Install
npm install @9d9/mcp-automation
Quick Start
import {
createWorkflow,
addStep,
createStep,
executeWorkflow,
createServerConfig,
defineTool,
defineResource,
} from "@9d9/mcp-automation";
// Define MCP server config
const config = createServerConfig("my-server", "stdio", {
command: "node",
args: ["server.js"],
});
// Define tools
const queryTool = defineTool("query", "Query data", {
type: "object",
properties: { q: { type: "string" } },
});
// Define resources
const dbResource = defineResource("mcp://db/users", "Users Database", {
description: "User records",
mimeType: "application/json",
});
// Build workflow
let workflow = createWorkflow("wf-1", "Data pipeline");
workflow = addStep(workflow, createStep("step-1", "query", { q: "hello" }));
workflow = addStep(workflow, createStep("step-2", "transform", { format: "json" }, {
timeout: 5000,
retry: { maxAttempts: 3, delay: 1000 },
}));
// Execute
const result = await executeWorkflow(workflow, async (tool, input) => {
// Your tool execution logic
return { data: "processed" };
});
// result.stepResults β [{ stepId, success, output, duration }]
// result.totalDuration β 123
API Reference
Server Config
| Function | Description |
|---|---|
createServerConfig(name, transport, opts?) | Build MCP server config |
Definitions
| Function | Description |
|---|---|
defineTool(name, description, inputSchema) | Define an MCP tool |
defineResource(uri, name, opts?) | Define an MCP resource |
Workflow Builder
| Function | Description |
|---|---|
createWorkflow(id, name) | Create empty workflow |
addStep(workflow, step) | Add step (returns new workflow) |
createStep(id, tool, input, opts?) | Create a step |
Workflow Execution
| Function | Description |
|---|---|
executeWorkflow(workflow, executor) | Run workflow with custom executor |
Step options:
interface WorkflowStep {
id: string;
tool: string;
input: Record<string, unknown>;
timeout?: number; // Step timeout in ms
retry?: {
maxAttempts: number;
delay: number; // Base delay for exponential backoff
};
}
Workflow error handling:
workflow.onError = "stop"; // Stop on first error (default)
workflow.onError = "continue"; // Continue on error
workflow.onError = "retry"; // Retry failed steps
Ecosystem
| Package | Description |
|---|---|
@9d9/pulsemcp-core | Core utilities |
@9d9/openclaw-utils | OpenClaw utilities |
@9d9/mcp-automation | MCP workflow automation (this package) |
License
MIT Β© 9d9 LLC
