{"_id":"@agent-provider/webmcp","_rev":"6-4828fb88d9b06a37fc4fb1f8803ba5fb","name":"@agent-provider/webmcp","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.0":{"name":"@agent-provider/webmcp","version":"0.1.0","keywords":["browser","llm","webmcp","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/webmcp@0.1.0","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"dist":{"shasum":"c36ec15377323c5cebba656feef09292392c2053","tarball":"https://registry.npmjs.org/@agent-provider/webmcp/-/webmcp-0.1.0.tgz","fileCount":9,"integrity":"sha512-dIrxe4n74TPBqt+Pc6WRQLE6MWfP7Jyztw2dfvJpQ+5fwbi2dm1pTZnSydP1UZX5JV52JuQCuc6jT4XWr+ZwAw==","signatures":[{"sig":"MEUCIB8ktCr9HpgsYWfDXHBCbKq3UQA6Axs7fvcb0l8CLbOoAiEAksUmNhnCkMY6xOExJqMsAuLJTSpsDlk53a8OoS3qjbw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16485},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"13bee9a89750e14cf880d4c751c1bac52d900216","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"xertrov","email":"m@xk.io"},"_npmVersion":"12.0.1","description":"Optional WebMCP adapter for explicitly exposed Agent Provider tools.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"ai":">=7.0.34 <8","@agent-provider/runtime":"0.1.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/webmcp_0.1.0_1784764832283_0.017464282515275098","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@agent-provider/webmcp","version":"0.1.1","keywords":["browser","llm","webmcp","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/webmcp@0.1.1","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"d6e6e1a467c0760e5d0387706a7b3b52c2387277","tarball":"https://registry.npmjs.org/@agent-provider/webmcp/-/webmcp-0.1.1.tgz","fileCount":9,"integrity":"sha512-vLCRCn2Bq1JjDM9N9BrCQjFAjPjnd8afagzqhQ0yLyH45t6Wn4L9LwMSBI6j42tEsr5FmT44NQTxYPM3uzI3gg==","signatures":[{"sig":"MEQCICRUPFpoimOYvuBclVVJ3XjbK6U6UcS/rPoYrBFT1iskAiAFjOkhaV1a6nVFETG20OWFYCK22kXIIZN4VWhjMjJ+hw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fwebmcp@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":19771},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"2dd5039a143844c33be718ae76b6191608da76ef","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8544afc4-be74-40f9-b00c-1c4ae6c08ec4"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/webmcp"},"_npmVersion":"11.5.1","description":"Optional WebMCP adapter for explicitly exposed Agent Provider tools.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"ai":">=7.0.34 <8","@agent-provider/runtime":"0.1.1"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/webmcp_0.1.1_1784766051881_0.7749654938508708","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@agent-provider/webmcp","version":"0.1.2","keywords":["browser","llm","webmcp","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/webmcp@0.1.2","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"e42be752bb9bbcadfaf60bce88a6751eefef85b7","tarball":"https://registry.npmjs.org/@agent-provider/webmcp/-/webmcp-0.1.2.tgz","fileCount":9,"integrity":"sha512-BfLxkpeakMN1zdFom3z0Q+Bt5cOMYgsOKsxXRCRh+IjC2kMZI2Fr8IOQ0ZEzLFc/W1xgOHL5V7F5W7bT/ASFpQ==","signatures":[{"sig":"MEYCIQDg+jbqHqlUxGLM+mq+bzmoEXbMYSurowO4g9FNcpGvpQIhAPMPB0OSzgajI2q/MwNmVBXm812uw4CQd7dw0x5eZsDv","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fwebmcp@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":19771},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"707770d8444dfababcdc11d677dbd93deff516ee","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8544afc4-be74-40f9-b00c-1c4ae6c08ec4"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/webmcp"},"_npmVersion":"11.5.1","description":"Optional WebMCP adapter for explicitly exposed Agent Provider tools.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"ai":">=7.0.34 <8","@agent-provider/runtime":"0.1.2"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/webmcp_0.1.2_1784778847612_0.3379411444998561","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@agent-provider/webmcp","version":"0.1.3","keywords":["browser","llm","webmcp","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/webmcp@0.1.3","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"1e59d70758fe7f5f641a47b39c33098c37027fb6","tarball":"https://registry.npmjs.org/@agent-provider/webmcp/-/webmcp-0.1.3.tgz","fileCount":9,"integrity":"sha512-ryMxWkLqdmGhHUJgR9WRLU46fzF0awARePenBPD4kfFQtoarg08vlmGAEMPCWTWeqSzqrHj8IHovDlm1e3dT1A==","signatures":[{"sig":"MEYCIQCZHzjapkD8sIwkAFEog+BgpR6+2n+ILn8sl9wxlW8EXQIhAIFz9yDjgUqDQW1QoIjV7KP1c1HiQ54z/h/rLQWDy8m9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fwebmcp@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":19771},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"fb7c39c103b925ce01ef87cd7bf3c7bbb3c4a94f","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8544afc4-be74-40f9-b00c-1c4ae6c08ec4"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/webmcp"},"_npmVersion":"11.5.1","description":"Optional WebMCP adapter for explicitly exposed Agent Provider tools.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"ai":">=7.0.34 <8","@agent-provider/runtime":"0.1.3"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/webmcp_0.1.3_1784893419955_0.8644230206384753","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@agent-provider/webmcp","version":"0.1.4","keywords":["browser","llm","webmcp","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/webmcp@0.1.4","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"7b51e42cb73ed673a5c031edbd481329cceac8e1","tarball":"https://registry.npmjs.org/@agent-provider/webmcp/-/webmcp-0.1.4.tgz","fileCount":9,"integrity":"sha512-PqpplAhR1wEvQfiJgbjR2OMIqCbf8pdIVX5T/rISiGP+Pd7RGvpZbrgvJiFv/vCEuTKozGlqBc4eSqS4iCMKqQ==","signatures":[{"sig":"MEUCIQCd+hDlp3yGfbM/YGRWmIsk892fXkXLuZDFub8VF9aA1QIgUuULMWibZZfQA8dmgLM12R9IIjc0RPkXepEMFehiyjM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fwebmcp@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":19771},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f00aa305d5fe6486ad9ded8a89b6069c0c5249f0","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8544afc4-be74-40f9-b00c-1c4ae6c08ec4"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/webmcp"},"_npmVersion":"11.5.1","description":"Optional WebMCP adapter for explicitly exposed Agent Provider tools.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"ai":">=7.0.34 <8","@agent-provider/runtime":"0.1.4"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/webmcp_0.1.4_1785432192354_0.730286503376592","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@agent-provider/webmcp","version":"0.1.5","description":"Optional WebMCP adapter for explicitly exposed Agent Provider tools.","license":"CC0-1.0 OR Unlicense","repository":{"type":"git","url":"git+https://github.com/clankercode/agent-provider.git","directory":"packages/webmcp"},"keywords":["browser","llm","webmcp","agent-provider"],"engines":{"node":">=22"},"publishConfig":{"access":"public","provenance":true},"type":"module","sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","typecheck":"tsc -p tsconfig.json --noEmit","test":"vitest run","clean":"rm -rf dist"},"dependencies":{"@agent-provider/runtime":"0.1.5","ai":">=7.0.34 <8"},"devDependencies":{"tsup":"^8.5.1","typescript":"^7.0.2","vitest":"^4.1.10"},"_id":"@agent-provider/webmcp@0.1.5","gitHead":"6e48a8d1a19595339cfc67606241ef9280edf3a4","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"homepage":"https://github.com/clankercode/agent-provider#readme","_nodeVersion":"22.23.1","_npmVersion":"11.5.1","dist":{"integrity":"sha512-ug5+GwlYe/hx0U8/ySxnYT1P+enUFOPLP8VKWb9NbENB6Tg2SjfpXUH9iI0aA9SwhWjIIkS5zf0v9foXcXXMmg==","shasum":"d00a6dc79795cafc8b082f5faac2682d7626a0a4","tarball":"https://registry.npmjs.org/@agent-provider/webmcp/-/webmcp-0.1.5.tgz","fileCount":9,"unpackedSize":19771,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fwebmcp@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGufHBE+aPzoRFduQGmICdh3HFOqTXXkq5DKjtcdOvojAiBlnP57KBDBw2bOK/CT99qfNxhDVEXAO5yK9odzvy0YXQ=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8544afc4-be74-40f9-b00c-1c4ae6c08ec4"}},"directories":{},"maintainers":[{"name":"xertrov","email":"m@xk.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/webmcp_0.1.5_1785437754588_0.15507748221380901"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-23T00:00:32.086Z","modified":"2026-07-30T18:55:55.115Z","0.1.0":"2026-07-23T00:00:32.428Z","0.1.1":"2026-07-23T00:20:52.013Z","0.1.2":"2026-07-23T03:54:07.763Z","0.1.3":"2026-07-24T11:43:40.094Z","0.1.4":"2026-07-30T17:23:12.513Z","0.1.5":"2026-07-30T18:55:54.720Z"},"bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"license":"CC0-1.0 OR Unlicense","homepage":"https://github.com/clankercode/agent-provider#readme","keywords":["browser","llm","webmcp","agent-provider"],"repository":{"type":"git","url":"git+https://github.com/clankercode/agent-provider.git","directory":"packages/webmcp"},"description":"Optional WebMCP adapter for explicitly exposed Agent Provider tools.","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"readme":"# @agent-provider/webmcp\n\nProgressively mirrors explicitly eligible Agent Provider tools into the WebMCP\nAPI when the browser exposes it.\n\n```bash\nnpm install @agent-provider/webmcp\n```\n\nRead-only tools are eligible by default. Write and destructive tools require\nexplicit opt-in and retain their application-side authorization requirements.\n\n## What it does\n\nWebMCP is a proposed browser API (`document.modelContext`) that lets a page\nregister tools for browser-mediated agents. This package adapts an existing\nAgent Provider tool map — the same `AgentProviderToolDefinitions` used by\n`@agent-provider/runtime` — into that API. Mirrored tools execute through the\noriginal definition, so application-side validation, authorization, and\nidempotency handling still apply.\n\nThe adapter is optional and off the critical path: when the browser does not\nexpose `document.modelContext`, `mirrorToolsToWebMcp` reports\n`supported: false` instead of throwing, and Agent Provider continues to work\nunchanged.\n\n## Quick start\n\n```ts\nimport { defineAgentProviderTools } from \"@agent-provider/runtime\";\nimport { mirrorToolsToWebMcp } from \"@agent-provider/webmcp\";\nimport { z } from \"zod\";\n\nconst tools = defineAgentProviderTools({\n  get_current_user: {\n    description: \"Read the signed-in user's profile.\",\n    inputSchema: z.object({}),\n    risk: \"read\",\n    execute: async () => fetchCurrentUser(),\n  },\n});\n\nconst handle = await mirrorToolsToWebMcp(tools);\n\nif (handle.supported) {\n  console.log(\"Mirrored:\", handle.registered);\n}\n\n// Unregister everything and abort in-flight mirrored calls:\nhandle.dispose();\n```\n\n## Eligibility\n\nA tool is mirrored when either condition holds:\n\n- `webMcp: true` is set on the tool definition, or\n- the definition does not set `webMcp: false` and its risk is `\"read\"`.\n\nTools with risk `\"write\"` or `\"destructive\"` are therefore excluded unless\nthey explicitly opt in with `webMcp: true`. Opt-in does not weaken the tool's\nown authorization requirements; it only makes the tool visible to WebMCP\nagents.\n\nEach mirrored invocation receives a fresh idempotency key and shares the\nhandle's abort signal, so `dispose()` cancels outstanding mirrored calls.\n\n## API\n\n### `mirrorToolsToWebMcp(definitions, options?)`\n\n- `definitions`: `AgentProviderToolDefinitions` from `@agent-provider/runtime`.\n- `options.document`: document to read `modelContext` from. Defaults to\n  `globalThis.document`.\n- `options.exposedTo`: forwarded verbatim to `registerTool` to restrict\n  exposure. Omitted from the call when not provided.\n\nReturns a `WebMcpMirrorHandle`:\n\n- `supported`: whether `document.modelContext` was available.\n- `registered`: names of the tools actually mirrored.\n- `dispose()`: unregisters the tools and aborts their in-flight executions.\n\nIf registration fails partway, the mirror aborts and the error is rethrown.\n\n## Requirements\n\n- ESM only.\n- A browser environment with a `Document`; the proposed WebMCP API\n  (`document.modelContext`) is detected at call time and is not required.\n- Node.js 22 or newer for building from source.\n\n## Links\n\n- [Agent Provider repository](https://github.com/clankercode/agent-provider)\n- [`@agent-provider/runtime`](https://github.com/clankercode/agent-provider/tree/master/packages/runtime) —\n  tool definitions, approvals, and run state\n- [`@agent-provider/react`](https://github.com/clankercode/agent-provider/tree/master/packages/react) —\n  React bindings and reference UI\n\n## License\n\nCC0-1.0 OR Unlicense.\n","readmeFilename":"README.md"}