# EdgeBalancer — Full Agent & MCP Reference > Control plane for deploying Cloudflare Worker load balancers and API gateways without writing Worker code. Bring your Cloudflare account, pick origins and strategy, we deploy the Worker directly to your account across 330+ PoPs. ## Architecture Summary Internet -> Cloudflare Edge (330+ PoPs) -> Worker (in user's Cloudflare account) -> Origins. EdgeBalancer is strictly the control plane and never proxies production traffic. Updates use Cloudflare Worker Versions + Deployments with Redis create locks (`lb:create:{accountId}:{scriptName}`), automatic rollback on failure, and immutable Session snapshots. --- ## MCP Server (`https://apiedge.nexoral.in/mcp`) ### Transport & OAuth 2.0 + PKCE Discovery - Transport: Streamable HTTP at `https://apiedge.nexoral.in/mcp` - Protected Resource Metadata: `GET /.well-known/oauth-protected-resource` - Authorization Server Metadata: `GET /.well-known/oauth-authorization-server` - Dynamic Client Registration: `POST /mcp/auth/register` - Authorization Endpoint (PKCE): `GET /mcp/auth/authorize` - Token Exchange: `POST /mcp/auth/token` - Scopes: `mcp:read` (14 read-only tools), `mcp:write` (11 mutating tools) ### Client Setup Commands & Configs - **Claude Code**: `claude mcp add edgebalancer --transport http https://apiedge.nexoral.in/mcp` - **Codex**: `codex mcp add edgebalancer --url https://apiedge.nexoral.in/mcp` then `codex mcp login edgebalancer` - **Kiro CLI**: `kiro-cli mcp add --name edgebalancer --url https://apiedge.nexoral.in/mcp` - **Cursor**: `{ "mcpServers": { "edgebalancer": { "url": "https://apiedge.nexoral.in/mcp" } } }` - **OpenCode**: `{ "mcp": { "edgebalancer": { "type": "http", "url": "https://apiedge.nexoral.in/mcp" } } }` - **Antigravity (AGY)**: `{ "mcpServers": { "edgebalancer": { "serverUrl": "https://apiedge.nexoral.in/mcp" } } }` - **Cline**: `{ "mcpServers": { "edgebalancer": { "type": "streamableHttp", "url": "https://apiedge.nexoral.in/mcp" } } }` ### All 25 MCP Tools **`mcp:read` (14 tools)** - Traffic Balancers: `list_load_balancers`, `get_load_balancer`, `get_origin_ip` (resolves raw IPv4 behind auto-created DNS A-record) - Edge Gateways: `list_gateways`, `get_gateway` - Diagnostics & Health: `get_analytics`, `get_health_status` - Account, Sessions & Billing: `get_current_plan`, `list_sessions`, `get_session_script` (requires `sessionId` from `list_sessions`), `list_payments` - Cloudflare Zones, Preflight & Docs: `list_zones`, `validate_hostname`, `search_knowledge_base` **`mcp:write` (11 tools)** - Traffic Balancers: `create_load_balancer`, `update_load_balancer`, `delete_load_balancer`, `pause_load_balancer`, `resume_load_balancer` - Diagnostics: `restart_origin_health` - Edge Gateways: `create_gateway`, `update_gateway`, `delete_gateway`, `pause_gateway`, `resume_gateway` ### Required Agent / MCP Operating Pattern Any AI agent or MCP client operating EdgeBalancer should follow these exact patterns: 1. **Documentation & Troubleshooting (`search_knowledge_base`)**: - Call `search_knowledge_base` for any EdgeBalancer question (architecture, features, 7 routing strategies, MCP client setup, plan quotas, security, or error codes like 409/403/504/524). 2. **Never Guess State or Required Fields**: - Never claim a load balancer or gateway exists/doesn't exist without calling `list_load_balancers` / `list_gateways` first. - Required fields for Load Balancer creation: (1) `name` (3-50 chars, lowercase `[a-z0-9-]`, locked after creation), (2) `domain` (from `list_zones` — apex or subdomain), (3) `origins` (`http://` or `https://` URLs; weights default to `1`), (4) `strategy` (`round-robin`, `weighted-round-robin`, `ip-hash`, `cookie-sticky`, `weighted-cookie-sticky`, `failover`, `geo-steering`). - Required fields for Gateway creation: (1) `name` (3-50 chars, `[a-z0-9-]`), (2) `domain`, (3) `upstreams` (`http://` or `https://` URLs; weights default to `1`). - Use `validate_hostname` before creation if hostname availability is uncertain. 3. **Destructive Confirmation Before Mutation**: - Before calling `update_*`, `delete_*`, `pause_*`, `resume_*`, or `restart_origin_health`: resolve IDs/names via `list_*` first and obtain explicit user confirmation (for `pause_*`, specify mode: `keep-domain` for 503 maintenance or `release-domain` to detach hostname). 4. **Update Merge Rule**: - `update_load_balancer` and `update_gateway` require the **full merged configuration** (`id`, `domain`, `zoneId`, `origins`/`strategy` or `upstreams`), not a partial patch — fetch current state via `get_*` / `list_*` first. 5. **409 Conflict Rule**: - If `409 Conflict` is returned (name or hostname already taken), stop immediately and report it. Never auto-rename or append suffixes. 6. **Session Script Inspection**: - Call `list_sessions` first to obtain the `sessionId`, then call `get_session_script`. --- ## In-App Edge Ai (`POST /api/ai/generate`) - Available on **Pro** (`₹299/mo` or `₹2,870/yr`), rate limit **30 requests per 15 minutes**. - Streams live SSE progress events using **30 tools** (`find_tools` + 25 domain tools + `compact_chat` + `count_tokens` + RCA-only `web_search` / `fetch_url`). - 4-provider failover ladder: OpenRouter -> Google Gemini -> NVIDIA NIM -> Groq, with Redis cooldowns and automatic history compaction above 4,000 non-system tokens. - Automatically enters read-only Root Cause Analysis (RCA) if a tool fails. --- ## REST API Overview (`https://apiedge.nexoral.in/api`) Authentication: Firebase OAuth (Google or GitHub) -> `POST /api/auth/google` -> httpOnly `SameSite=Strict` 24h JWT cookie (plus TOTP / WebAuthn Passkey 2FA when enabled). Mutating `POST`/`PUT` routes support `Idempotency-Key`. - **Load Balancers & Health**: `GET/POST /api/loadbalancers`, `GET/PUT/DELETE /api/loadbalancers/:id`, `POST /api/loadbalancers/validate-hostname`, `POST /api/loadbalancers/:id/pause`, `POST /api/loadbalancers/:id/resume`, `POST /api/loadbalancers/:id/health-check/restart` - **API Gateways**: `GET/POST /api/gateways`, `GET/PUT/DELETE /api/gateways/:id`, `POST /api/gateways/:id/pause`, `POST /api/gateways/:id/resume` - **Sessions**: `GET /api/sessions`, `GET /api/sessions/:id/script` - **Edge Ai**: `POST /api/ai/generate`, `GET /api/ai/runs`, `GET /api/ai/runs/:id` - **Auth & 2FA**: `POST /api/auth/google`, `POST /api/auth/logout`, `GET /api/auth/me`, `POST /api/auth/2fa/verify`, `POST /api/auth/2fa/passkey/auth/options`, `POST /api/auth/2fa/passkey/auth/verify` - **Cloudflare**: `GET/POST/PUT /api/cloudflare/credentials`, `GET /api/cloudflare/zones` - **Public**: `GET /api/stats/public`, `GET /health` --- ## Plans & Quotas - **Free (`₹0` forever)**: 5 LBs, 2 health-check LBs, all 7 strategies, 1 Gateway (5 routes, 1 rate-limit, 3 header, 5 IP, 2 mock, 0 RBAC, 1 schema, 1 body-shaping), MCP Server access. - **Trial (`₹0`, 14 days) & Student's Support (`₹49/mo` or `₹470/yr`)**: 10 LBs, 5 health-check LBs, 3 Gateways (20 routes, 5 rate-limit, 10 header, 20 IP, 10 mock, 5 RBAC/schema/body-shaping), JWT Auth, Edge Caching, Identity Rate Limiting, Analytics, Script Download, Smart Placement. - **Pro (`₹299/mo` or `₹2,870/yr`)**: Unlimited LBs, Gateways, Health Checks & all rule quotas + Autonomous Edge Ai (30 tools), Canary, Traffic Shadowing, BFF Aggregation, Header Injection.