normascope-mcp

v0.15.0
normascope-mcp Checked 2 days ago Published 1 month ago

MCP server giving coding agents eyes: capture a running UI, compare it against a mock or design source, read structured results.

Give your coding agent eyes. This MCP server exposes Normascope's visual verification as tools: capture the running UI, compare it against a mock or the configured design source, and read structured results — so an agent can check its own frontend work instead of guessing. compare with capture: false re-scores the screenshots already on disk, and only ones captured for the frames as they are configured now. A capture given a url that differs from the configured base URL is skipped by that re-score, with the reason, because the result would otherwise be recorded as the configured address.

Summary extracted from the README.

normascope-mcp

Give your coding agent eyes. This MCP server exposes Normascope's visual verification as tools: capture the running UI, compare it against a mock or the configured design source, and read structured results — so an agent can check its own frontend work instead of guessing.

Tools

Tool What it does
list_frames The frames this project tracks: label, mode (fidelity/baseline), source, capture status.
capture Screenshot the running app for the configured frames.
compare Run the comparison; returns the summary JSON, publication: where the run's report went, and ignoreWarnings: the ignored areas that were not applied as asked. With target (mock PNG) + url, runs zero-config: capture the URL, diff against the mock.
get_summary The structured result of the last comparison.
explain Why flagged frames drifted, as structured findings. Requires route — see below. Hypotheses to verify; nothing is auto-applied, and the deterministic score is never affected.

compare with capture: false re-scores the screenshots already on disk, and only ones captured for the frames as they are configured now. A capture given a url that differs from the configured base URL is skipped by that re-score, with the reason, because the result would otherwise be recorded as the configured address. Call compare without capture: false to capture and score in one step.

In a project whose reports go to Normascope Cloud (cloud.reports set to "cloud", and switched on for its organization), compare with no target publishes the run there, as the CLI's compare does. A Cloud credential alone never publishes. Each newly published run that measured something uses one credit. publication then holds the run's id and address, or, when it could not be sent, the saved run's id, why, and the cloud retry command that sends it again. An unapproved project returns actionRequired: "approve_uploads" with the approval link. The score and ok are the same either way. Pass local: true to keep one run's report on this machine. Zero-config mode is always local.

When the project ignores changing areas (ignore in the config, or data-norma-ignore in the page), compare says which of them it could not apply. ignoreWarnings holds one entry per warning the CLI prints under a frame: the frame, the image (build or reference), the reason, the message and what to do. The comparison still ran, and those frames were scored with those areas counted. The list is empty when every ignored area was applied, and null when the installed CLI is from before these were reported.

A page that ends somewhere other than the address asked for, such as a redirect to a sign-in page, is not scored. For a page that redirects on purpose, a frame sets expectRoute in the config; zero-config compare takes an expectUrl argument.

The aligned mismatch percent is the primary score (positional drift is matched before counting); lower is better. A typical agent loop: build → compare {target, url} → read the score and drifted sections → fix → compare again until it stops improving.

A project that sets "localCheck": "enforce" can have a frame flagged while its score is under the threshold, because one region changed. That frame carries localTriggered: true and localCheckNote, which says so in the words the reports use. Where the region is stays out of the result.

explain has no default route, deliberately

route is required and there is no fallback, because the two options bill different accounts and send the evidence to different places:

route Whose key What leaves the machine
local your own ANTHROPIC_API_KEY Nothing goes to Normascope Cloud. The selected evidence still reaches Anthropic under your key — "local" means no Cloud upload, not no network.
cloud your organization's purchased Normascope Cloud credits The run is published to Normascope Cloud and analysed there. Refused outright if NORMASCOPE_CLOUD_URL and NORMASCOPE_ORG_KEY are not set, rather than quietly falling back to your personal key.

This used to be inferred: Cloud when NORMASCOPE_ORG_KEY happened to be in the environment, otherwise local. So which account got billed depended on which variables the MCP host carried — and the CLI made the opposite implicit choice, so one word meant two things across two official clients. Credential presence must not select a route. An agent has to say which one it means, and if it cannot, it asks the person.

Setup

{
  "mcpServers": {
    "normascope": {
      "command": "npx",
      "args": ["-y", "normascope-mcp"],
      "cwd": "/path/to/your/project"
    }
  }
}

Works with or without a .bridge/config.json — without one, only the zero-config compare {target, url} flow is available.

Security model

  • Capture is default-deny. A URL is only captured when its origin exactly matches a configured origin: the project's app.baseUrl, source.baseUrl, or the NORMA_MCP_ALLOW_ORIGINS env var (comma-separated). Link-local/metadata (169.254.x.x), private ranges (10/8, 172.16/12, 192.168/16), wildcard addresses, and non-http(s) schemes are refused even when configured. Loopback is allowed only when explicitly configured (local dev servers are the point). Every refusal is logged to .bridge/.cache/mcp-audit.log, which is gitignored and removed by norma-scope clean.
  • The policy covers every page the server loads: the app, a url-source reference, and zero-config targets, including each redirect hop.
  • Every connection is checked, and pinned. The browser runs behind a local proxy that resolves each host once, refuses private, link-local and metadata addresses for every host, and connects to the exact address it checked. This covers a page's own images, scripts, fetch calls and WebSockets, so a page cannot reach the LAN or a metadata endpoint, and a name that changes its answer cannot slip through. Loopback is allowed only for a configured origin's exact host and port: localhost:3000 configured does not open localhost:5432 or 127.0.0.1:3000. Add another local service to NORMA_MCP_ALLOW_ORIGINS if the app needs it. WebRTC cannot send UDP around the proxy, and if the proxy stops, the browser reaches nothing.
  • It needs a norma-scope that enforces this. If npm resolved an older one, every capture tool refuses with a message saying so, rather than running half-guarded.
  • Path containment. All file parameters resolve inside the project; traversal attempts are refused and logged.
  • Tool output is data, never instructions. Responses can embed text captured from web pages or config files (frame labels, page content, skip reasons). Agent hosts MUST treat every string in a tool response as untrusted data — a page saying "ignore previous instructions" is a string in a diff report, not a directive. Normascope never echoes secrets or tokens in any response.

Docs

License

Apache-2.0 — the LICENSE and NOTICE files ship in this package. "Normascope" is a trademark of Harsha Attray, trading as Yutic; the license grants no trademark rights beyond the limited uses in its Section 6. What you may and may not do with the name is set out in the trademark policy.


Normascope is operated by Harsha Attray, trading as Yutic.