Inspect registered tools
Open the browser console and check whethernavigator.modelContext is available:
"object", the runtime is loaded. List registered tools:
Execute a tool manually
Call any registered tool from the console to verify it works in isolation:execute function, not in the transport or agent connection.
Use Chrome DevTools MCP for debugging
@mcp-b/chrome-devtools-mcp includes a built-in debug-webmcp prompt that diagnoses connection and registration issues. See Use Chrome DevTools MCP for setup.
Once configured, ask your MCP client:
@mcp-b/global is loaded, list discovered tools, and report any connection failures.
Use the Model Context Tool Inspector
The Chrome team publishes a Model Context Tool Inspector extension. Install it from the Chrome Web Store, then open its side panel on any page to see registered tools and execute them with JSON input.The inspector requires the experimental
navigator.modelContextTesting API. Enable “WebMCP for testing” in chrome://flags on Chrome 146.0.7672.0 or higher.Detect native vs. polyfill
Determine which implementation is active:Common failures
navigator.modelContext is undefined
The polyfill has not loaded, or it loaded after your code ran.
Verify the import exists
Confirm your entry point includes
import '@mcp-b/global' or import { initializeWebMCPPolyfill } from '@mcp-b/webmcp-polyfill'.Check import order
The polyfill import must run before any code that calls
navigator.modelContext. Move it to the top of your entry file.Chrome flags not enabled (native API)
If you are testing the native browser API without the polyfill, enable the experimental flag. Navigate tochrome://flags, search for “Experimental Web Platform features”, set it to Enabled, and relaunch Chrome. Alternatively, launch from the command line:
Tools not appearing in the agent
Verify tools are registered
Run
navigator.modelContextTesting.listTools() in the console. If the list is empty, your registerTool calls have not executed yet.Check transport connection
If you use a browser extension or local relay, confirm it is running and connected. For the local relay, run
webmcp_list_sources from your MCP client.Schema validation errors
TheinputSchema must be valid JSON Schema with type: 'object' at the top level:
Duplicate tool names
CallingregisterTool with a name that is already registered throws an error. To replace a tool, call unregisterTool with the existing name first, then register the new version. Use unique, descriptive names like search_products or search_docs to avoid collisions across components.
Local relay not discovered
| Symptom | Fix |
|---|---|
No sources connected | Confirm the page loaded embed.js and the relay process is running on the expected port (default: 9333). |
No tools listed | Confirm tools are registered on navigator.modelContext before embed.js queries them. If tools register after page load, verify your runtime emits toolschanged events. |
Tool not found | The tab may have reloaded or disconnected. Call webmcp_list_tools again to refresh. |
| Connection blocked | Verify --widget-origin matches your host page origin, and the relay port matches the data-relay-port attribute on the embed script. |
Transport origin mismatch
When using@mcp-b/transports with TabServerTransport or iframe transports, the targetOrigin and allowedOrigins settings must match.
Set targetOrigin to the exact origin of the receiving window (for example, https://myapp.com). Set allowedOrigins on the server side to accept messages only from trusted origins. Using "*" disables origin checking and is appropriate only during development.
See Transports and Bridges for how origin validation works across transport types.
WebMCP not detected (Chrome DevTools MCP)
Thelist_webmcp_tools tool returns “WebMCP not detected” when the current page has not loaded @mcp-b/global or has no tools registered.
Confirm the page uses @mcp-b/global
Check the page source or network tab for the
@mcp-b/global import.Navigate and re-check
WebMCP auto-reconnects on navigation. After navigating to a page with tools, call
list_webmcp_tools again.