@web-axag/shim
v1.1.0
Published
A WebMCP registry for browsers that don't have one yet, so AXAG code runs unchanged
Maintainers
Readme
@web-axag/shim
A document.modelContext for browsers that don't have one yet, so code written against WebMCP runs unchanged.
npm install @web-axag/shimimport { installShim } from '@web-axag/shim';
installShim(); // no-op where the browser has its own implementationThen register as usual — @web-axag/webmcp and the framework bindings find the shim exactly as they find a native implementation:
registerManifest(tools, { signal: route.signal, handlers });What it is, and isn't
It implements the part of the draft a page calls: registerTool(tool, { signal }), with abort unregistering. It keeps the registered tools somewhere a bridge or an inspector can read them.
Installing it connects no agent. It is the socket a connection plugs into — @web-axag/bridge is one such connection.
Reading the registry
import { getShimRegistry } from '@web-axag/shim';
const registry = getShimRegistry();
registry?.listTools(); // what is registered right now
registry?.subscribe(tools => render(tools)); // called whenever that changes
await registry?.callTool('order_track', { order_id: 'o1' });Under 2 KB gzipped, with no dependencies: this is the one piece that ships on every page.
