此页面实现了完整的 WebMCP 接口,兼容所有主流的 AI Agent 与网页通讯方案。
运行时状态: 检测中...
已注册工具: 0 个
Relay 连接: 检测中...
| 方式 | 协议 | 特点 | skill.md 文件 |
|---|---|---|---|
| Local Relay | WebSocket + stdio | 自动转发工具,适合桌面客户端 | local-relay.skill.md |
| DevTools MCP | CDP + MCP | 浏览器控制 + 工具发现 | devtools-mcp.skill.md |
| Playwright | CDP | exposeFunction 双向通信 | playwright.skill.md |
| Selenium | HTTP REST | W3C 标准,Safari 支持 | selenium.skill.md |
| 原生 CDP | WebSocket | 最底层控制 | cdp.skill.md |
加载中...
AI Agent 可以通过以下方式调用页面工具:
// Method 1: direct call (object format { name, arguments })
navigator.modelContext.callTool({ name: 'get_time', arguments: {} })
// Method 2: call with arguments
navigator.modelContext.callTool({ name: 'calculate', arguments: { a: 10, b: 5, operation: 'add' } })
// Method 3: via evaluate (Playwright/Selenium)
await page.evaluate(() => navigator.modelContext.callTool({ name: 'get_time', arguments: {} }))
页面支持通过回调函数向 Agent 发送消息:
// Check whether the agent registered a callback
if (typeof window.agentCallback === 'function') {
await window.agentCallback({ event: 'progress', value: 50 });
}
// Check CDP binding
if (typeof window.agentBridge === 'function') {
window.agentBridge(JSON.stringify({ event: 'ready' }));
}
<script src="./mcp-b-global.js"></script>navigator.modelContext.registerTool() 注册工具