DEV Community
Follow
Context Over MCP, Part IV: No Working Directory At All
WebMCP enables browser tabs to act as clients without needing a traditional working directory or separate server process. It leverages a Chrome experimental API, document.modelContext.registerTool(), and a polyfill for broader compatibility to expose context directly from the page. This allows browser-based agents to interact with registered tools, such as scoring projects, filling in forms, and rendering AGENTS.md. Tools like score_faf utilize a client-side WASM kernel, avoiding server round-trips for performance. The system emphasizes honesty by accurately reporting limitations, like the minimal AGENTS.md renderer. Fetching external data is strictly controlled through an allowlist of hosts and protocols to prevent security risks. The primary claim is that all operations occur within the browser tab, with no communication to an MCP server or /mcp URLs. This approach bypasses the limitations of traditional MCP clients by exposing context directly as callable tools within the existing browser environment. The underlying API's openness allows any page to register its own context-aware tools for agent interaction.