Skip to content

Latest commit

 

History

History
28 lines (16 loc) · 1.27 KB

File metadata and controls

28 lines (16 loc) · 1.27 KB

Contributing

Adding a new Cloudflare service

  1. SDK coverage — Check whether the operation exists on the official cloudflare client (e.g. client.<service>.<method>). If only REST is available, add a small helper in src/lib/ using ToolContext#cfGetJson / cfDelete / cfHeadHeaders (same auth as the SDK).

  2. Tool module — Create src/tools/<service>.ts (or extend an existing file) and export register<Name>Tools(server, ctx).

  3. Registration — Call your registrar from src/tools/index.ts inside registerAllTools.

  4. Schemas — Define Zod fields on registerTool’s inputSchema. Reuse helpers in src/lib/schemas.ts for ids and safety checks.

  5. Errors — Wrap handlers with runTool() from src/lib/errors.ts so failures become structured MCP errors and the process stays alive.

  6. Tests — Add tests/<area>.test.ts for validation logic and pure helpers; mock the SDK for HTTP-heavy paths when practical.

  7. Docs — Update TOOLS.md and the table in README.md if you add or change tools.

Local checks

npm run build
npm test

Code style

Match existing patterns: ESM imports with .js extensions in src/, minimal comments, no unrelated refactors.