Skip to content

Cloud Relay

Cloud Relay connects cloud-hosted AI agents (Claude.ai, ChatGPT, and others) to your local Oak CI daemon through a secure WebSocket relay running on Cloudflare Workers. Your codebase never leaves your machine — only MCP tool calls and their results travel through the relay.

Oak CI’s MCP tools are powerful, but they run on your local machine. Cloud-based AI agents like Claude.ai and ChatGPT can’t reach localhost. Traditional solutions — public tunnels, VPNs, port forwarding — are complex, fragile, and introduce security risks.

Cloud Relay solves this with a lightweight Cloudflare Worker that acts as a secure bridge: cloud agents send MCP requests to the Worker, and the Worker relays them to your local daemon over a persistent WebSocket connection.

The key insight is that your local daemon initiates the connection outward — no inbound ports, no firewall rules, no dynamic DNS. The Cloudflare Worker simply relays messages between the two sides.

ComponentRoleRuns On
Cloudflare WorkerAccepts MCP requests from cloud agents, relays to local daemonCloudflare’s edge network (your account)
Durable ObjectManages WebSocket state and message routingCloudflare (co-located with Worker)
WebSocket ClientMaintains persistent outbound connection to WorkerYour local machine (inside Oak CI daemon)

Cloud Relay uses a turnkey deployment model — a single command (or button click) handles the entire pipeline:

  1. Scaffolds a Cloudflare Worker project in oak/cloud-relay/
  2. Installs npm dependencies
  3. Verifies Cloudflare authentication
  4. Deploys the Worker via wrangler
  5. Connects the local daemon over WebSocket

Subsequent runs skip already-completed phases. For example, if the Worker is already deployed, clicking “Start Relay” simply reconnects the WebSocket.

Each project gets its own Worker deployment. This keeps tokens, state, and billing isolated per-project. A typical developer workflow:

  1. Deploy one Worker per project you want to expose
  2. Each Worker has its own pair of authentication tokens
  3. Each local daemon connects to its project’s Worker

Cloud Relay exposes all MCP tools registered with your local Oak CI daemon. This includes:

  • Code search — Semantic and keyword search across your codebase
  • Memory — Project observations, gotchas, decisions, and learnings
  • Context — Task-relevant context aggregation
  • Activity history — Session and activity browsing

The relay does not expose the full Oak CI web dashboard or direct filesystem access. Cloud agents interact exclusively through the structured MCP tool protocol.

Cloud RelayTraditional Tunnel
ExposesMCP tools onlyFull UI and all endpoints
DirectionOutbound WebSocket (no inbound ports)Inbound connection (requires port/DNS)
AuthTwo-token model (relay + agent)Varies (often IP-based or basic auth)
InfrastructureCloudflare Workers (serverless)Tunnel service (ngrok, Cloudflare Tunnel, etc.)
CostFree tier is sufficientVaries by provider
Use caseCloud AI agents calling MCP toolsSharing full dashboard with remote users

Cloud Relay runs entirely within Cloudflare’s free tier for typical developer usage:

ResourceFree Tier LimitTypical Usage
Worker requests100,000/day~500-2,000/day
Worker CPU time10ms/request~2-5ms/request
Durable Object requests100,000/day~500-2,000/day
Durable Object storage1 GB< 1 KB
WebSocket messagesUnlimited~1,000-5,000/day
Egress bandwidthFreeAll

No credit card is required. The free tier comfortably handles a single developer’s workload with significant headroom.

Before setting up Cloud Relay, you need:

  • Oak CI installed and running (oak ci start)
  • Cloudflare account (free) — see Cloudflare Setup
  • Node.js (v18+) for npm and the wrangler CLI
  • A cloud AI agent that supports MCP Streamable HTTP (Claude.ai, ChatGPT, etc.)
  1. Cloudflare Setup — Create your free account and install wrangler
  2. Getting Started — Deploy your first relay in one command
  3. Cloud Agents — Register cloud AI agents with your relay
  4. Authentication — Understand the two-token security model