Skip to content

Enable WebMCP by default and merge feature-list flags - #348

Open
rgarcia wants to merge 2 commits into
mainfrom
hypeship/enable-webmcp-flag
Open

Enable WebMCP by default and merge feature-list flags#348
rgarcia wants to merge 2 commits into
mainfrom
hypeship/enable-webmcp-flag

Conversation

@rgarcia

@rgarciargarcia commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Enables WebMCP (Chromium's navigator.modelContext API plus its CDP domain) in default browser launch flags, and makes flag merging feature-list-aware so per-session flags can't silently drop image defaults.

Feature strings

Verified against the Chromium 151 sources: chrome://flags/#enable-webmcp-testing maps to base feature WebMCPTesting (disabled by default; implies the runtime WebMCP feature in the renderer), and devtools-webmcp-support maps to DevToolsWebMCPSupport, which gates registration of the CDP WebMCP domain handler. Browser-side use also requires the Tools permissions policy (EnableForSelf, depends on WebMCP), which top-level pages get by default.

On Chromium 151+, --enable-features=WebMCPTesting,DevToolsWebMCPSupport turns on both the JS API and the WebMCP CDP domain.

What changed

  • Headless default flags (server/cmd/wrapper/chromium.go) and headful defaults (images/chromium-headful/run-{unikernel,docker}.sh): add --enable-features=WebMCPTesting,DevToolsWebMCPSupport.
  • chromiumflags.MergeFlags: union --enable-features / --disable-features CSV values across base and runtime sources into single tokens. Chromium keeps only one value per switch, so previously a session-supplied --enable-features=X would have silently dropped the image's entire default list (or vice versa). A feature present in both lists resolves to disabled inside Chromium, so sessions can still opt out with --disable-features=WebMCPTesting.
  • chromiumflags.TranslateKernelDisableFeatures: folds a kernel-namespaced --kernel-disable-features= token into the single --disable-features switch at flag-assembly time (both in the launcher and before /chromium/flags is written). Chromium ignores unknown switches, so on images predating translation the token is inert — an opt-out degrades to a no-op instead of last-win clobbering boot-time disable lists.

Tradeoffs

  • Fingerprint: enabling by default exposes navigator.modelContext to pages, which stock Chrome 151 does not show without an origin trial or experimental-web-platform-features. Sites can detect that surface as a deviation. Callers that need stock-matching behavior can pass --disable-features=WebMCPTesting,DevToolsWebMCPSupport (or the kernel-namespaced token) through existing flag mechanisms; the control plane does this for stealth sessions.

Testing

  • go test ./lib/chromiumflags/ — extended table tests for feature-list merging (union across sources, opt-out via disable list, coexistence) and for kernel-token translation (fold into existing list, create list when absent, idempotency). All pass.
  • go build ./... and full go test ./... run; remaining failures (display/OTLP/extension e2e tests requiring a running Chromium/X environment) fail identically on main.

Chromium 151 ships WebMCP (navigator.modelContext plus the CDP WebMCP
domain). Enable it in default launch flags for headless and headful
images via --enable-features=WebMCPTesting,DevToolsWebMCPSupport.
MergeFlags now unions --enable-features / --disable-features values
across base and runtime flag sources into single tokens. Chromium keeps
only one value per switch, so without merging, a session-supplied
--enable-features would silently drop the image defaults (or vice
versa); --disable-features still wins per feature for opt-out.
Add --kernel-disable-features for per-session feature disabling. The
launcher folds it into the single --disable-features switch after
merging base and runtime flags; the in-image API also translates
before writing /chromium/flags so stored files only contain switches
Chromium understands.
On images predating translation, Chromium ignores the unknown switch,
so an opt-out degrades to a no-op instead of last-win clobbering
boot-time disable lists.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@rgarcia