npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mcptrail/webmcp-polyfill

v0.1.0

Published

A navigator.modelContext polyfill for WebMCP: installs a spec-faithful shim only when the browser lacks it, so tools register on any browser.

Readme

@mcptrail/webmcp-polyfill

CI License: MIT

A polyfill of navigator.modelContext for browsers and environments that lack it. It installs a spec-faithful shim only when the browser has no native modelContext, so your WebMCP tools register on any browser — and it never overwrites a real implementation.

It also exposes a small driver (tools() / invoke()) so dev tools and bridges can list and run the tools registered against the polyfill.

Install

npm install @mcptrail/webmcp-polyfill

Usage

import { installModelContextPolyfill } from "@mcptrail/webmcp-polyfill";

// Installs a shim only if navigator.modelContext is missing.
const driver = installModelContextPolyfill();

// Your page (or SDK) registers tools the normal way:
navigator.modelContext.registerTool({
  name: "book_hotel",
  description: "Book a room",
  execute: (args) => `Confirmation for ${JSON.stringify(args)}`,
});

driver.tools();                       // ToolDescriptor[] (name, description, inputSchema, annotations, readOnly)
await driver.invoke("book_hotel", { hotelId: "h1" });
driver.uninstall();                   // restore whatever was there before

API

installModelContextPolyfill(options?): {
  installed: boolean;                 // true only if we actually installed the shim
  tools(): ToolDescriptor[];          // registry tools, sorted by name
  invoke(name, args?): Promise<any>;  // run the tool's execute(args), await, return
  uninstall(): void;                  // restore the previous modelContext (and document's)
};

hasNativeModelContext(): boolean;     // is a modelContext present right now?
modelContextTools(target?): ToolDescriptor[]; // tools, but only if THIS polyfill installed it; else []

Options

| Option | Default | Notes | |--------|---------|-------| | force | false | Install even when a modelContext already exists (overwrites it) | | target | navigator | Object to receive .modelContext (created on globalThis if absent) | | alsoDocument | true | Also assign document.modelContext |

Behavior

  • Never clobbers native. If navigator.modelContext already exists and force is not set, installed is false and the native implementation is left untouched. You still get a driver with a stable tools()/invoke() API (operating over the polyfill's own registry).
  • Read-only safe. If assigning .modelContext throws (a read-only property), it falls back to Object.defineProperty.
  • No navigator? If navigator is undefined, a minimal one is created on globalThis.
  • Recognizable. The installed shim carries a non-enumerable marker so modelContextTools() can tell a polyfill-installed context apart from a native one.

Development

npm install
npm run typecheck
npm test          # Vitest + jsdom
npm run build     # tsup → dist (ESM + CJS + d.ts)

License

MIT © Zied Guetari