The same definitions as an MCP server over stdio (newline-delimited JSON-RPC 2.0), with no dependencies: one tool per command, its inputSchema from the definition, calls checked before they run with the fix in the one error shape, effects as tool annotations, and results cut to a size an agent's context can hold. It follows the MCP specification.
npx shadcn@latest add ourostack/ouro-ui/ax-mcp#v1.3.10It installs lib/ouro/ax/mcp.ts, with ax-cli, ax-command, ax-effects, ax-outcome, ax-output, ax-problem, ax-wait. Its tests are ax-mcp-tests. Every item runs on Node 22.18 or later as it is copied: the files import each other as ./<file>.ts. The Ouro AX guide shows how they fit together.
Exports
createMcpHandler
Handles one JSON-RPC message; null for a notification, which gets no reply. Exposed for tests.
function createMcpHandler(options: McpOptions) => (message: unknown): Promise<Reply | null>McpCall
Runs one command for a tool call; the default runs the definition's run().
type McpCall = (cmd: CommandDef, input: Input) => Promise<McpCallResult>;McpCallResult
type McpCallResult = { ok: true; data: unknown; text?: string } | { ok: false; error: AxErrorShape };McpOptions
interface McpOptions {
cli: Cli;
version?: string;
call?: McpCall;
include?: (cmd: CommandDef) => boolean;
maxChars?: number;
concurrent?: boolean;
}McpTool
interface McpTool {
name: string;
title: string;
description: string;
inputSchema: ReturnType<typeof commandManifest>["inputSchema"];
annotations: { title: string; readOnlyHint: boolean; destructiveHint: boolean; openWorldHint: boolean };
}mcpTools
function mcpTools(options: McpOptions): McpTool[]PROTOCOL_VERSIONS
The same definitions as an MCP server over stdio (newline-delimited JSON-RPC 2.0), with no dependencies: one tool per command, its inputSchema from the definition, calls checked before they run with the fix in the one error shape, effects as tool annotations, and results cut to a size an agent's context can hold. It follows the MCP specification.
const PROTOCOL_VERSIONS: readonly ["2025-06-18", "2025-03-26", "2024-11-05"]serveMcp
Serves MCP on a byte stream until it ends: one JSON-RPC message per line in, one reply per line out.
function serveMcp(options: McpOptions & { input: AsyncIterable<string | Uint8Array<ArrayBufferLike>> | Iterable<string | Uint8Array<ArrayBufferLike>>; output: { write(s: string): unknown; }; }): Promise<void>toolName
"draft set" is the tool draft_set.
const toolName: (cmd: CommandDef<unknown, RunContext>) => string