Adapters
Same action. Seven adapters.
An adapter is a single transport. Chain as many as you like onto one Silkweave instance and the same actions are served everywhere at once - an MCP tool for the agent, a REST endpoint for the dashboard, a CLI for your terminal - all from one definition.
How adapters compose
Adapters are additive. You add them to the builder and call .start() once; each
adapter receives the full action set and registers it in its own dialect.
silkweave({ name: 'my-server', version: '1.0.0' })
.adapter(stdio()) // MCP for the agent
.adapter(fastify()) // REST for the dashboard
.adapter(trpc()) // typed procedures for the frontend
.action(GreetAction)
.start() Per-action isEnabled filtering lets you gate an action to specific transports - say,
an admin action exposed over the CLI but hidden from public MCP.
The adapters
- MCP stdio
Run actions as Model Context Protocol tools over stdin/stdout - the transport Claude Desktop, Cursor, and most local agents speak. Tools register in PascalCase from your action names.
@silkweave/mcp - MCP streamable HTTP
The same MCP tools over Streamable HTTP with session management, ready for remote agents. Pairs with @silkweave/auth for bearer tokens or full OAuth 2.1.
@silkweave/mcp - Fastify REST
Turn actions into a REST API with auto-generated OpenAPI and an interactive Swagger UI. Map one input schema across path params, query string, and body.
@silkweave/fastify - tRPC
Each action becomes a typed tRPC procedure - query or mutation by kind. Export InferTrpcRouter<typeof server> for an end-to-end typed client, no codegen.
@silkweave/trpc - CLI
Expose actions as a command-line tool with Commander and Clack prompts. Zod types map to flags and arguments; commands use kebab-case.
@silkweave/cli - Edge / Serverless
Stateless MCP over Streamable HTTP on Web Standard Request/Response - deploy to Vercel, Cloudflare Workers, or Bun with zero lock-in.
@silkweave/edge - Typegen
A build-time adapter: emit .d.ts interfaces from your action Zod schemas at build, for full type safety with zero runtime cost.
@silkweave/typegen
Streaming, per transport
A streaming action (an async function* with a chunk schema) is
delivered the right way by each adapter: MCP notifications/progress, SSE or NDJSON
over Fastify, and native tRPC subscriptions. You write the generator once; the wire format is the
adapter's problem. See streaming.