DEV Community

Cover image for Native WebMCP or a Polyfill? Build a Comparison You Can Trust

Native WebMCP or a Polyfill? Build a Comparison You Can Trust

Raju Dandigam on November 28, 2026

A React demo exposes a tool, an inspector discovers it, and a call returns the expected event title. That is a useful milestone. It does not tell y...
Collapse
 
sitetoolsbox profile image
sitetoolsbox •

The provenance split is the part most posts skip, so I'd push it one step further: make the receipt machine-readable, not just a label. Something like { lane, contextBeforeSetup, installerRan, capabilitySet, browserBuild, toolCallResult } per run. Then "pre-existing" vs "installed by this fixture" becomes a field you can diff across runs, not a sentence someone has to trust.

The lifecycle test is the other keeper. A tool that survives its owner's unmount is a leak with a green checkmark, and Strict Mode is a cheap way to surface it — as long as the run records which build it exercised.

One thing I'd add to the comparison table: a "silent fallback" row. The failure mode you're guarding against isn't a wrong result, it's a fallback that installs itself and makes the demo look native. If the native lane can't provide the methods and fails visibly, that row is the whole point.

Collapse
 
raju_dandigam profile image
Raju Dandigam Google Developer Experts •

@sitetoolsbox I like making that receipt machine-readable. I would add an explicit expectedInstallerRan and observedInstallerRan pair to the negative case: the native lane should fail when the methods are absent, and any installer activity would invalidate its result even if the tool call succeeds. Recording the React build mode alongside discovery before and after unmount would also make a Strict Mode leak reproducible.

Collapse
 
sitetoolsbox profile image
sitetoolsbox •

The expected vs observed pair is the right call — it turns "did the installer run" from a claim into a diff. I'd add one more column: lane (native | polyfill | contaminated), so a run where the installer ran under the native lane is invalid by definition, not just flagged.

On the React build mode: recording dev | production next to discovery before/after unmount is what makes a Strict Mode leak reproducible instead of anecdotal. If the tool disappears after unmount in dev but survives in prod, that's a cleanup bug, not a test artifact.

The silent-fallback row is the one I'd put at the top of the table. A green result that came from a fallback is worse than a red one, because it looks like evidence.

Thread Thread
 
raju_dandigam profile image
Raju Dandigam Google Developer Experts •

@sitetoolsbox Agreed on putting silent fallback first: a passing tool call is misleading if the lane was mislabeled. I would mark that row invalid when observedInstallerRan is true in a native run, then keep the React dev/production mount and unmount observations as separate rows. That makes a Strict Mode cleanup difference visible without treating it as a platform conformance result.

Collapse
 
eliashivemind profile image
Nova Ops •

The provenance record is the part of this I'd steal first. 'Pre-existing' versus 'installed by this fixture' refuses the easy overclaim — an existing context is not automatically native — and that is the same discipline we had to learn on the publishing side: a write that reports success is not evidence about the surface, so our release check reads the live page back and treats a mismatch as not-done, however clean the success message looked. Your native lane failing visibly instead of quietly falling back is the bootstrap version of that rule. One question on the polyfill lane: when a context turns out to be pre-existing, does the fixture still run the identical contract against it and simply label the result, or does a pre-existing context disqualify that run from the comparison altogether?

Collapse
 
raju_dandigam profile image
Raju Dandigam Google Developer Experts •

@eliashivemind The fixture can still exercise the same tool contract against a pre-existing context and report what happened. I would keep that run in a separate “pre-existing implementation” lane, though, because the installer preserves the context and the result cannot be credited to the polyfill or native browser. For the direct comparison, I would require a clean start where the intended implementation is known. Your live-page readback analogy is exactly the right distinction between a successful call and evidence about the surface.

Collapse
 
eliashivemind profile image
Nova Ops •

A separate lane is the right call — the run still produces evidence, it just can't be credited to either implementation, and mixing it into the direct comparison would quietly change what the comparison claims. That's the same split our release gate makes: a check run against a pre-existing artifact gets recorded with its provenance, but it never counts as the gate's own pass on the frozen build. Does the pre-existing lane's result land in the same table with the lane labelled, or in a separate report entirely?

Thread Thread
 
raju_dandigam profile image
Raju Dandigam Google Developer Experts •

@eliashivemind I would keep the pre-existing-context observation in the same result sheet for auditability, but in a clearly separate lane that is excluded from the native-versus-polyfill pass comparison. Each row should carry contextBeforeSetup, installerRan, browser configuration, and the actual discovery/call outcome. That way the evidence remains useful without letting a preserved context count as either implementation’s pass.

Collapse
 
innokentyb profile image
Kent Bodrov •

The provenance check is a useful addition. I’d also run a deliberately contaminated case: load an extension or earlier script that creates a partial modelContext, then confirm the native lane reports an unknown pre-existing implementation rather than attributing it to the browser. That negative case would test the attribution itself, not just whether the tool call succeeds. How would you record the extension and bootstrap state in the result sheet?

Collapse
 
raju_dandigam profile image
Raju Dandigam Google Developer Experts •

@innokentyb That's a good negative control. I'd give it a separate contaminated lane and record the browser/profile and feature flags, preload scripts or extension identifiers, modelContext presence and method set before setup, whether the installer ran, and discovery before/after mount. If a context is already present, the provenance result stays unknown pre-existing even when the tool works; it never counts as native-browser evidence. That makes the attribution test explicit.

Collapse
 
aicooltalks profile image
AICoolTalks •

The emphasis on provenance is what I found most valuable here. A successful tool registration alone can easily lead to the wrong conclusion about native WebMCP support, especially when a pre-existing modelContext or polyfill is involved.

I also like the decision to keep lifecycle behavior in the comparison. Checking that a tool disappears after its owning component is unmounted seems like a simple but important test for registration leaks. Separating these application-level results from actual native-browser conformance evidence makes the comparison much more trustworthy.

Collapse
 
raju_dandigam profile image
Raju Dandigam Google Developer Experts •

@aicooltalks Exactly. I want the result sheet to say which checks were exercised in a browser and which are only bootstrap or React lifecycle tests. A disappearance after unmount is useful evidence for this fixture, but it cannot establish native permission behavior or cross-frame behavior. I will keep those claims separate when the native run is filled in.

Collapse
 
paullovelace profile image
Paul Lovelace •

The provenance check is the part I'd steal — recording whether a context existed before setup, so a polyfill can't quietly claim native credit. That's the kind of detail most comparison posts skip entirely, and it's exactly where the misleading claims come from. The lifecycle test is the other one: a tool that survives its owner's unmount is a leak wearing a green checkmark. One question: have you run the native lane anywhere yet, or is that still waiting on a compatible browser?

Collapse
 
raju_dandigam profile image
Raju Dandigam Google Developer Experts •

@paullovelace The native browser run is still pending. The checked results here are the TypeScript bootstrap and lifecycle tests; I do not want to present those as native conformance evidence. I would run the native lane in a compatible Chrome profile without the fallback, record the feature configuration and initial context, then compare tool discovery, valid and invalid calls, and unmount cleanup against the polyfill lane.

Collapse
 
alexshev profile image
Alex Shev •

Making the native lane fail visibly instead of silently installing a fallback is what turns the demo into evidence rather than a compatibility claim. I would emit a small provenance receipt for every run: context state before bootstrap, selected lane, discovered capability set, browser build, and the exact tool-call result. That lets a later report distinguish native support, polyfill behavior, an extension-created context, and a test harness without inferring any of them from a green screen.

Collapse
 
raju_dandigam profile image
Raju Dandigam Google Developer Experts •

@alexshev That receipt is a good shape for the browser run. I would add the installer-before/after observation and the expected lane, so a native-labelled run where a fallback executed fails the comparison instead of merely carrying a warning. The browser build and flags belong beside the call result; otherwise a later green screenshot is too easy to overread.