Expand description
WebMCP - Browser-native agent tool discovery primitives.
Defines the core types for the Web Model Context Protocol (WebMCP),
which enables browser-side AI agents to discover and execute tools
exposed by web applications via the navigator.modelContext API.
§Architecture
These are pure data types (no behavior) following the cellstate-core pattern. The API crate adds behavior (WebMcpConnector), the SDK wraps it in headless state machines, and the app dogfoods it via the SDK.
§Relationship to MCP
Standard MCP operates server-to-agent (tools exposed by an MCP server).
WebMCP operates browser-to-agent: web pages expose tools via
navigator.modelContext.registerTool() that any connected agent
(browser sidebar, desktop app, or programmatic client) can discover
and execute. This module provides the type vocabulary for both sides.
§Discovery Flow
┌────────────────────────────────────────────────────┐
│ WebMCP Discovery Lifecycle │
│ │
│ Page Load → Detect → Schema Parse → Ready │
│ ↑ │ │
│ │ Execute ← Approve ← ─ ─┘ │
│ │ │ │
│ └─── Context Update ←──┘ │
└────────────────────────────────────────────────────┘Structs§
- WebMcp
Agent Capabilities - Capabilities an agent advertises to a WebMCP-enabled page.
- WebMcp
Context - Page context metadata exposed via WebMCP.
- WebMcp
Discovery State - Complete discovery state for a single page.
- WebMcp
Input Schema - JSON Schema for tool input parameters.
- WebMcp
Manifest - WebMCP manifest for declarative (non-JS) tool exposure.
- WebMcp
Property Schema - Schema for a single property within a tool’s input.
- WebMcp
Security Policy - Security policy governing WebMCP tool access.
- WebMcp
Tool - A tool exposed by a web page via WebMCP.
- WebMcp
Tool Annotations - Security and behavioral annotations for a WebMCP tool.
- WebMcp
Tool Call - A request to execute a WebMCP tool.
- WebMcp
Tool Result - Result of a WebMCP tool execution.
- WebMcp
User Context - User identity context within a WebMCP session.
Enums§
- WebMcp
Discovery Phase - State of the WebMCP discovery lifecycle for a single page.
- WebMcp
Memory Capability - Memory capabilities an agent can provide to a WebMCP page.
- WebMcp
Sandbox Mode - Sandbox execution mode for WebMCP tools.