defineAPI() 一次。think() 和 remember() 已内建。在同一个 handler 里混合业务逻辑与 AI 推理。HTTP、MCP、A2A、OpenAPI — 自动生成。
一个 defineAPI() 定义自动创建: HTTP JSON API (Hono), MCP 工具 (Claude Desktop), A2A 技能 (Google Agent-to-Agent), OpenAPI 3.1 规范.
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) };
},
});一个 defineAPI() 同时暴露 HTTP、MCP、A2A 和 OpenAPI 端点。
think()、generate()、带工具调用的 agent loop。独立包 @zauso-ai/capstan-ai。
remember/recall/about 维度隔离。自动去重、混合检索、上下文组装。
React 18 renderToReadableStream,选择性 hydration,Image/Font/Metadata。
JWT、OAuth、DPoP (RFC 9449)、SPIFFE/mTLS、限流、CSRF。
Drizzle ORM、向量字段、嵌入、混合搜索、4 种数据库支持。
cacheSet/cacheGet,TTL、标签、stale-while-revalidate。
defineCompliance 风险分级、审计日志、审批工作流。
| 功能 | Capstan | Next.js | FastAPI |
|---|---|---|---|
| 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 | + | + | – |
+ 内置 ~ 部分 – 不可用 | 完整对比
bunx create-capstan-app my-appcd my-app && bunx capstan dev你的应用已上线,所有 agent 端点就绪:
# 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@zauso-ai/capstan-ai 无需完整框架即可使用。可在任何 TypeScript 项目中用于结构化 LLM 交互和持久记忆。
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");