WSG Check

io.github.ivanoats由 GitHub 帳號 ivanoats 發布v0.6.2更新於 Oct 24, 2026

Check websites against the W3C Web Sustainability Guidelines and look up the guidelines

發布方自己的服務:check.tattoo: tattoo size and placement guide

概覽

AI 產生的概覽

依 W3C 網頁永續性指南的啟發式規則檢查網頁,回傳加權分數、未通過項目與修正建議,並可查詢指南條目。

可以做什麼
  • 檢查頁面網址,回傳分數、等級以及每項未通過或警告的檢查與建議修正方式,可選擇回傳完整報告
  • 依類別、可測試性或文字篩選列出 WSG 指南,並顯示每條指南對應的自動化檢查數量
  • 取得單一指南的說明與 W3C 規格連結
  • 檢查涵蓋網頁開發、使用者體驗與主機代管三類,商業類目前沒有自動化檢查
適用情境
適合讓助理審查已上線網站或本機開發伺服器的永續性問題,並在程式碼庫中修正,或查詢某個主題(例如網頁字型)涉及哪些 WSG 指南。
執行需求
透過 npx 從 npm 套件以 stdio 在本機執行,需要 Node.js 22 或更新版本。不需帳號、API 金鑰或託管服務。需要連線目標網站,並向 Green Web Foundation 查詢綠色主機資訊。
安裝前請注意
預設允許本機與回送位址,助理讀到的文字可能誘導它請求你電腦上的服務;可設定 WSG_CHECK_NO_LOCAL=1 阻擋。私有網段需設定 WSG_CHECK_ALLOW_PRIVATE=1 才允許。主機名稱會傳送給 Green Web Foundation。此 MCP 伺服器不接受請求標頭,因此無法檢查需登入的頁面。分數為啟發式結果,不同規格版本之間不可直接比較。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 WSG Check,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

WSG-Check

[CI] [codecov]

Check a website against automated heuristics based on the W3C Web Sustainability Guidelines. Get a weighted score, recommendations, and reports in terminal, JSON, Markdown, or HTML format through a CLI or a Next.js web app.

Release status

The latest release is v0.7.0.

Source on main targets WSG September-2026, the 24 September 2026 Group Note Draft; v0.6.1 and earlier target July-2026. It includes an MCP server for AI assistants, with the check_url, list_guidelines, and get_guideline tools, listed in the MCP Registry as io.github.ivanoats/wsg-check. The server first shipped in v0.4.0; v0.3.0 was tagged on GitHub but not published to npm. See the changelog and spec versioning policy.

Scores from different spec versions should not be treated as directly comparable. The package version and check selection also matter when comparing reports.

Quick start

Requires Node.js 22 or later. Pin the released CLI for reproducible usage:

bash
npx @sustainablewebsites/[email protected] https://example.com # x-release-please-version
# Or install globallynpm install -g @sustainablewebsites/[email protected] # x-release-please-versionwsg-check https://example.com --format json --output report.json

To run the current source, including unreleased features, use Node.js 22.22.1 or later (required by development tooling):

bash
git clone https://github.com/ivanoats/wsg-check.gitcd wsg-checknpm ci             # prepare also generates Panda CSS tokensnpm run dev        # http://localhost:3000
# Build and run the CLI from this checkoutnpm run build:clinode dist/cli/index.js https://example.com

See CONTRIBUTING.md for environment configuration and development commands.

What the results mean

  • Checks cover web development, UX, and hosting. The business category has no automated checks.
  • Analysis uses fetched HTML and HTTP metadata; it does not render JavaScript, measure Core Web Vitals, or download every referenced asset.
  • Results describe one page, but most checks read the server or content shared by a site template, so pages on one site usually score alike. Scores differ mainly on page-specific content such as images and inline styles or scripts.
  • CO₂ estimates use the HTML transfer size and the SWD v4 model, not measured full-page energy consumption. Failed green-hosting lookups fall back to false.
  • Report page weight is the HTML transfer size: the bytes received over the network, compressed when the server compressed them. Resource and third-party counts come from references in the HTML. Referenced assets are not downloaded or measured.
  • Security headers, form validation, native form features, and image alternative text remain visible as related checks, excluded from WSG scores.

CLI Usage

WSG-Check ships with a command-line tool that lets you check any website directly from your terminal or integrate checks into CI pipelines.

Basic usage

bash
# Check a website with default (terminal) outputnpx @sustainablewebsites/wsg-check https://example.com
# Output as JSONnpx @sustainablewebsites/wsg-check https://example.com --format json
# Save the report to a filenpx @sustainablewebsites/wsg-check https://example.com --format markdown --output report.md
# Fail the process (exit 1) if the score is below 70npx @sustainablewebsites/wsg-check https://example.com --fail-threshold 70

Options

OptionAliasDescriptionDefault
--format <format>-fOutput format: terminal, json, markdown, htmlterminal
--output <path>-oWrite report to a file instead of stdout(stdout)
--categories <list>-cComma-separated categories: ux,web-dev,hosting (business planned — no automated checks yet)all
--guidelines <list>-gComma-separated guideline slugs to run, e.g. minify-and-remove-unused-code (numeric IDs such as 3.3 are deprecated)all
--fail-threshold <n>Exit code 1 if overall score < n (0–100)0
--verbose-vEnable verbose loggingfalse
--ignore-robotsSkip robots.txt for a site you operate; adds (ignore-robots) to the User-Agentfalse
--config <path>Path to wsg-check.config.json or .wsgcheckrc.json(auto-discover)
--header <header>-HSend a request header (Name: value, repeatable) to the start URL's host only; never to robots.txt or other hosts(none)
--versionPrint version and exit
--helpPrint help and exit

--header values land in shell history and CI logs, and a malformed one is echoed in the error. For a secret, set "headers": {"Cookie": "..."} in a wsg-check.config.json kept out of version control. Header names in the config file are checked when it loads, and an error names the bad header without printing its value. --header replaces the config file's headers entirely. Headers are not sent over plain http after an https hop. To change the user agent, use WSG_USER_AGENT or the config's userAgent. The web API and MCP server do not accept request headers.

CI integration

Use --fail-threshold to fail your pipeline when a site's sustainability score drops:

yaml
# .github/workflows/sustainability.yml- name: Check sustainability  run: npx @sustainablewebsites/wsg-check https://example.com --fail-threshold 60 --format json --output wsg-report.json- name: Upload report  uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1  with:    name: wsg-report    path: wsg-report.json

Exit codes

CodeMeaning
0Check completed and score is at or above --fail-threshold
1Fetch/parse error, or score is below --fail-threshold

Use with AI assistants (MCP)

The package includes wsg-check-mcp, a Model Context Protocol server for Claude Code, Claude Desktop, VS Code, Cursor, and other MCP clients. It runs on your machine over stdio, with no account, port, or hosted service. Your assistant can then check a deployed site or your local dev server, look up guidelines, and fix what it finds.

bash
# Claude Codeclaude mcp add wsg-check -- npx -y -p @sustainablewebsites/wsg-check wsg-check-mcp

Claude Desktop (claude_desktop_config.json) and Cursor (.cursor/mcp.json):

json
{  "mcpServers": {    "wsg-check": {      "command": "npx",      "args": ["-y", "-p", "@sustainablewebsites/wsg-check", "wsg-check-mcp"]    }  }}

npx -y @sustainablewebsites/wsg-check --mcp starts the same server; it's the command the MCP Registry listing, io.github.ivanoats/wsg-check, uses.

VS Code (.vscode/mcp.json) uses a servers key:

json
{  "servers": {    "wsg-check": {      "type": "stdio",      "command": "npx",      "args": ["-y", "-p", "@sustainablewebsites/wsg-check", "wsg-check-mcp"]    }  }}

Try prompts such as "Check http://localhost:3000 against the WSG and fix the top three issues" or "Which WSG guidelines cover web fonts?"

ToolWhat it does
check_urlChecks a page and returns the score, grade, and each failed or warned check with a recommended fix. detail: "full" adds the complete report.
list_guidelinesLists the WSG guidelines, filtered by category, testability, or text, with how many automated checks implement each one.
get_guidelineReturns one guideline's description and W3C specification link.

Network access

  • Local URLs are allowed by default, so http://localhost:3000 and other loopback addresses work without setup. The trade-off: text the assistant reads, such as a web page or a file in your project, could try to steer it into requesting a service on your machine. Requests are GET-only and the results go back to the assistant. If you don't check a local dev server, add --no-local after wsg-check-mcp in the arguments, or set WSG_CHECK_NO_LOCAL=1.
  • Private networks (10/8, 172.16/12, 192.168/16) are blocked unless you add --allow-private-network or set WSG_CHECK_ALLOW_PRIVATE=1.
  • The only other request check_url makes is a green-hosting lookup: it sends the hostname to the Green Web Foundation. Local hostnames are never sent.
  • Cloud metadata and other reserved addresses are always blocked. Redirects from a public site into your machine or network are refused, and each connection is pinned to the address that was checked.

Agent skill

The repository also ships an Agent Skill, wsg-sustainability-review. It walks an assistant through checking a site, fixing the issues in your codebase in priority order, and checking again. It uses the MCP tools when they are configured and falls back to the CLI otherwise. Install it into Claude Code, Cursor, Copilot, and other agents with:

bash
npx skills add ivanoats/wsg-check

REST API

The web app exposes Next.js Route Handlers:

EndpointPurpose
POST /api/checkRun a check and return the completed report and ID
GET /api/check/:idRetrieve a report from the process-local result store
GET /api/guidelinesList guidelines; current source includes pinned spec provenance in spec
GET /api/guidelines/:idLook up a guideline; current source accepts slugs and legacy numeric aliases
GET /api/healthHealth status; current source includes package version and specVersion
GET /api/openapiOpenAPI 3.1 JSON document (no interactive documentation UI)

Responses use CORS headers, shared error envelopes, and in-memory rate limiting. Stored results expire after one hour and the store holds at most 500 entries. Results and limits are not shared across server instances. The browser carries newly created reports through sessionStorage; result URLs are not durable share links. See runtime and storage.

Architecture and documentation

The CLI, web API, and MCP server share a TypeScript fetch → check → score → report pipeline. The code is layered and framework-independent at its core, with direct dependencies on concrete utility implementations. The architecture overview documents these boundaries and the external-I/O exceptions.

License

Apache-2.0. See NOTICE and the Contributor License Agreement.

來源:README.md,提交 f4da3e7

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

2
  1. v0.6.2最新Oct 14, 2026
  2. v0.6.0Sep 27, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。

其他 Check 整合