examples/MCP-tools Public
components: mcp-server: kind: worker description: >- The Worker. Serves MCP over Streamable HTTP at /mcp, statelessly: each POST gets a fresh McpServer with every tool registered. Charges each tool call to the caller's rate limit, counts tool calls and serves the counts at /stats. owns: - src/index.ts - src/worker.ts - src/server.ts - src/usage.ts talks_to: - { to: tools, via: import } - { to: mcp-sdk, via: import } - { to: usage, via: kv } - { to: rate-limiter, via: rpc } rate-limiter: kind: durable-object description: >- One object per client IP holding a token bucket: 30 tool calls in a burst, one more every two seconds. Runs one call at a time, so the limit is exact. Clears itself once full. binding: RATE_LIMITER owns: - src/rate-limiter/** tools: kind: library description: >- The tools themselves: a name, a description written for models, zod input and output schemas and a pure run function each. No MCP, HTTP or bindings in here. owns: - src/tools/** talks_to: - { to: zod, via: import } usage: kind: kv description: Calls and errors per tool per UTC day, kept 90 days. Approximate by design. binding: USAGE mcp-sdk: kind: external description: The MCP TypeScript SDK. McpServer validates arguments and builds results; the Web-standard transport speaks Streamable HTTP. package: "@modelcontextprotocol/sdk" zod: kind: external description: Schema library for tool inputs and outputs. The SDK turns the schemas into JSON Schema for tools/list. package: zod