WebMCP React hook, Polyfill, and type declaration package

118 views
Skip to first unread message

Alex Nahas

unread,
Feb 17, 2026, 5:31:39 PM (9 days ago) Feb 17
to Chrome Built-in AI Early Preview Program Discussions

I think these will be useful for anyone building with WebMCP right now.

I’m not sure anyone is maintaining a dedicated types package for WebMCP yet, so I’m happy to do it:

@mcp-b/webmcp-types
https://www.npmjs.com/package/@mcp-b/webmcp-types
You get type inference from input schemas into execution function arguments.
(Also supports output schema inference, which is not currently part of the spec, but very useful in practice.)

@mcp-b/webmcp-polyfill
https://www.npmjs.com/package/@mcp-b/webmcp-polyfill
Polyfills navigator.modelContext and navigator.modelContextTesting.
Also adds a validation layer for JSON Schema and Standard Schema validators.

Current Chrome behavior does not validate execution arguments, but model feedback on failed tool calls is important, especially with SLMs (for example with the Prompt API).

usewebmcp
https://www.npmjs.com/package/usewebmcp
Wraps modelContext.registerTool and ties tool lifecycle to React component lifecycle.
Core WebMCP methods can be a footgun in dynamic SPAs, so this is a safer abstraction.

Reply all
Reply to author
Forward
0 new messages