The Cloud Host is the production-grade deployment of the Executor platform, running on Cloudflare Workers. It leverages Durable Objects for stateful Model Context Protocol (MCP) sessions, Hyperdrive for high-performance PostgreSQL access, and Autumn for usage-based billing and metering.
The cloud host integrates the shared @executor-js/api and @executor-js/core logic into a serverless environment. It uses a unified fetch handler to route traffic between the TanStack Start SSR application, the protected plugin API, and the stateful MCP session bridge.
The following diagram bridges the natural language request flow to the specific code entities and files that handle them.
Sources: apps/cloud/src/server.ts103-146 apps/cloud/src/start.ts81-90 apps/cloud/src/mcp/agent-handler.ts115-176
Executor Cloud uses three primary Durable Object classes to manage stateful execution and rate limiting.
This is the core of the MCP implementation. It inherits from McpAgentSessionDOBase and provides a stateful bridge for MCP clients.
v2, it uses the DO SQLite backend for session persistence apps/cloud/wrangler.jsonc52-55McpResource (e.g., a Toolkit) and have an inactivity alarm that triggers cleanup packages/hosts/cloudflare/src/mcp/agent-session-durable-object.ts38-46Maintains a mapping of execution IDs to the specific Durable Object instances that own them. This allows the system to route "Resume" requests (from browser approvals) to the correct stateful session apps/cloud/src/server.ts75
A per-organization counter used as an abuse backstop. It tracks execution volume within a sliding window and triggers alarms to purge stale counters apps/cloud/wrangler.jsonc29-35
Sources: apps/cloud/src/server.ts57-75 apps/cloud/wrangler.jsonc19-64 packages/hosts/cloudflare/src/mcp/agent-session-durable-object.ts206-210
The cloud host uses PostgreSQL as its primary datastore via Cloudflare Hyperdrive.
DbService resolves connection strings dynamically. In production, it targets the Hyperdrive binding HYPERDRIVE to pool connections and reduce latency apps/cloud/wrangler.jsonc71-77postgres.js socket is rebuilt per-request using RequestScopedServicesLive apps/cloud/src/api/layers.ts29-33combinedSchema that includes core platform tables and plugin-specific requirements apps/cloud/src/mcp/session-durable-object.ts162-164Sources: apps/cloud/src/db/db.ts153-168 apps/cloud/wrangler.jsonc71-77 apps/cloud/src/api/layers.ts29-33
Usage-based billing is integrated via the Autumn service. Metering occurs at the execution stack level, ensuring that both HTTP API calls and MCP tool invocations are tracked.
CloudMeteredExecutionStackLayer which wraps the standard execution engine to emit usage events to Autumn apps/cloud/src/api/protected.ts64-79/billing) allows users to view plan status, manage subscriptions via the customer portal, and monitor usage balances for "Members" and "Executions" apps/cloud/src/routes/app/billing.tsx20-58createOrganization handler includes a gate that checks Autumn to enforce free-tier organization limits apps/cloud/src/api/layers.ts54-56Sources: apps/cloud/src/api/protected.ts64-79 apps/cloud/src/routes/app/billing.tsx116-161 apps/cloud/src/extensions/billing/service.ts1-20
The cloud host implements a multi-layered observability stack combining OpenTelemetry (OTel), Sentry, and Axiom.
traceparent and tracestate headers when calling Durable Objects to ensure a single logical request is captured as one trace apps/cloud/src/mcp/session-durable-object.ts116-120instrumentDurableObjectWithSentry to ensure isolate-specific errors are reported correctly apps/cloud/src/server.ts32-60/v1/traces endpoint that proxies browser-side OTLP spans to Axiom, avoiding CORS issues and centralizing auth tokens apps/cloud/src/server.ts113-118Sources: apps/cloud/src/server.ts32-109 apps/cloud/src/mcp/session-durable-object.ts116-142 apps/cloud/src/observability/telemetry.ts1-50
Refresh this wiki