kestrel.markets
Version:
A typed, token-efficient language + runtime for agentic trading: agents author bounded plans, the runtime fires them at the tick. CLI + typed library + MCP server.
52 lines (48 loc) • 1.93 kB
text/typescript
/**
* # kestrel.markets/mcp — the MCP face as a lossless SDK projection (kestrel-djm.7)
*
* One of ADR-0004's four equal faces (http / sdk / cli / mcp). `createKestrelMcpServer({ transport })` builds
* `createSdk(transport)` internally and exposes it as an MCP server — a JSON-RPC 2.0 dispatcher over RESOURCES
* (the static djm.8 catalog + the immutable, content-addressed artifacts) and TOOLS (validate, the incremental
* Session lifecycle, Grade, and Operation continuation). It is a THIN PROJECTION: it marshals MCP requests into
* SDK calls and marshals the SDK's djm.2 protocol objects back out VERBATIM — no runtime semantics of its own,
* no fifth Kestrel statement kind. A 402/Offer is structured continuation DATA; the failure taxonomy
* (transport error ≠ Kestrel refusal ≠ STAND_DOWN) is caller-distinguishable and fail-closed.
*
* @example
* ```ts
* import { createKestrelMcpServer, serveStdio } from "kestrel.markets/mcp";
* import { localTransport, remoteTransport } from "kestrel.markets/sdk";
*
* const server = createKestrelMcpServer({ transport: localTransport() }); // in-process execution
* // const server = createKestrelMcpServer({ transport: remoteTransport({ baseUrl }) }); // managed backend
* await serveStdio(server); // newline-delimited JSON-RPC 2.0 over stdin/stdout
* ```
*/
export { createKestrelMcpServer } from "./server.ts";
export type { KestrelMcpServer, KestrelMcpServerOptions } from "./server.ts";
export { serveStdio } from "./stdio.ts";
export {
TOOL,
CATALOG_URI_PREFIX,
ARTIFACT_URI_PREFIX,
artifactUri,
McpProtocolError,
PARSE_ERROR,
INVALID_REQUEST,
METHOD_NOT_FOUND,
INVALID_PARAMS,
INTERNAL_ERROR,
} from "./protocol.ts";
export type {
JsonRpcId,
JsonRpcRequest,
JsonRpcResponse,
JsonRpcError,
Resource,
ResourceContents,
ToolResult,
ToolDescriptor,
ContentBlock,
ToolName,
} from "./protocol.ts";