
Cloudflare reports that in the past 30 days, 93% of its R&D organization used AI coding tools running on infrastructure the company built on its own platform. The effort began eleven months earlier, when a cross-company tiger team called iMARS (Internal MCP Agent/Server Rollout Squad) set out to build the internal MCP servers, access layer, and AI tooling needed to make agents useful. The work ultimately landed with the Dev Productivity team, which already owns much of Cloudflare's internal tooling, including CI/CD, build systems, and automation.
Usage over that 30-day window, as published by the company:
- 3,683 internal users actively using AI coding tools (60% company-wide, 93% across R&D), out of approximately 6,100 total employees
- 47.95 million AI requests
- 295 teams currently using agentic AI tools and coding assistants
- 20.18 million AI Gateway requests per month
- 241.37 billion tokens routed through AI Gateway
- 51.83 billion tokens processed on Workers AI
The developer-velocity impact shows up in merge requests: the 4-week rolling average climbed from ~5,600/week to over 8,700, and the week of March 23 hit 10,952, nearly double the Q4 baseline. MCP servers were only the starting point; the team found it also had to rethink how standards are codified, how code gets reviewed, how engineers onboard, and how changes propagate across thousands of repos.
Architecture overview
At the top sit the engineer-facing tools: OpenCode, Windsurf, and other MCP-compatible clients, both open-source and third-party.

Every layer maps to a Cloudflare product or tool in use:
What we built | Built with |
|---|---|
Zero Trust authentication | Cloudflare Access |
Centralized LLM routing, cost tracking, BYOK, and Zero Data Retention controls | AI Gateway |
On-platform inference with open-weight models | Workers AI |
MCP Server Portal with single OAuth | Workers + Access |
AI Code Reviewer CI integration | Workers + AI Gateway |
Sandboxed execution for agent-generated code (Code Mode) | Dynamic Workers |
Stateful, long-running agent sessions | Agents SDK (McpAgent, Durable Objects) |
Isolated environments for cloning, building, and testing | Sandbox SDK — GA as of Agents Week |
Durable multi-step workflows | Workflows — scaled 10x during Agents Week |
16K+ entity knowledge graph | Backstage (OSS) |
Apart from Backstage, none of this is internal-only infrastructure — all of it is a shipping product, and many received substantial updates during Agents Week. The stack breaks into three parts: the platform layer (authentication, routing, and inference via AI Gateway, Workers AI, MCP Portal, and Code Mode), the knowledge layer (how agents understand the systems, via Backstage and AGENTS.md), and the enforcement layer (AI Code Reviewer and Engineering Codex).
Platform layer
Secure access and routing with AI Gateway
Supporting more than 3,600 daily internal users across many clients, use cases, and roles requires solving for access and visibility. Authentication and zero-trust policy enforcement are handled by Cloudflare Access; once authenticated, every LLM request routes through AI Gateway, giving a single point for managing provider keys, cost tracking, and data retention policies.

The OpenCode AI Gateway overview: 688.46k requests per day, 10.57B tokens per day, routing to four providers through one endpoint.
AI Gateway analytics show how monthly usage is distributed across model providers; over the last month, internal request volume broke down as follows.
Provider | Requests/month | Share |
|---|---|---|
Frontier Labs (OpenAI, Anthropic, Google) | 13.38M | 91.16% |
Workers AI | 1.3M | 8.84% |
Frontier models currently handle the bulk of complex agentic coding work, but Workers AI already accounts for a meaningful share and is taking on more agentic engineering workloads.
Workers AI in the mix
Workers AI is Cloudflare's serverless inference platform, running open-source models on GPUs across its global network. Beyond major cost savings versus frontier models, inference stays on the same network as Workers, Durable Objects, and storage — no cross-cloud hops, so less latency, less network flakiness, and no extra networking configuration.

Workers AI usage in the last month: 51.47B input tokens, 361.12M output tokens.
Kimi K2.5, launched on Workers AI in March 2026, is a frontier-scale open-source model with a 256k context window, tool calling, and structured outputs. Cloudflare's security agent processes over 7 billion tokens per day on Kimi; the company estimates that would cost about $2.4M per year on a mid-tier proprietary model, while Workers AI is 77% cheaper. Workers AI is also used for documentation review in the CI pipeline, for generating AGENTS.md context files across thousands of repositories, and for lightweight inference where same-network latency matters more than peak model capability.
One early decision paid off: routing everything through a single proxy Worker from day one. Connecting clients directly to AI Gateway would have been simpler initially, but the central Worker allowed per-user attribution, model catalog management, and permission enforcement to be added later without touching client configs. The proxy pattern provides a control plane that direct connections lack, and future coding assistant tools can be handled by the same Worker and discovery endpoint.
Configuration in a single command
The whole setup begins with one command:
opencode auth login https://opencode.internal.domain
That command drives a chain that configures providers, models, MCP servers, agents, commands, and permissions without the user editing a config file.

Step 1: Discover auth requirements. OpenCode fetches its config from a URL like https://opencode.internal.domain/.well-known/opencode. The discovery endpoint, served by a Worker, returns an auth block describing how to authenticate plus a config block with providers, MCP servers, agents, commands, and default permissions:
{
"auth": {
"command": ["cloudflared", "access", "login", "..."],
"env": "TOKEN"
},
"config": {
"provider": { "..." },
"mcp": { "..." },
"agent": { "..." },
"command": { "..." },
"permission": { "..." }
}
}
Step 2: Authenticate via Cloudflare Access. The user authenticates through the same SSO used for everything else at Cloudflare; cloudflared returns a signed JWT, which OpenCode stores locally and attaches to every subsequent provider request.
Step 3: Merge config. The fetched config provides organization-wide shared defaults, but local configs take priority, so users can override the default model, add agents, or adjust project- and user-scoped permissions without affecting anyone else.
Inside the proxy Worker — a simple Hono app — three responsibilities:
- Serve the shared config. Compiled at deploy time from structured source files, it carries placeholders like {baseURL} for the Worker's origin, replaced at request time so provider requests route through the Worker rather than directly to model providers. Each provider gets a path prefix (
/anthropic, /openai, /google-ai-studio/v1beta, /compatfor Workers AI) that the Worker forwards to the matching AI Gateway route. - Proxy requests to AI Gateway. For a request like
POST /anthropic/v1/messages, the Worker validates the Cloudflare Access JWT, then rewrites headers before forwarding:
Stripped: authorization, cf-access-token, host
Added: cf-aig-authorization: Bearer <API_KEY>
cf-aig-metadata: {"userId": "<anonymous-uuid>"}
- AI Gateway routes the request to the appropriate provider and the response passes straight through with zero buffering. The
apiKeyfield in the client config is empty because the Worker injects the real key server-side, so no API keys exist on user machines. - Keep the model catalog fresh. An hourly cron fetches the current OpenAI model list from
models.dev, caches it in Workers KV, and injectsstore: falseon every model for Zero Data Retention, so new models get ZDR without a config redeploy.
Anonymous user tracking. After JWT validation, the Worker maps the user's email to a UUID, using D1 for persistent storage and KV as a read cache. AI Gateway sees only the anonymous UUID in cf-aig-metadata, never the email — enabling per-user cost tracking and analytics without exposing identities to model providers or Gateway logs.
Config-as-code. Agents and commands are authored as markdown files with YAML frontmatter; a build script compiles them into a single JSON config validated against the OpenCode JSON schema, and every new session picks up the latest version automatically.
Users run one command and are done — nothing to configure manually, no API keys on laptops, no MCP server connections to set up by hand. Pushing changes to the agentic tools used by 3,000+ people is just a wrangler deploy away.
The MCP Server Portal: one OAuth for many tools
Cloudflare detailed its broader enterprise MCP governance approach — MCP Server Portals, Cloudflare Access, and Code Mode — in a separate post. Internally, the portal aggregates 13 production MCP servers exposing 182+ tools across Backstage, GitLab, Jira, Sentry, Elasticsearch, Prometheus, Google Workspace, an internal Release Manager, and more: one endpoint and one Cloudflare Access flow governing access to every tool.

Each MCP server shares the same foundation: McpAgent from the Agents SDK, workers-oauth-provider for OAuth, and Cloudflare Access for identity. Everything lives in a single monorepo with shared auth infrastructure, Bazel builds, CI/CD pipelines, and catalog-info.yaml for Backstage registration, so adding a server is mostly copying an existing one and changing the wrapped API.
Code Mode at the portal
MCP is the right protocol for connecting agents to tools, but every tool definition consumes context window tokens before the model starts working, and the overhead grows with the number of servers and tools. Code Mode addresses this: instead of loading every tool schema up front, the model discovers and calls tools through code.
The GitLab MCP server originally exposed 34 individual tools (get_merge_request, list_pipelines, get_file_content, and so on). Those 34 schemas consumed roughly 15,000 tokens of context per request — on a 200K context window, 7.5% of the budget gone before asking a question, multiplied across every request, engineer, and day. MCP Server Portals now support Code Mode proxying, solving this centrally: instead of exposing every upstream tool definition to the client, the portal collapses them into two portal-level tools, portal_codemode_search and portal_codemode_execute.

Doing this at the portal layer scales cleanly. Without Code Mode, each new MCP server adds schema overhead to every request; with portal-level Code Mode, the client still sees only two tools however many servers sit behind the portal — less context bloat, lower token cost, and a cleaner architecture.
Once MCP servers existed, their usefulness hinged on a deeper problem: agents needed structured knowledge about the surrounding system, not just the code in front of them. Ownership, service dependencies, documentation locations and database links all live outside any single repository.
Grounding agents in the service catalog
The organization runs Backstage, the open-source internal developer portal originally built by Spotify, self-hosted and used as the service catalog. It tracks:
- 2,055 services, 167 libraries, and 122 packages
- 228 APIs with schema definitions
- 544 systems (products) across 45 domains
- 1,302 databases, 277 ClickHouse tables, 173 clusters
- 375 teams and 6,389 users with ownership mappings
- Dependency graphs connecting services to the databases, Kafka topics, and cloud resources they rely on
A Backstage MCP server with 13 tools, published through the MCP Portal, lets an agent look up a service's owner, inspect its dependencies, find related API specs and pull Tech Insights scores without leaving the coding session. Without that data, an agent reads the file in front of it and stays blind to the system around it; the catalog turns separate repos into a connected map of the engineering organization.
Repo-level context with AGENTS.md
The recurring early failure was an agent producing a plausible change that was still wrong for the repo — it lacked local knowledge: the right test command, current team conventions, off-limits sections. AGENTS.md addresses this: a short, structured file committed to each repo that states how the codebase actually works and forces the team to make that context explicit.
A typical file looks like this:
# AGENTS.md
## Repository
- Runtime: cloudflare workers
- Test command: `pnpm test`
- Lint command: `pnpm lint`
## How to navigate this codebase
- All cloudflare workers are in src/workers/, one file per worker
- MCP server definitions are in src/mcp/, each tool in a separate file
- Tests mirror source: src/foo.ts -> tests/foo.test.ts
## Conventions
- Testing: use Vitest with `@cloudflare/vitest-pool-workers` (Codex: RFC 021, RFC 042)
- API patterns: Follow internal REST conventions (Codex: API-REST-01)
## Boundaries
- Do not edit generated files in `gen/`
- Do not introduce new background jobs without updating `config/`
## Dependencies
- Depends on: auth-service, config-service
- Depended on by: api-gateway, dashboard
The generator pipeline draws entity metadata from Backstage (ownership, dependencies, system relationships), analyzes repository structure to detect language, build system, test framework and directory layout, then maps the detected stack to the relevant Engineering Codex standards. A model generates the document and a merge request is opened so the owning team can review it. Roughly 3,900 repositories were handled this way; the first pass was imperfect for polyglot repos and unusual build setups, but even that baseline beat inferring everything from scratch.
Because these files sit in the context window, they must stay short and high-signal — and a stale file is worse than none. The AI Code Reviewer closes that loop by flagging repository changes that suggest AGENTS.md needs an update.
Review and enforcement
How the AI Code Reviewer runs
GitLab's self-hosted CI/CD is the delivery platform, and the reviewer is a GitLab CI component teams add to their pipeline; every MR is then reviewed automatically. When an MR is opened or updated, the job runs OpenCode with a multi-agent review coordinator, which classifies risk (trivial, lite, or full) and delegates to specialized agents for code quality, security, codex compliance, documentation, performance and release impact. Each agent connects to the AI Gateway for models, pulls Codex rules from a central repo and reads the repo's AGENTS.md. Findings return as structured MR comments. A separate Workers-based config service sets model selection per reviewer agent, so models can change without touching the CI template; reviews themselves run statelessly in the CI runner.
Format and iteration

Output is grouped by category (Security, Code Quality, Performance) so engineers scan headers instead of walls of text, and each finding carries a severity — Critical, Important, Suggestion, or Optional Nits. The reviewer holds context across rounds: a previously flagged issue that has since been fixed is acknowledged rather than re-raised, and a finding tied to a Codex rule cites the rule ID, turning a suggestion into a pointer to an organizational standard.
Workers AI serves about 15% of reviewer traffic, mainly documentation review, where Kimi K2.5 performs well at a fraction of frontier-model cost. Opus 4.6 and GPT 5.4 handle security-sensitive and architecturally complex reviews. Over the last 30 days: 100% coverage across all repos on the standard CI pipeline, 5.47M AI Gateway requests and 24.77B tokens processed. A separate technical post accompanies this one covering model routing, multi-agent orchestration and cost optimization.
Standards delivered as agent skills
The Engineering Codex is the internal standards system where core engineering standards live. A multi-stage AI distillation process outputs a set of rules ("If you need X, use Y. You must do X, if you are doing Y or Z.") plus an agent skill built on progressive disclosure, with nested hierarchical information directories and links across markdown files. Engineers call it locally with prompts like “how should I handle errors in my Rust service?” or “review this TypeScript code for compliance.” The Network Firewall team used a multi-agent consensus process to audit rampartd, scoring every requirement COMPLIANT, PARTIAL, or NON-COMPLIANT with violation details and remediation steps — a process that previously took weeks of manual work.

Each piece is unremarkable in isolation; the difference is the wiring. When an agent pulls context from Backstage, reads the AGENTS.md for the repo it is editing, and is reviewed against Codex rules by the same toolchain, the first draft usually comes out close to shippable — which was not true six months earlier.
Adoption and remaining gaps
From launch to 93% R&D adoption took less than a year.

Company-wide adoption (Feb 5 – April 15, 2026):
Metric | Value |
|---|---|
Active users | 3,683 (60% of the company) |
R&D team adoption | 93% |
AI messages | 47.95M |
Teams with AI activity | 295 |
OpenCode messages | 27.08M |
Windsurf messages | 434.9K |
AI Gateway (last 30 days, combined):
Metric | Value |
|---|---|
Requests | 20.18M |
Tokens | 241.37B |
Workers AI (last 30 days):
Metric | Value |
|---|---|
Input tokens | 51.47B |
Output tokens | 361.12M |
Background agents on the roadmap
The next step is background agents: spin-up-on-demand agents with the same tools available locally (MCP portal, git, test runners) running entirely in the cloud. Durable Objects and the Agents SDK handle orchestration, delegating to Sandbox containers when a job needs a full development environment — cloning a repo, installing dependencies, running tests. The Sandbox SDK went GA during Agents Week, and long-running agents shipped natively into the Agents SDK, solving the durable-session problem that previously required workarounds; sessions can now last long enough to clone a large repo, run a full suite, iterate on failures and open an MR in one go. Every layer of the eleven-month effort runs on the same products customers use.



