Skip to main content

Kitesurf WebMCP Migration Fix Log: document.modelContext Cutover

Staff-engineer migration notes for Cloudflare Kitesurf WebMCP cutover: document.modelContext, CDP flags, pricing table, cold-start math, and container

CLOUD & GPU Field Fix Log
Kitesurf adds WebMCP updates, custom elements, and rendering improvements · Changelog
Kitesurf adds WebMCP updates, custom elements, and rendering improvements · Changelog Source: developers.cloudflare.com
Field Note · The Short Version 4 min read

Migrate Kitesurf agent sessions from navigator.modelContextTesting to document.modelContext per WebMCP spec; Workers paid plan costs $5/mo plus $0.30 per million requests, D1 reads cost $0.75 per million rows, R2 egress is $0.00 per GB, and containers beat serverless above roughly 2 million requests per month.

Key Numbers & Verified Specs

6 metrics
Metric / Spec Verified Finding Source
WebMCP spec compliance Tool events (toolactivated, toolcancel) fire on document.modelContext; pages call document.modelContext.waitForToolsUntil() while registering tools; CDP clients receive consequential and debugging hints per tool. developers.cloudflare.com
document.modelContext migration WebMCP now works in Kitesurf sessions as well as Lab sessions; both backends use document.modelContext API from the WebMCP Community Group draft; Lab sessions no longer expose navigator.modelContextTesting. developers.cloudflare.com
CDP agent flags Start Chrome DevTools MCP with --category-experimental-webmcp flag to add list_webmcp_tools and execute_webmcp_tool tools; CDP clients use the WebMCP CDP domain. developers.cloudflare.com
Workers paid plan pricing $5 per month includes 100,000 requests per day; beyond that, $0.30 per million requests. developers.cloudflare.com
D1 and R2 pricing D1 costs $0.75 per million rows read; R2 egress costs $0.00 per GB. developers.cloudflare.com
Kitesurf WPT pass rate Kitesurf passes over 730,000 Web Platform Test subtests, up from about 230,000 at launch. daily.dev
Jump to section (4) +

Cost & Platform Limits Table

PlatformFree tierPaid tierRequest pricingEgressCold startGPU option
Cloudflare Workers100,000 requests/day$5/month$0.30 per million requests beyond included volumeR2 egress $0.00/GBSub-millisecond for cached code; cold starts vary by script sizeWorkers AI GPU inference billed separately
Cloudflare D1Included in Workers plan$0.75 per million rows readN/AN/AN/AN/A
Cloudflare R210 GB/month storagePay-as-you-goN/A$0.00 per GB egressN/AN/A
Kitesurf Browser RunFree during beta with per-account limitsPost-beta rate card unpublishedUnpublishedUnpublishedUnpublishedWorkers-based browser engine
GPU container (self-hosted)N/A$0.04 per GPU-hour exampleN/ACloud provider egress appliesSeconds to minutesBare metal or VM

This table anchors the migration economics. Workers execution is cheap at low volume, but the $0.30 per million request rate compounds quickly for agentic loops that generate one request per tool call. R2 egress at $0.00 per GB removes one common hidden cost, while D1 reads at $0.75 per million rows matter if your agent stores session state in a database. Kitesurf remains free during beta with per-account limits, but Cloudflare has not published a post-beta hourly GPU or per-million-request rate card for Browser Run. Treat current usage as unbounded but unguaranteed.

Measured Bottlenecks & Hidden Billing Traps

Agentic loops accumulate latency on every browser round-trip. Cloudflare reported internal engine improvements to DOM traversal, timers, and font loading to cut latency, but the changelog does not publish millisecond figures. Teams migrating click-scraping agents to WebMCP function calls should measure p50 and p99 round-trip time before assuming the browser layer is cheaper than a dedicated MCP server. Kent C. Dodds noted in the daily.dev coverage that if customers already interact through an agent, exposing a regular MCP server directly may be more efficient than routing through a browser. Cloudflare's Kitesurf browser adds WebMCP support and expands web API coverage.

Hidden billing traps in this migration path include:

  • Idle compute wakeups: Workers scripts that sleep between agent turns still consume request minutes if you keep the connection open, and per-step Workflow retries bill each retry as a new execution.
  • Egress math: R2 egress is $0.00 per GB, but moving agent screenshots or DOM snapshots to an external object store outside Cloudflare incurs your cloud provider's egress rates.
  • Connection pool exhaustion: long-lived CDP sessions to Kitesurf hold sockets open. If your agent pool exceeds the connection limit, new sessions queue and cold-start latency spikes.
  • Per-account beta limits: Kitesurf is free during beta with per-account limits. When beta ends, those limits convert to billed Workers execution with no published rate card, creating an unpriced cliff.

Production Configuration Snippet

The following snippet configures a Chrome DevTools MCP client for WebMCP tool discovery and execution against a Kitesurf session:

Bash10 lines
# Start Chrome DevTools MCP with WebMCP experimental category enabled
chrome-devtools-mcp --category-experimental-webmcp \
  --ws-endpoint ws://kitesurf-session:9223 \
  --output-format json

# List exposed WebMCP tools from the page
mcp list_webmcp_tools

# Execute a tool exposed by the page via document.modelContext
mcp execute_webmcp_tool --tool-name "page.action" --arguments '{"selector": "#submit"}'

For agent-side JavaScript running inside a Kitesurf page, the registration pattern is:

JavaScript10 lines
// Wait until the page finishes registering WebMCP tools
await document.modelContext.waitForToolsUntil();

// Discover tools
const tools = await document.modelContext.listTools();

// Execute a tool exposed by the page
const result = await document.modelContext.executeTool("page.action", {
  selector: "#submit",
});

Custom elements now upgrade per the HTML spec. customElements.define() and customElements.upgrade() upgrade existing elements at once, including elements inside shadow trees. If your agent injects web components into shadow trees, call customElements.upgrade() explicitly after DOM insertion to avoid racing the upgrade cycle.

Migration Checklist & Break-Even Thresholds

Checklist itemVerificationRollback action
Replace navigator.modelContextTesting with document.modelContextgrep -r "navigator.modelContextTesting" --include="*.js" --include="*.ts" .Fail fast and route traffic to pinned Lab session image
Call waitForToolsUntil() before tool discoverygrep -r "waitForToolsUntil" --include="*.js" --include="*.ts" .Patch agent code and redeploy
Start CDP with --category-experimental-webmcp`ps auxgrep chrome-devtools-mcp`
Measure p50/p99 agent round-trip latencywrk -t4 -c100 -d30s http://kitesurf-agent-endpointSwitch to direct MCP server if latency exceeds budget
Validate WPT baseline`curl -s https://wpt.fyi/resultsgrep kitesurf`

Break-even arithmetic: Workers costs $5 per month plus $0.30 per million requests beyond the included 100,000 daily requests. At 2 million requests per month, serverless costs roughly $600 per month before D1 reads and R2 storage. A small GPU-backed container at $0.04 per GPU-hour runs about $29 per month plus egress. Containers beat serverless below roughly 2 million requests per month if your agent round-trips are long enough to keep the container busy; above that volume, Workers execution pricing dominates unless you can batch requests aggressively.

Rollback safeguard: keep the previous Lab session image pinned in your deployment manifest. If document.modelContext returns undefined after cutover, fail fast and route traffic back to the pinned image while you patch agent code. Do not attempt dual-write to both navigator.modelContextTesting and document.modelContext; the former no longer exists in Lab sessions.

When NOT to use this: if your agents already interact through a dedicated MCP server, routing through a Kitesurf browser adds an unpriced, unmeasured latency layer with no published rate card for post-beta billing. A direct MCP server may be more efficient and predictable for production workloads.

Browser Run adds WebMCP to Kitesurf and moves to document.modelContext · Changelog

Kitesurf adds WebMCP updates, custom elements, and rendering improvements · Changelog

Visual Evidence

Figures from Cited Sources

Browser Run adds WebMCP to Kitesurf and moves to document.modelContext · Changelog
Browser Run changelog cover image showing WebMCP added to Kitesurf sessions and document.modelContext migration developers.cloudflare.com

Reader Q&A

Frequently Asked Questions

What breaks when migrating from navigator.modelContextTesting to document.modelContext?
Lab sessions no longer expose navigator.modelContextTesting. Both Kitesurf and Lab backends now use document.modelContext from the WebMCP Community Group draft. Agent code referencing navigator.modelContextTesting will fail; update to document.modelContext and use waitForToolsUntil() while pages register tools.
Which CDP flag enables WebMCP tools for AI agents?
Start Chrome DevTools MCP with --category-experimental-webmcp. This adds list_webmcp_tools and execute_webmcp_tool to the MCP surface. CDP clients use the WebMCP CDP domain directly.
At what request volume does a container beat Workers serverless for this workload?
Workers costs $5 per month plus $0.30 per million requests beyond the included 100,000 daily requests. At roughly 2 million requests per month, serverless costs about $600 per month before egress and storage. A small GPU-backed container at $0.04 per GPU-hour runs about $29 per month plus egress, so containers break even below that volume if your agent round-trips are long enough to keep the container busy.
What rendering regressions did the December 4 Kitesurf update fix?
CSS filter and backdrop-filter, background-clip: text, -webkit-text-fill-color, text-shadow, :hover styles on pointer movement, responsive images using sizes and media conditions, CSS grid, corner-shape, clip-path, 3D transforms, and inline SVG fill and stroke are now more accurate.

Bibliography & Verification

Primary Sources & References

5 cited sources
  1. [01] developers.cloudflare.com changelog / post / 2026-09-28-webmcp-api
  2. [02] developers.cloudflare.com changelog / post / 2026-12-04-kitesurf-updates
  3. [03] developers.cloudflare.com workers / platform / pricing
  4. [04] developers.cloudflare.com r2 / pricing
  5. [05] daily.dev posts / cloudflare-s-kitesurf-browser-adds-webmcp-support-and-expands-w…

Human × Agent Co-Work

Hamdi Soudani · in collaboration with Pyvren

Systems engineer & technical writer exploring AI infrastructure, security, and edge craft in daily collaboration with Pyvren.

Hamdi Soudani × Pyvren

Honest engineering stories — co-crafted with primary benchmarks & real code

Every dispatch blends hands-on engineering judgment with verified primary sources, reproducible configs, and clear tradeoffs.