API REFERENCE

API Reference

Public surfaces across the runtime, browser adapter, chat widget, and framework integrations.

@page-mcp/core
APIDescription
new EventBus({ timeout? })In-memory RPC transport for same-page or shared-context setups.
new PageMcpHost({ name, version, strictProtocol?, bus?, transport?, skills? })Register tools, resources, prompts, and skills on the page side.
host.registerTool()/unregisterTool()Manage page-exposed tools.
host.registerResource()/unregisterResource()Manage readable page resources by URI.
host.registerPrompt()/unregisterPrompt()Manage reusable prompt entries.
host.registerSkill()/unregisterSkill()Manage Page MCP extension workflows.
host.start()/destroy()Start or tear down the host runtime.
new PageMcpClient({ bus?, transport?, connectTimeout? })Create a caller for the page-side host.
client.connect()/disconnect()Open or close the client connection.
client.listTools()/callTool()Discover and invoke tools.
client.listResources()/readResource()List and read page resources.
client.listPrompts()/getPrompt()List prompts and resolve prompt payloads.
Extensions.createSkillsClient(client)Create a skills client for Page MCP skill extensions.
@page-mcp/webmcp-adapter
APIDescription
installWebMcpPolyfill(host, opts?)Expose a browser-facing modelContext polyfill for a PageMcpHost.
isWebMcpSupported()Detect whether the browser already provides a native WebMCP surface.
toWebMcpTool()/fromWebMcpTool()Convert between WebMCP-style tool objects and Page MCP definitions.
@page-mcp/chat
APIDescription
init(config)Mount the chat widget and bind it to your Page MCP runtime.
getInstance()/destroy()Access or tear down the singleton widget instance.
config.openaiDirect OpenAI-compatible settings such as apiKey, model, and baseURL.
config.endpointSend chat traffic through your own backend endpoint instead of direct API mode.
config.bus/defaultAttachedResourcesReuse a shared bus and preselect resources for the widget.
config.theme/position/expandModeConfigure visual presentation and widget behavior.
widget.open()/close()/destroy()Programmatically control the widget lifecycle.
Adapters & Integrations
APIDescription
@page-mcp/react PageMcpProvider/usePageMcp*Provide and access host, client, and bus from React components.
@page-mcp/react useRegisterTool/useRegisterResource/useRegisterPrompt/useRegisterSkillRegister capabilities declaratively with React lifecycle hooks.
@page-mcp/react usePageMcpSkills()Access the Page MCP skills extension client from React.
@page-mcp/vue3 PageMcpPlugin/PageMcpProvider/composablesIntegrate Page MCP with Vue 3 apps.
@page-mcp/vue2 PageMcpPlugin/pageMcpMixinIntegrate Page MCP with Vue 2 apps.