deploy_cloudflare_worker
Deploy Cloudflare Workers with state tracking and health checks for reliable infrastructure orchestration. Ensures deployments are managed through proper channels instead of direct SSH commands.
Instructions
Deploy Cloudflare Worker with state tracking and health checks. DO NOT use ssh_exec('wrangler deploy') - always use this tool instead.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| worker_name | Yes | Worker name (e.g., 'voicenotes-webhook') | |
| source_dir | No | Source directory containing wrangler.toml | |
| env | No | Environment (production/staging, default: production) |
Implementation Reference
- src/index.ts:209-222 (handler)Handler for the deploy_cloudflare_worker tool. Extracts input arguments and invokes the executeOrchestrator helper with the 'deploy/cloudflare-worker' operation.case "deploy_cloudflare_worker": { const { worker_name, source_dir, env } = args as { worker_name: string; source_dir?: string; env?: string; }; result = executeOrchestrator("deploy/cloudflare-worker", { worker_name, source_dir: source_dir || `/Users/customer/${worker_name}`, env: env || "production" }); break; }
- src/index.ts:72-89 (schema)Input schema for the deploy_cloudflare_worker tool defining required and optional parameters.inputSchema: { type: "object", properties: { worker_name: { type: "string", description: "Worker name (e.g., 'voicenotes-webhook')" }, source_dir: { type: "string", description: "Source directory containing wrangler.toml" }, env: { type: "string", description: "Environment (production/staging, default: production)" } }, required: ["worker_name"] }
- src/index.ts:69-90 (registration)Registration of the deploy_cloudflare_worker tool in the tools array used for MCP server tool listing.{ name: "deploy_cloudflare_worker", description: "Deploy Cloudflare Worker with state tracking and health checks. DO NOT use ssh_exec('wrangler deploy') - always use this tool instead.", inputSchema: { type: "object", properties: { worker_name: { type: "string", description: "Worker name (e.g., 'voicenotes-webhook')" }, source_dir: { type: "string", description: "Source directory containing wrangler.toml" }, env: { type: "string", description: "Environment (production/staging, default: production)" } }, required: ["worker_name"] } },
- src/index.ts:16-43 (helper)Shared helper function executeOrchestrator that executes the external Python orchestrator script for all deployment operations, including deploy_cloudflare_worker.function executeOrchestrator(operation: string, params: Record<string, string> = {}): any { const paramStr = Object.entries(params) .map(([key, value]) => `${key}="${value}"`) .join(" "); const cmd = `cd ${ORCHESTRATOR_PATH} && python orchestrator.py ${operation} ${paramStr}`; try { const output = execSync(cmd, { encoding: "utf-8", maxBuffer: 10 * 1024 * 1024 }); // Try to parse as JSON, fallback to plain text try { return JSON.parse(output); } catch { return { output: output.trim() }; } } catch (error: any) { return { success: false, error: error.message, stderr: error.stderr?.toString() || "", stdout: error.stdout?.toString() || "" }; } }