360 Secure SkillHub
360 安全技能中心

WebMCP Lint

用零依赖 Python 3 CLI 检查 HTML/JS/TS 或在线页面的 WebMCP registerTool 注册:校验 inputSchema、布尔 hints、execute 与 AbortSignal 清理,报错 navigator.modelContext,查 CSP/iframe sandbox。检查器脚本不在包内,需克隆仓库运行。

分类:开发
epistemedeus
epistemedeus
热度 37.24
最近更新 2026-12-04 22:53:01

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add epistemedeus/webmcp-lint
兼容性
通用兼容
联网要求
不联网
数据出网
可选出网
Metadata
name
webmcp-lint
description
Lint HTML, JavaScript, and TypeScript, or an unpaid GET of a live page, for canonical document.modelContext.registerTool. v2.0 records removed navigator.modelContext and emerging window.toolManager, ignores documentation prose, and checks AbortSignal cleanup, hint booleans, and CSP or iframe sandbox.
license
MIT
compatibility
Requires Python 3. Local files or unpaid HTTPS GET only. No wallet, payment, or telemetry.
metadata
{"author":"neomorphic","version":"2.0.0"}

Lint a WebMCP registration

Lint one file, directory, or origin with the zero-dependency CLI in this public repository. Do not pay, sign, attach a wallet, or send telemetry. The command exit code is the result: 0 has no error, 1 has a failed check, and 2 means the arguments are not usable. Informational findings do not change the exit code. --strict fails the process on warnings. Info still does not fail under --strict.

This skill is skills/webmcp-lint in epistemedeus/x402-data-gateway-skills. npx skills add discovers skills/<name>/SKILL.md. It is not marked metadata.internal. Checker version 2.0.0. Mention filter v1.6.

The published call shape comes from the Web Machine Learning Community Group report at https://webmachinelearning.github.io/webmcp/ :

document.modelContext.registerTool({ name, description, inputSchema, annotations, execute }, { signal })

signal is an AbortSignal. Aborting it unregisters the tool. There is no unregisterTool method. The Community Group report is not a W3C Recommendation.

Three surfaces

  1. Canonical: document.modelContext.registerTool(tool, { signal }). This is the call the checker requires.
  2. Removed: navigator.modelContext. Error. It was deprecated in Chrome 150 and removed in Chrome 152.0.7943.0. Chrome's note is https://developer.chrome.com/docs/ai/webmcp/updates . The migration uses document.modelContext.registerTool and aborts the controller on pagehide.
  3. Emerging: window.toolManager, including globalThis.toolManager and self.toolManager. Informational. Chromium CL 8806158 (https://chromium-review.googlesource.com/c/chromium/src/+/8806158) adds it behind the experimental WebMCPv2 flag as a facade over the same per-document registry. It is distinct from canonical document.modelContext. A clean window.toolManager.registerTool call is recorded as window.toolManager and does not count as the canonical surface.

Real script versus docs mention (v1.6)

A registration is real only when registerTool( appears in JavaScript: an inline <script> (or type=module) or a bundled script file the checker reads. The same text in HTML documentation, a blog, or spec prose is a docs mention. That includes <pre>, <code>, and a <script> whose type is not JavaScript, such as text/plain.

Docs mentions do not create legacy errors, toolManager info, or schema errors. A documentation page whose only WebMCP text is prose does not get webmcp.missing_declaration. A product page that names x402, llms.txt, agent-card.json, mcp.json, or /.well-known/mcp, and has no real script registration, still gets that warning. A real <script> on a docs page is still linted.

Run the checker

From a checkout of this repository:

python3 actions/webmcp-lint/webmcp_lint.py --path page.html --json
python3 actions/webmcp-lint/webmcp_lint.py --url https://example.com --json

https://example.com is a placeholder. --url sends GET only, with X-Pilot-QA: 1 and a User-Agent that cites contact@neomorphic.io. That header marks a synthetic read-only probe. Do not count it as customer revenue, and do not count it as traffic from outside an agent. The command may GET up to 6 script URLs from that page. --path does not fetch script tags. Pass the script files yourself, or pass a directory of .html, .js, .jsx, .ts, and .tsx files.

A skill-only install copies this directory and does not copy actions/. Clone the repository, or use a git tree that contains actions/webmcp-lint, before running the command.

Rules

  1. On each canonical document.modelContext.registerTool call, and on each emerging window.toolManager.registerTool call, require inputSchema, annotations.readOnlyHint, annotations.consequentialHint, execute, and a second argument object with signal. Boolean hints must be the literals true or false. An omitted hint is not the same as false (WebMCP #358).
  2. Missing AbortSignal cleanup (WebMCP #346). The options object must carry signal. When that signal is controller.signal, the same script must call controller.abort(), for example on pagehide. Aborting the signal unregisters the tool.
  3. Error on navigator.modelContext and print a migration that uses document.modelContext.registerTool and { signal }.
  4. Info on window.toolManager. Do not treat it as a passing canonical registration.
  5. On an agentic or MCP page with no executable surface, warn and print a 15 line starter. The finding names https://neomorphic.io/lab/conformance-index/ as optional reading. Do not fetch that index from this command unless you are already checking that URL yourself. The v1.6 filter suppresses this warning for docs-only prose.
  6. CSP or iframe sandbox warnings (WebMCP #389). Warn when a real registration is blocked by a script-src or default-src that does not allow the inline script, when CSP sandbox omits allow-scripts, when an iframe sandbox omits allow-scripts on a frame that is given allow="tools" or whose srcdoc names a tool API, and when allow="tools" is delegated to a cross-origin or sandboxed iframe without CSP frame-ancestors. Samples inside <pre> or <code> are not live policy.

--agentic forces rule 5. --no-agentic skips it. --strict makes warnings fail the process. Info does not fail the process.

Install

Default-branch install, after this skill is on the default branch:

npx skills add epistemedeus/x402-data-gateway-skills --skill webmcp-lint --yes

This file can also be installed from a git tree URL for the branch that contains it. Do not claim a skills.sh directory page lists this skill until a fetch of that page shows it.

Boundaries

Contact is contact@neomorphic.io. The optional index, which this command does not modify: