-
SDK coverage — Check whether the operation exists on the official
cloudflareclient (e.g.client.<service>.<method>). If only REST is available, add a small helper insrc/lib/usingToolContext#cfGetJson/cfDelete/cfHeadHeaders(same auth as the SDK). -
Tool module — Create
src/tools/<service>.ts(or extend an existing file) and exportregister<Name>Tools(server, ctx). -
Registration — Call your registrar from
src/tools/index.tsinsideregisterAllTools. -
Schemas — Define Zod fields on
registerTool’sinputSchema. Reuse helpers insrc/lib/schemas.tsfor ids and safety checks. -
Errors — Wrap handlers with
runTool()fromsrc/lib/errors.tsso failures become structured MCP errors and the process stays alive. -
Tests — Add
tests/<area>.test.tsfor validation logic and pure helpers; mock the SDK for HTTP-heavy paths when practical. -
Docs — Update
TOOLS.mdand the table inREADME.mdif you add or change tools.
npm run build
npm testMatch existing patterns: ESM imports with .js extensions in src/, minimal comments, no unrelated refactors.