Skip to content
WebMCP Agents
Esc
↑↓navigate↵open⌘Jpreview
On this page

@webmcp-agents/core/polyfill/auto

A side-effect entry: importing it calls installWebMCPPolyfill(), which installs the polyfill if the browser has no WebMCP.

A side-effect entry: importing it calls installWebMCPPolyfill(), which installs the polyfill if the browser has no WebMCP. An app with <WebAgentsProvider> or createWebAgents does not need it: they load the polyfill themselves. Use it on a page that registers tools without them.

Import

import "@webmcp-agents/core/polyfill/auto";

Example

A page whose tools are only declarative forms, with no provider: the polyfill finds the forms once it is installed.

// Browsers without WebMCP get document.modelContext, which
// registers every <form toolname> on the page.
import "@webmcp-agents/core/polyfill/auto";

Options

None. The module has no exports and takes no options.

Returns

Nothing.

Notes

  • Import it before any tool registers: a static import runs in module order.
  • A static import puts the polyfill in your main bundle for every browser. To load it only where the browser has no WebMCP, call loadWebMCPPolyfill instead.
  • The package declares this entry as having side effects ("sideEffects" lists ./src/polyfill/auto.ts and ./dist/polyfill/auto.js), so bundlers keep it.
  • Same behaviour as calling installWebMCPPolyfill(): nothing is installed when the browser already has document.modelContext, and nothing happens on the server.
  • @webmcp-agents/polyfill/auto (deprecated) imports this entry, so code written against it keeps working.

See also

Was this page helpful?