Skip to content

add cfb_* MCP tools for Cloudflare Workers Builds management#14

Open
vibe-dex wants to merge 7 commits into
mainfrom
vibe-dex/cfb-mcp
Open

add cfb_* MCP tools for Cloudflare Workers Builds management#14
vibe-dex wants to merge 7 commits into
mainfrom
vibe-dex/cfb-mcp

Conversation

@vibe-dex
Copy link
Copy Markdown
Contributor

@vibe-dex vibe-dex commented May 12, 2026

Summary

Customer-facing MCP surface for the Cloudflare Workers Builds backend landing in deco-sites/admin#3170. Adds 14 new `cfb_*` tools across 5 shared UIs: setup (one-click + status), secrets, build vars, builds (list/get/logs/trigger), and versions (list/rollback). Each tool is a thin `callAdmin` wrapper — no Cloudflare tokens or business logic live in this process; tenancy is enforced upstream by admin.

Schemas mirror the admin Props/return types exactly. Five new resources point at the same single `dist/client/index.html` bundle (consistent with the existing pattern); routing is by `toolName` in `web/router.tsx`. UIs handle all `McpStatus` states, surface destructive-action confirmations, and the builds UI polls `cfb_get_build_logs` every 2s for running builds.

Test plan

  • Pair with admin PR #3170 in dev; invoke each of the 14 tools from a real MCP host and verify the returned shape matches the admin loader/action
  • Tenancy probe: configure `SITE_NAME` for a site the test API key cannot access; confirm every `cfb_*` tool surfaces 404 from admin with no CF call
  • UI smoke: open each of the 5 shared pages through the MCP host; click happy path + one destructive path; confirm `toolResult` rendering and confirmation dialogs
  • End-to-end setup: against a throwaway test site, run `cfb_setup_status` (unprovisioned) → `cfb_setup` → `cfb_setup_status` (worker + both triggers); re-run `cfb_setup` and confirm idempotency

🤖 Generated with Claude Code


Summary by cubic

Adds 14 customer-facing cfb_* MCP tools with five shared UIs to onboard and manage Cloudflare Workers Builds (setup, secrets, build vars, builds, and version rollbacks) from the MCP host, and wires them into the Workers-ready app (createApp + static asset serving via ASSETS and wrangler). Also fixes cfb_list_builds by normalizing admin responses to arrays to prevent schema errors.

  • New Features

    • Setup: cfb_setup, cfb_setup_status for one-click onboarding and status.
    • Secrets: cfb_list_secrets, cfb_set_secret, cfb_delete_secret (names/types only; values never returned).
    • Build vars: cfb_list_build_vars, cfb_set_build_var, cfb_delete_build_var (plain text, non-secret).
    • Builds: cfb_list_builds, cfb_get_build, cfb_get_build_logs, cfb_trigger_build; logs UI polls every 2s while running.
    • Versions: cfb_list_versions, cfb_rollback with best-effort binding warnings.
    • Each tool is a thin callAdmin wrapper to admin endpoints in deco-sites/admin#3170; tenancy enforced upstream, no Cloudflare creds here.
    • Added five ui://mcp-app/* resources that all serve dist/client/index.html; web/router.tsx maps tools to shared pages; api/app.ts registers all five resources.
  • Migration

    • Requires the admin changes in deco-sites/admin#3170.
    • Ensure the MCP host provides the site name and admin API key expected by callAdmin (getConfig); no Cloudflare tokens are needed here.
    • Start with cfb_setup_status (read-only) or run cfb_setup to provision triggers and connect the repo.
    • To deploy on Workers, build the web bundle then use wrangler: bun run build:web && wrangler deploy (or deploy:preview); static assets are served from dist/client via the ASSETS binding. Optional: set DECO_ADMIN_URL in wrangler.jsonc to override the admin origin.

Written for commit 627f0a0. Summary will update on new commits.

vibe-dex and others added 5 commits May 12, 2026 16:50
14 new MCP tools across 5 shared UIs (cfb-setup, cfb-secrets,
cfb-build-vars, cfb-builds, cfb-versions) that wrap the admin
loaders/actions landing in deco-sites/admin#3170. Each tool is a thin
callAdmin wrapper; no Cloudflare tokens live in this process.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Split api/main.ts into a shared createApp factory plus Bun and Workers
entries. Resources are now factories that take a getClientHTML closure,
so the Workers entry can read the bundled HTML via env.ASSETS.fetch
while the Bun entry keeps using node:fs. Adds wrangler.toml with
[assets] directory = "dist/client" (serves index.html + Monaco worker
JS chunks) and an env.preview block for staging.

Bump NODE_OPTIONS heap on build:web to fix the previous Vite OOM.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Brings the Workers-deploy refactor into the cfb-mcp branch so both PRs
can ship together. Adapted the 5 cfb_* resources to the new
createXAppResource(getClientHTML) factory pattern and added them to
createApp()'s resources array.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 12, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
admin-mcp 627f0a0 Commit Preview URL

Branch Preview URL
May 13 2026, 12:38 AM

vibe-dex and others added 2 commits May 12, 2026 21:13
Admin's CloudflareBuildsClient.listBuilds passes `json.result` through
unchanged, but CF's Builds list endpoint may wrap results as
`{ items: [...] }` instead of returning a bare array — so the MCP
wrapper was receiving an object and failing output schema validation
with "expected array, received object". Mirror the same defense the
admin code already applies to `getBuildLogs` and `WorkerVersions.list`.
The real fix belongs in admin (clients/cloudflareBuilds.ts), but this
keeps the MCP unblocked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant