implement-webmcp

Integrates WebMCP into frontend applications to expose DOM state and browser actions to AI agents.

Updated Feb 10, 2026
One-click install
npx skills add https://github.com/vesviet/agent-skills --skill implement-webmcp-vesviet
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: implement-webmcp
Source: https://github.com/vesviet/agent-skills/tree/main/core/skills/frontend/implement-webmcp
Command: npx skills add https://github.com/vesviet/agent-skills --skill implement-webmcp-vesviet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Connecting AI agents to a live browser session requires safely exposing DOM state, application context, and client-side actions without leaking credentials or allowing unauthorized operations. This Skill provides the rules and process to integrate WebMCP into a frontend application with security boundaries built in. ## Core Features & Use Cases - Context Exposure: Mount a WebMCP provider in the root layout and map sanitized application state (Redux/Zustand stores, routes, active entities) to the agent context with sensitive fields stripped. - Action Allowlisting: Register browser actions (navigation, form fills, clicks) behind an explicit default-deny allowlist with strict input schemas and structured JSON error responses. - Security & HITL Gates: Enforce session isolation, keep HttpOnly cookies out of the JS runtime, and require user confirmation for non-idempotent or financial actions, with Service Worker support for asynchronous approvals. - Use Case: You are building an e-commerce storefront where an AI assistant should read the current cart state and apply filters on behalf of the user. Use this Skill to expose sanitized cart state, register allowlisted filter actions, and gate checkout behind a confirmation modal. ## Quick Start Use the implement-webmcp skill to add a WebMCP provider to my app's root layout and expose the current route and cart state to AI agents.

Frequently Asked Questions about implement-webmcp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expose browser DOM state to an AI agent with WebMCP?▼

Mount a WebMCP provider in your root layout and call navigator.modelContext.provideContext() with sanitized application state. Subscribe to reactive UI state like the current route or active entity, and filter out passwords, tokens, and private identifiers before emitting context updates.

How do I register browser actions for an AI agent to execute?▼

Define an explicit allowlist of actions with structured input schemas declaring property types, enums, and required fields. Wire handlers to execute client actions like navigation or form fills, and return structured JSON success or error responses with clear codes.

Does WebMCP work with server-side rendering and hydration?▼

WebMCP requires client-side execution guards to avoid SSR hydration breakage. Feature-detect with 'modelContext' in document, mount the provider only on the client, and provide a fallback polyfill bridge when the API is unavailable.

How do I prevent an AI agent from performing unauthorized browser actions?▼

Use a default-deny action allowlist and reject any tool call not explicitly registered. Enforce the same permission rules the UI enforces, keep auth tokens in HttpOnly cookies outside the JS runtime, and require user confirmation for non-idempotent or financial actions.

Why should WebMCP tool handlers avoid returning raw stack traces?▼

Raw stack traces leak internal server details to the agent and potential attackers. Handlers should return structured JSON error payloads with clear codes, such as { error: { code: 'OUT_OF_STOCK', message: '...' } }, so agents can react without exposing internals.