Skip to content
GitHub

webmcp-bridge - WebMCP Bridge - AI Agent Discovers and Executes Web Page Tools

webmcp-bridge

WebMCP Bridge - AI Agent Discovers and Executes Web Page Tools

Community Automation
GitHub

Description

Enable AI agents to discover and execute WebMCP tools registered on web pages via browser evaluate capability and navigator.modelContextTesting API. Supports tool discovery, parameter validation, and result parsing.

Use Cases

  • AI agent discovers all WebMCP tools registered on the current page (name, description, input schema)
  • AI agent executes WebMCP tools directly through function calls
  • Handle dynamic tool registration/unregistration (auto-rediscover on page navigation)
  • Deep interaction between AI agents and WebMCP applications: read data, control UI, trigger actions

Examples

// 1. Discover all WebMCP tools on the current page
(async () => {
const tools = await navigator.modelContextTesting.listTools()
return tools.map(t => ({ name: t.name, description: t.description }))
})()
// 2. Execute a tool (arguments must be JSON.stringify'd)
(async () => {
const result = await navigator.modelContextTesting.executeTool(
'code_read',
JSON.stringify({ file: "html" })
)
return JSON.parse(result.content[0].text)
})()

Notes

  • Requires Chrome 146+ with chrome://flags/#enable-webmcp-testing enabled
  • All code runs via browser evaluate, must use async IIFE wrapper (top-level await not supported)
  • The second argument of executeTool is a JSON string, not an object
  • Tools are page-scoped; call listTools() again after navigation to discover new tools

Applicable Roles

Developer

Tags

webmcpmcpbrowserai-agentweb-automation