Skip to main content
usewebmcp exposes a component’s current state and actions through WebMCP tools:
Counter.tsx
Each call reads the latest committed counter. Registration and cleanup follow the component lifecycle.

Package boundary

The hook uses Community Group types and accepts upstream JSON Schema metadata without runtime validation. Supply native WebMCP, the polyfill, or MCP-B runtime. React 18/19 and 'use client' are supported. The hook rejects Standard Schema validators such as Zod. For Standard Schema validation, MCP output metadata, prompts, resources, or formatted agent responses, use @mcp-b/react-webmcp. Framework setup · API reference · Schema guide