Getting started
Install Prism from npm and serve your first operation.
Install the packages you need. Peer dependency: zod ^4 (a second copy breaks instanceof checks and OpenAPI query schemas).
npm install @prism/core @prism/agent @prism/hono zod@^4npm install @hono/node-serverDefine and serve
Section titled “Define and serve”One file: define an operation, project it to HTTP, listen.
import { serve } from "@hono/node-server";import { agent, http } from "@prism/agent";import { implement, op } from "@prism/core";import { toFetch } from "@prism/hono";import { z } from "zod";
const ping = implement( op() .input(z.object({ name: z.string() })) .output(z.object({ message: z.string() })) .meta( http({ method: "POST", path: "/ping" }), agent({ description: "Say hello." }), ),).handler(async ({ input }) => ({ message: `hello ${input.name}` }));
const app = toFetch( { ping }, { openapi: { title: "Ping", version: "0.1.0" } },);
serve({ fetch: app, port: 3000 }, (info) => { console.log(`listening on http://localhost:${info.port}`); console.log(`OpenAPI: http://localhost:${info.port}/openapi.json`);});npx tsx server.tscurl -X POST http://localhost:3000/ping \ -H 'content-type: application/json' \ -d '{"name":"prism"}'# {"message":"hello prism"}That is a served operation from this page alone. The same { ping } router projects to MCP, AI SDK tools, and a CLI — see Surfaces.
Packages
Section titled “Packages”| Package | Role |
|---|---|
@prism/core |
Contracts, execute, Result |
@prism/agent |
Scopes, HTTP meta, confirmation gate |
@prism/hono |
REST + OpenAPI |
@prism/mcp |
MCP tools |
@prism/ai-sdk |
AI SDK tools |
@prism/cli |
CLI projection |
@prism/client |
Typed HTTP client |
All current packages are 0.2.0-beta.1.