webmcpx
/webmcpx
Dodaje do strony narzędzia WebMCP, aby agenty AI mogły z niej korzystać, i sprawdza definicje narzędzi.
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 3
Brak sygnałów. Repozytorium zmienione 10.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Dodaje do strony narzędzia WebMCP, aby agenty AI mogły z niej korzystać, i sprawdza definicje narzędzi.
Oryginalny opis (EN)
Add WebMCP tools to a website and check them. Use when a user wants AI agents to use their site, asks about WebMCP, navigator.modelContext or document.modelContext, registerTool, or wants to lint/validate WebMCP tool definitions.
Jak działa
- 0. Rule: WebMCP first
- 1. Standard tools: prefer these over hand-written ones
- 2. The site's own tools: use tool() or a form
- 3. Verify
Podgląd SKILL.md
---
name: webmcpx
description: Add WebMCP tools to a website and check them. Use when a user wants AI agents to use their site, asks about WebMCP, navigator.modelContext or document.modelContext, registerTool, or wants to lint/validate WebMCP tool definitions.
---
# webmcpx
WebMCP lets a page expose tools to AI agents via `document.modelContext.registerTool()`.
## 0. Rule: WebMCP first
On every web page you work with, check `document.modelContext` and use its tools before reading or clicking
anything: in your own browser and in any script you write or run (Playwright, Selenium, Puppeteer,
browser-use, CDP), even if you support WebMCP natively. Read the page only when it has no WebMCP tools or none
fits. Add this rule to the project's agent instructions (AGENTS.md, CLAUDE.md or equivalent).
## 1. Standard tools: prefer these over hand-written ones
If the site has none yet, add the drop-in. It registers `get_page_context`, `search_page` and `fetch_as_markdown`:
```html
<script type="module" src="https://cdn.jsdelivr.net/npm/webmcpx@0.2/dist/auto.js"></script>
```
The script adds the W3C WebMCP polyfill where the browser lacks WebMCP, so agents driving Firefox, Safari
or Chrome without the flag still find the tools at `document.modelContext`.
In a bundled app use `npm install webmcpx`, then call `register()` once on startup (import
`webmcpx/polyfill` first, or the tools exist only in browsers with WebMCP):
```js
import "webmcpx/polyfill";
import { register } from "webmcpx";
const { dispose } = await register({ searchSite }); // searchSite optional: (query, {limit}) => [{title, url, snippet}]
```
- In SPAs, call `dispose()` when the app unmounts. Don't re-register on every route.
- If the page has a strict CSP, add `'wasm-unsafe-eval'` to `script-src`. Without it, tools return `UNAVAILABLE`.
## 2. The site's own tools: use `tool()` or a form
```js
import { tool } from "webmcpx"; // or useTool from "webmcpx/react" | "webmcpx/vue" | "webmcpx/svelte"
tool({
name: "add_to_cart", // [A-Za-z0-9_.-], under 30 chars
description: "Add a product to the cart by SKU.", // what it does and when to use it, under 500 chars
input: { sku: "string", "qty?": "integer" }, // shorthand ("?" = optional, [..] = choices); or inputSchema: {...}
acts: true, // changes something for the user; readOnly: true for reads
run: ({ sku, qty = 1 }) => cart.add(sku, qty), // return data; throw on failure (error.code = a webmcpx code)
});
```
A server-rendered form needs no JavaScript: add `toolname`, `tooldescription` and, per field,
`toolparamdescription` (plus `toolautosubmit` if the agent may submit; then `event.agentInvoked` and
`event.respondWith(promise)` in the submit handler). The script tag makes it a tool.
- Reuse the functions the UI already calls; don't drive the DOM.
- Keep each page to 20 tools or fewer.
- Never ask for passwords, card data or IDs as parameters.
## 3. Verify
1. **Lint.** Run `npx webmcpx lint <dir> --format json` (no install needed; exit 1 means errors). Fix every error. `--fix` removes invisible characters.
`webmcpx rule <name>` explains a rule, and `webmcpx explain <CODE>` explains a tool error code.
2. **See the tools in a real browser, yourself.** With the dev server running, run
`npx webmcpx tools <local URL>` (e.g. `localhost:5173`): it lists the page's tools, no browser flag.
Then call one: `npx webmcpx call <local URL> <tool> '<json input>'` (exit 1 means the tool returned an error).
For production in Chrome, the site needs an origin-trial token in a `<meta http-equiv="origin-trial">` tag.
3. **Call them like any agent would.** With MCP: `npx -y webmcpx mcp` gives the agent each page's
tools (its own Chromium, polyfill first). Driving a browser yourself (Playwright, Selenium, Puppeteer,
CDP; Chrome, Firefox, Safari): in the page, `const mc = document.modelContext; const t = (await
mc.getTools()).find((t) => t.name === "search_page"); JSON.parse(JSON.parse(await mc.executeTool(t,
{ query: "pricing" })))`. `executeTool()` resolves with JSON text and webmcpx tools return their
envelope as JSON text, so parse twice; a tool returning an object needs one parse.
4. **Scan the live site.** Once deployed, `https://webmcpx.dev/scan/<site>` (or `GET https://webmcpx.dev/api/scan?url=<site>` for JSON) should say agent-ready.
Wersje
W bazie nie ma innych skilli o nazwie webmcpx.
Migawka bazy z 13.11.2026 · wersja paczki 9e403df0e10e (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100webmcp
Udostępnia funkcje strony agentom AI jako wywoływalne narzędzia przez WebMCP, szkicowe API przeglądarki document.modelContext z W3C Web Machine Learning Community Group, w tym rejestrację narzędzi i testy w Chrome. - 100webmcp-register-tool
Wdraża imperatywne API WebMCP: rejestruje narzędzia przez navigator.modelContext.registerTool() ze schematami, callbackami wykonania i zarządzaniem cyklem życia przy dynamicznej rejestracji w JavaScript. - 100webmcp
Przygotowuje stronę do użycia przez agentów AI w przeglądarce: planuje ścieżki użytkownika i wdraża je przez document.modelContext. - 100webmcp
Udostępnia stronę agentom przeglądarkowym przez WebMCP: deklaratywne adnotacje formularzy, narzędzia imperatywne lub mostek do serwera MCP. - 90implement
Dodaje narzędzia WebMCP do strony internetowej, tak by agenty przeglądarki działały przez logikę witryny, a nie przez scraping. - 100orchardcore-ai-webmcp
Udostępnia agentom AI w przeglądarce narzędzia strony przez standardowe API document.modelContext w Orchard Core.