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-attest

v0.1.0

Published

Client-side drift detection for a WebMCP toolset: hash the tools a page exposes to agents, freeze a baseline, and fire onDrift when they change.

Downloads

65

Readme

@mcptrail/webmcp-attest

CI License: MIT

Client-side drift detection for a WebMCP toolset. Hash the tools your page exposes to agents, freeze a baseline, and get an onDrift callback the moment the toolset changes into something you didn't ship — a new delete_all, a rewritten schema, a swapped description.

The hash is stable and order-independent: the same set of tools registered in any order produces the same digest, so you compare intent, not insertion order.

Works in any DOM-ish environment (browser, Vitest, jsdom).

Install

npm install @mcptrail/webmcp-attest

Usage

import { createAttestor } from "@mcptrail/webmcp-attest";

const attestor = createAttestor({
  onDrift(info) {
    console.warn("WebMCP toolset drifted!", info.baseline, "→", info.current, info.tools);
  },
});

// your page registers its tools as usual
navigator.modelContext.registerTool({ name: "search", execute: doSearch });
navigator.modelContext.registerTool({ name: "book", execute: doBook });

// freeze what you shipped
attestor.setBaseline();
attestor.verify(); // { ok: true, drifted: false, hash, baseline }

// later — something (a compromised script?) registers an extra tool:
navigator.modelContext.registerTool({ name: "exfiltrate", execute: leak });
// → onDrift fires; attestor.verify().drifted === true

API

const attestor = createAttestor(options);

attestor.attest();          // { hash, tools[] } — current toolset
attestor.setBaseline(hash?);// freeze `hash` (or the current hash) as the baseline; returns it
attestor.verify();          // { ok, hash, baseline, drifted }
attestor.onDrift(cb);       // (info) => void; returns an unsubscribe fn
attestor.uninstall();       // restore the original registerTool

Options

| Option | Default | Notes | |--------|---------|-------| | target | navigator | object carrying .modelContext | | baseline | — | freeze this hash as the baseline up front | | onDrift | — | called with DriftInfo when the toolset diverges from the baseline |

One-shot hashing

You don't need the live registerTool patch to hash a known toolset:

import { attestTools, hashToolset } from "@mcptrail/webmcp-attest";

const att = attestTools([tool1, tool2]); // { hash, tools[] } (sorted)
hashToolset(att.tools);                  // stable 8-char hex, order-independent

How it works

createAttestor patches navigator.modelContext.registerTool (guarding against a double-patch and keeping the exact original for restore). Every registration is recorded, the toolset is re-hashed, and — if the new hash diverges from a frozen baseline — the onDrift callbacks fire with a DriftInfo describing the change. uninstall() puts the original registerTool back.

Development

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

License

MIT © Zied Guetari