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");