defineAPI() once.
Four protocols. think() and remember() built in.

Write business logic and AI reasoning in the same handler. HTTP, MCP, A2A, and OpenAPI — generated automatically.

$ bunx create-capstan-app my-app

This single defineAPI() definition automatically creates: HTTP JSON API (Hono), MCP Tools (Claude Desktop), A2A Skills (Google Agent-to-Agent), OpenAPI 3.1 Spec.

app/routes/tickets/index.api.ts
import { defineAPI } from "@zauso-ai/capstan-core";
import { z } from "zod";

export const GET = defineAPI({
  input: z.object({
    status: z.enum(["open", "closed"]).optional(),
  }),
  output: z.object({
    tickets: z.array(z.object({
      id: z.string(),
      title: z.string(),
      status: z.string(),
    })),
  }),
  description: "List support tickets",
  capability: "read",
  resource: "ticket",
  async handler({ input }) {
    return { tickets: await db.tickets.list(input) };
  },
});

Why Capstan

Multi-Protocol APIs

One defineAPI() call exposes HTTP, MCP, A2A, and OpenAPI endpoints simultaneously.

AI Agent Toolkit

think(), generate(), agent loop with tool calls. Standalone @zauso-ai/capstan-ai.

Long-Term Memory

remember/recall/about scoping. Auto-dedup, hybrid search, context assembly.

Streaming SSR

React 18 renderToReadableStream, selective hydration, Image, Font, Metadata.

Security & Identity

JWT, OAuth, DPoP (RFC 9449), SPIFFE/mTLS, rate limiting, CSRF.

Database & RAG

Drizzle ORM, vector fields, embeddings, hybrid search, 4 providers.

Cache & ISR

cacheSet/cacheGet with TTL, tags, stale-while-revalidate.

EU AI Act Compliance

defineCompliance with risk levels, audit logging, approval workflows.

How Capstan Compares

FeatureCapstanNext.jsFastAPI
Multi-protocol (HTTP + MCP + A2A)+
OpenAPI auto-generation++
File-based routing++
React SSR++
Built-in auth (JWT + API keys)+~
Policy engine + approval workflow+
AI TDD verifier+
Built-in database layer+
AI Agent Toolkit+
Long-term Memory+
LLM Integration+~~
Cache / ISR++

+ built-in ~ partial not available | Full comparison

Quick Start

  1. Create
    bunx create-capstan-app my-app
  2. Develop
    cd my-app && bunx capstan dev
  3. Connect

    Your app is live with all agent endpoints ready:

    # Agent manifest
    curl http://localhost:3000/.well-known/capstan.json
    
    # OpenAPI spec
    curl http://localhost:3000/openapi.json
    
    # MCP server (for Claude Desktop / Cursor)
    bunx capstan mcp

Standalone AI Toolkit

@zauso-ai/capstan-ai works independently of the framework. Use it in any TypeScript project for structured LLM interaction and persistent memory.

import { createAI } from "@zauso-ai/capstan-ai";

const ai = createAI({ llm: openaiProvider({ apiKey: "..." }) });
await ai.think("Analyze this data");
await ai.remember("User prefers dark mode");
const context = await ai.memory.about("customer", "c-42").recall("preferences");

Explore the Docs

MIT License · Built with Capstan — APIs that speak human and machine.