agentleFS
webmaxruwebmaxru/webmcp-access-review-workbench/.agents/skills/webmcp/SKILL.md

webmcp

Skill0 starsChanged 2 months agoMITView on GitHub

Implements and debugs browser WebMCP integrations in JavaScript or TypeScript web apps. Use when exposing imperative tools through document.modelContext (with a navigator.modelContext fallback), annotating HTML forms for declarative tools, handling agent-invoked form flows, or validating WebMCP behavior in the current Chrome preview. Don't use for server-side MCP servers, REST tool backends, or non-browser providers.

6 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

  • Other versions6 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 1

    1. webmaxru/web-ai-agent-skills★ 5283% same

    Wrote their own version · 5

    1. BuilderIO/skills★ 4.7ksame name
    2. qdhenry/Claude-Command-Suite★ 1.3ksame name
    3. AgriciDaniel/web-mcp★ 12same name
    4. malinskibeniamin/skills★ 4same name
    5. ScaleDockHQ/scaledock-skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

34 rules. 0 are common, 13 are distinctive, and 21 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 21

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If a Node runtime is unavailable, inspect the nearest package.json, HTML entry point, and framework bootstrap files manually to identify …

    line 17
  2. Distinctive:

    If the workspace contains multiple frontend apps, prefer the app that contains the active route, component, or user-requested feature …

    line 18
  3. Distinctive:

    If the inventory still leaves multiple plausible frontend targets, stop and ask the user which app should receive the WebMCP integration.

    line 19
  4. Distinctive:

    If the project is not a browser web app, stop and explain that this skill does not apply.

    line 20
  5. Very specific:

    Read references/webmcp-reference.md before writing code.

    line 23
  6. Very specific:

    Read references/declarative-api.md when the feature can be expressed as an HTML form flow or needs agent-invoked submit handling.

    line 24
  7. Very specific:

    Read references/compatibility.md when native availability, Chrome preview setup, or draft-versus-preview behavior matters.

    line 25
  8. Very specific:

    Read references/troubleshooting.md when registration, schema serialization, or agent-driven form execution fails.

    line 26
  9. Distinctive:

    Verify that the integration runs in a secure window browsing context.

    line 27
  10. Distinctive:

    If the feature must run on the server, in a worker, or headlessly without a visible browsing context, stop and explain the platform …

    line 28
  11. Distinctive:

    Keep tool names, descriptions, and parameters explicit and positive, and prefer atomic tools over overlapping variants.

    line 31
  12. Very specific:

    Read assets/model-context-registry.template.ts and adapt it to the framework, state model, and file layout in the workspace when using the …

    line 34
  13. Very specific:

    If tool availability depends on route, selection, or page state, register tools only while they are valid and unregister stale tools by …

    line 42
  14. Very specific:

    Use labels or toolparamdescription to produce clear parameter descriptions for declarative fields.

    line 44
  15. Very specific:

    Use toolautosubmit only when the page should submit automatically after the agent populates the form.

    line 45
  16. Very specific:

    When a tool needs explicit confirmation or a user-facing step, route it through the application's visible UI and existing authorization …

    line 49
  17. Very specific:

    When customizing declarative submit handling, call preventDefault() before respondWith() and return structured validation errors for …

    line 50
  18. Very specific:

    Use preview-only events such as toolactivated, toolcancel, agentInvoked, and WebMCP form pseudo-classes only behind compatibility-aware UI …

    line 51
  19. Distinctive:

    Keep destructive or sensitive actions gated behind visible user confirmation, even if the agent can prepare the input.

    line 52
  20. Distinctive:

    Keep UI state synchronized so the same page accurately reflects changes caused by human input and tool calls.

    line 53
  21. Distinctive:

    Test the register and unregister lifecycle, including duplicate-name protection and cleanup on route or state changes.

    line 56
  22. Distinctive:

    Test invalid or incomplete inputs to confirm the tool returns corrective errors instead of silently failing.

    line 57
  23. Very specific:

    If the target environment is the current Chrome preview, confirm the required version and flag state from references/compatibility.md …

    line 59
  24. Very specific:

    Test execution cancellation by aborting the signal passed to executeTool() and verify that long-running work stops without relying on tool …

    line 60
  25. Distinctive:

    Use the Model Context Tool Inspector or equivalent preview tooling only as a validation aid, not as a runtime dependency.

    line 61
  26. Distinctive:

    After deterministic execution is correct, validate natural-language routing so descriptions and parameter shapes guide the agent toward the …

    line 63
  27. Distinctive:

    Run the workspace build, typecheck, or tests after editing.

    line 64
  28. Very specific:

    If both document.modelContext and navigator.modelContext are missing, confirm the code is running in a secure browser window context and …

    line 67
  29. Very specific:

    If only navigator.modelContext is present, the page is running on an older Chrome 146–149 preview build.

    line 68
  30. Very specific:

    If registerTool() throws InvalidStateError, check for duplicate names, empty name or description values, or tool names that exceed 128 …

    line 70
  31. Very specific:

    If registerTool() throws NotAllowedError, check whether the tools Permissions Policy feature is denied.

    line 71
  32. Very specific:

    If registerTool() throws TypeError or JSON serialization errors, replace non-serializable or circular inputSchema values with plain …

    line 72
  33. Very specific:

    If an older demo or article references provideContext, clearContext, or toolparamtitle, treat those surfaces as obsolete for current …

    line 73
  34. Very specific:

    If declarative execution does not update the page correctly, read references/declarative-api.md and references/troubleshooting.md before …

    line 74

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

WebMCP

Procedures

Step 1: Identify the browser integration surface

  1. Inspect the workspace for browser entry points, UI handlers, and any existing app state or form handling layer.
  2. Execute node scripts/find-webmcp-targets.mjs . to inventory likely frontend files and existing WebMCP markers when a Node runtime is available.
  3. If a Node runtime is unavailable, inspect the nearest package.json, HTML entry point, and framework bootstrap files manually to identify the browser app boundary.
  4. If the workspace contains multiple frontend apps, prefer the app that contains the active route, component, or user-requested feature surface.
  5. If the inventory still leaves multiple plausible frontend targets, stop and ask the user which app should receive the WebMCP integration.
  6. If the project is not a browser web app, stop and explain that this skill does not apply.

Step 2: Choose the WebMCP shape

  1. Read references/webmcp-reference.md before writing code.
  2. Read references/declarative-api.md when the feature can be expressed as an HTML form flow or needs agent-invoked submit handling.
  3. Read references/compatibility.md when native availability, Chrome preview setup, or draft-versus-preview behavior matters.
  4. Read references/troubleshooting.md when registration, schema serialization, or agent-driven form execution fails.
  5. Verify that the integration runs in a secure window browsing context.
  6. If the feature must run on the server, in a worker, or headlessly without a visible browsing context, stop and explain the platform limitation.
  7. Choose the imperative API when the tool wraps existing JavaScript logic, requires dynamic registration, or must handle execution cancellation.
  8. Choose the declarative API when the user flow already maps cleanly to a form submission and the page can keep the human-visible form in sync with agent activity.
  9. Keep tool names, descriptions, and parameters explicit and positive, and prefer atomic tools over overlapping variants.

Step 3: Implement tool registration

  1. Read assets/model-context-registry.template.ts and adapt it to the framework, state model, and file layout in the workspace when using the imperative API.
  2. Resolve the model context with the feature-detection pattern const modelContext = document.modelContext || navigator.modelContext; and guard subsequent registration on its presence. Prefer document.modelContext (the current surface) and keep navigator.modelContext only as a fallback for older Chrome 146–149 builds.
  3. Register imperative tools by awaiting modelContext.registerTool() inside a try/catch, using a stable name (1–128 ASCII alphanumeric/_/-/. characters), a positive description, an object inputSchema, and an execute callback. On Chrome 151+ the call returns a Promise<void> that resolves when the tool is available across the frame tree; await keeps the same code working on older builds that registered synchronously.
  4. Set annotations.readOnlyHint to true only for tools that do not modify state.
  5. Set annotations.untrustedContentHint to true when the tool's output may contain data from untrusted sources.
  6. Validate business rules inside the tool implementation even when the schema is strict, and return descriptive errors that help the agent retry with corrected input.
  7. Return tool results only after the UI and application state reflect the tool's effect.
  8. On Chrome 153+, accept the always-present { signal } as the second execute argument and pass it to cancellable work such as fetch(). Treat this execution signal separately from the registration signal.
  9. If tool availability depends on route, selection, or page state, register tools only while they are valid and unregister stale tools by aborting the AbortController whose signal was passed to registerTool(); during the Chrome 148 transition window, also call modelContext.unregisterTool?.() with optional chaining before aborting.
  10. For declarative tools, annotate the target <form> with toolname and tooldescription, and let form controls define the parameter surface.
  11. Use labels or toolparamdescription to produce clear parameter descriptions for declarative fields.
  12. Use toolautosubmit only when the page should submit automatically after the agent populates the form.

Step 4: Wire agent-driven UX safely

  1. Preserve the normal human interaction path even when the page supports agent invocation.
  2. When a tool needs explicit confirmation or a user-facing step, route it through the application's visible UI and existing authorization checks; the current execute(input, { signal }) contract does not provide a client callback.
  3. When customizing declarative submit handling, call preventDefault() before respondWith() and return structured validation errors for agent-invoked submits.
  4. Use preview-only events such as toolactivated, toolcancel, agentInvoked, and WebMCP form pseudo-classes only behind compatibility-aware UI logic.
  5. Keep destructive or sensitive actions gated behind visible user confirmation, even if the agent can prepare the input.
  6. Keep UI state synchronized so the same page accurately reflects changes caused by human input and tool calls.

Step 5: Validate behavior

  1. Test the register and unregister lifecycle, including duplicate-name protection and cleanup on route or state changes.
  2. Test invalid or incomplete inputs to confirm the tool returns corrective errors instead of silently failing.
  3. For declarative tools, verify generated parameter descriptions, required fields, submit behavior, and any custom respondWith() handling.
  4. If the target environment is the current Chrome preview, confirm the required version and flag state from references/compatibility.md before treating runtime failures as application bugs.
  5. Test execution cancellation by aborting the signal passed to executeTool() and verify that long-running work stops without relying on tool unregistration.
  6. Use the Model Context Tool Inspector or equivalent preview tooling only as a validation aid, not as a runtime dependency.
  7. Validate deterministic execution first by inspecting the registered tool set and manually invoking the tool with representative arguments when preview tooling is available.
  8. After deterministic execution is correct, validate natural-language routing so descriptions and parameter shapes guide the agent toward the correct tool.
  9. Run the workspace build, typecheck, or tests after editing.

Error Handling

  • If both document.modelContext and navigator.modelContext are missing, confirm the code is running in a secure browser window context and then check the preview requirements in references/compatibility.md.
  • If only navigator.modelContext is present, the page is running on an older Chrome 146–149 preview build; keep the document.modelContext || navigator.modelContext fallback in place but plan to drop navigator.modelContext once the deprecation window closes.
  • Await registerTool() inside a try/catch. On Chrome 151.0.7922.0+ it returns a Promise<void> that rejects on failure; older builds returned synchronously and threw. The same await + try/catch catches both, so the error checks below apply whether the failure surfaces as a synchronous throw or a Promise rejection.
  • If registerTool() throws InvalidStateError, check for duplicate names, empty name or description values, or tool names that exceed 128 characters or contain disallowed characters (only ASCII alphanumeric, _, -, . are allowed).
  • If registerTool() throws NotAllowedError, check whether the tools Permissions Policy feature is denied; cross-origin iframes need allow="tools" from the embedding document.
  • If registerTool() throws TypeError or JSON serialization errors, replace non-serializable or circular inputSchema values with plain JSON-compatible objects.
  • If an older demo or article references provideContext, clearContext, or toolparamtitle, treat those surfaces as obsolete for current implementations.
  • If declarative execution does not update the page correctly, read references/declarative-api.md and references/troubleshooting.md before changing the tool contract.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.