@tailworks/mcp
v0.2.0
Published
withTailnet, caller(), authorizeTool and budget() for stateless MCP servers on tw
Downloads
198
Maintainers
Readme
@tailworks/mcp
Stateless MCP servers on tailworks, authorized per caller from the tailnet: no OAuth and no sessions, because WireGuard and WhoIs authenticate every request.
import { withTailnet, caller, authorizeTool, budget } from "@tailworks/mcp";
export { TwBudget } from "@tailworks/mcp/budget-do";withTailnet(handler): wraps an MCP handler (for examplecreateMcpHandlerfromagents/mcp/server) socaller()works inside tools.authorizeTool(caller, cap, facts): checks the caller's app capability grant (tool name, limits such asmaxUsd) and throwscap_missing.budget(ns, caller, tool).reserve(n): a per-caller daily budget kept in theTwBudgetDurable Object.mcpFetch(ctx): afetchfor MCP clients that leaves from this node's tailnet identity.
tw init my-mcp --template mcp creates a working server.
