A standalone Node.js library for discovering and executing WebMCP tools in Chrome via the Chrome DevTools Protocol. Think "Playwright for WebMCP" — without Playwright.
Chrome launched with:
chrome --remote-debugging-port=9222 --enable-features=WebMCPTestingpnpm add @tech-sumit/webmcp-cdpimport{CdpToolSource}from"@tech-sumit/webmcp-cdp";constsource=newCdpToolSource();awaitsource.connect({host: "localhost",port: 9222});// List all tools from all tabsconsttools=source.listTools();console.log(tools);// [{ name: "searchFlights", description: "...", inputSchema: "{...}" }]// Execute a tool (args and result are JSON strings per WebMCP spec)constresult=awaitsource.callTool("searchFlights",'{"from":"SFO","to":"JFK"}');console.log(result);// '{"flights":[...]}'// Listen for tool changessource.onToolsChanged((tools)=>{console.log("Tools changed:",tools.length);});// Clean upawaitsource.disconnect();Implements the ToolSource interface from @tech-sumit/ai-inspector-types.
| Method | Description |
|---|---|
connect(config?) | Connect to Chrome via CDP |
disconnect() | Disconnect all sessions |
listTools() | List all discovered tools |
callTool(name, args) | Execute a tool |
onToolsChanged(cb) | Register change listener |
isConnected() | Check connection status |
Internal class for managing multiple CDP targets (tabs).
pnpm install
pnpm test# vitest
pnpm typecheck # tsc --noEmit
pnpm build # tsup -> dist/