Understand the testing lanes
The monorepo provides several testing lanes organized by runtime:
Every canonical E2E suite proves the same six assertions against the real runtime:
- Initial discovery returns the expected tools
- A successful call returns the expected payload
- The runtime records the invocation
- Dynamic registration becomes discoverable without restart
- Unregistration removes the tool and later calls fail
- Runtime-thrown tool errors propagate to the caller
Run the canonical polyfill tests
The polyfill tests use Playwright with a real browser. They exercise@mcp-b/global running in a page, discovered and called through the SDK Client and TabClientTransport.
e2e/runtime-contract/ which registers a deterministic tool set: echo, sum, dynamic_tool, and always_fail.
Run the native Chromium tests
Native Chromium tests use the browser’s built-indocument.modelContext and navigator.modelContextTesting APIs directly. This is the one exception to the SDK-client pattern: the browser API itself is the public boundary.
Default Chromium
Chrome 152+ with WebMCP flags
1
Install Chrome 152 or newer
Use Chrome Canary, Dev, Beta, or Stable at major version 152 or newer. If Playwright cannot find it automatically, set
CHROME_BIN to the executable path.2
Run the flagged native contract lane
--enable-experimental-web-platform-features--enable-features=WebMCPTesting,DevToolsWebMCPSupport
Detect native vs. polyfill in your own code
If you need runtime detection (for conditional test paths or feature flags):Configure Playwright for native testing
To launch Chromium with the native API enabled in your own Playwright tests:--headless=new, --disable-gpu, and --no-sandbox:
Run integration and framework tests
Beyond the canonical contract lanes, the monorepo has additional integration suites:Debug failing tests
Troubleshoot common issues
Choose the right testing approach
Related pages
- Browser Support and Flags for the full Chromium flag reference
- Choose a runtime for why these runtimes differ
- Debug and Troubleshoot for general debugging strategies
