One action contract. Every surface.
A framework-agnostic TypeScript action registry that keeps validation, execution, errors and retry semantics attached to one operation, then exposes thin adapters around it.
Project page · Demo fixture · Latest release
npm install github:yashkhou/actionmesh zodimport { defineAction, ActionRegistry } from 'actionmesh';The same capability often gets rewritten as a backend route, an agent tool, a CLI script and an MCP handler. Those copies drift. ActionMesh keeps one implementation and treats transports as adapters—not new places for business logic.
- Typed
defineAction()contracts - Zod input validation before execution
- Optional output validation
- Stable machine-readable
ActionMeshErrorcodes - Retries only when explicitly retryable
- MCP-style
listTools()/callTool()adapter - Node HTTP handler and CLI invocation helper
Inspect the adapter demo fixture →
git clone https://github.com/yashkhou/actionmesh.git
cd actionmesh
npm install
npm test
npm run build
node examples/demo.mjsconst registry = new ActionRegistry().register(defineAction({
name: "lookup-lead",
description: "Look up a lead by id",
input: z.object({ id: z.string() }),
output: z.object({ id: z.string(), status: z.string() }),
run: async ({ id }) => ({ id, status: "active" }),
}));
await registry.invoke("lookup-lead", { id: "lead_123" });flowchart LR
A[UI / app] --> E[Action contract]
B[Agent] --> E
C[MCP-style adapter] --> E
D[HTTP / CLI] --> E
E --> F[Input schema]
F --> G["run()"]
G --> H[Output schema]
H --> I[One result / error contract]
The design rule is intentionally narrow: one action owns the contract; adapters translate transports without reimplementing business logic.
- Keep an agent tool and application API on the same implementation
- Generate tool schemas from the same runtime validation
- Centralize retryable vs deterministic failures
- Reuse backend operations from scripts and CI without duplicating logic
ActionMesh is a framework-agnostic TypeScript action registry that keeps an operation’s input schema, output schema, implementation, errors and retry semantics in one contract.
It reduces drift between agent tools, HTTP routes, CLI commands and MCP-style surfaces by keeping business logic in one action implementation and treating transports as adapters.
The current release ships an MCP-style listTools/callTool adapter. An official Model Context Protocol SDK transport is a separate roadmap item.
ActionMesh uses Zod schemas for runtime input validation and can also validate outputs before returning them to callers.
- Official Model Context Protocol transport package
- OpenAPI generation
- Action middleware and authorization policies
- Structured audit hooks
- Concurrency and idempotency policies
- BrowserProof - browser-state verification for AI agents and Playwright workflows.
- RunLedger - tamper-evident execution history for AI-agent runs.
- ActionMesh - typed action contracts for tools, HTTP and CLI.
npm install
npm test
npm run buildCI runs tests and the TypeScript build on every push and pull request.
- Docs source: docs/
- Project page: https://yashkhou.com/projects/actionmesh
- Source: https://github.com/yashkhou/actionmesh
- Author: Yash / @yashkhou
MIT. See LICENSE.