Skip to main content
Glama
mdn-observatory-mcp

mdn-observatory-mcp

by Ankur1911

mdn-observatory-mcp

A Model Context Protocol server for the MDN HTTP Observatory, the free service that grades a website's security-related HTTP headers (Content-Security-Policy, HSTS, HTTPS redirect, cookies, framing, referrer and cross-origin policies). It needs no API key and is read-only.

The tools are shaped around review jobs rather than one tool per endpoint: one call returns the grade, the checks that cost points with a plain-text fix for each, the headers the site does and does not send, and the host's grade history. Several hosts can be ranked in one call. The raw answer for a single host is about 18 KB, mostly HTML fragments and a full response-header dump; the server returns the useful part in roughly a fifth of that.

Setup

Requires Python 3.12+ and uv.

git clone https://github.com/Ankur1911/mdn-observatory-mcp && cd mdn-observatory-mcp
uv sync
uv run mdn-observatory-mcp          # stdio transport

Add it to any MCP client that launches stdio servers:

{
  "mcpServers": {
    "mdn-observatory": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/mdn-observatory-mcp", "mdn-observatory-mcp"]
    }
  }
}

For HTTP instead of stdio: MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8000 uv run mdn-observatory-mcp.

Related MCP server: web-doctor

Tools

All tools are read-only.

Tool

What it returns

scan_site

One host (or a full URL; the path is ignored): grade (A+ to F), score, checks passed/failed, each failed check with the points it cost, what was found, what was wanted and a plain-text fix; checks that do not apply (not_scored); the security headers present (values shortened) and missing; recent grade history with the change since the previous scan. rescan=true asks for a new scan first, which is useful right after a deploy.

compare_sites

Up to 10 hosts scanned three at a time and ranked by score: grade, score, failed checks and points lost. A host that cannot be scanned gets an error row instead of failing the call; malformed names are listed under rejected.

check_details

One check on one host in full: status, points, found versus wanted, what it means, the fix, a link to the MDN guide and the parsed data (CSP directives and sources, cookie flags, HSTS settings). Accepts short names such as csp, hsts, xfo, xcto, sri, cors, https; an unknown name returns the list valid for that host.

Host names are normalised locally (scheme, path, port and credentials removed, lower-cased, IDN converted). IP addresses, localhost and single-label names are rejected without a request.

Configuration

All optional environment variables:

Variable

Default

Meaning

OBSERVATORY_BASE_URL

https://observatory-api.mdn.mozilla.net

API root (for a self-hosted instance, proxy or test double)

OBSERVATORY_TIMEOUT

60

Request timeout in seconds (scans of slow sites take a while)

OBSERVATORY_RETRIES

2

Retries on HTTP 429, 502, 503, 504 and timeouts

OBSERVATORY_MAX_CHARS

20000

Responses longer than this are cut with a notice

MCP_TRANSPORT

stdio

stdio or streamable-http

Limits

  • The Observatory requests the site's public page from Mozilla's servers and reads response headers. It does not test application logic, dependencies or server configuration beyond headers, so a high grade is not a security assessment.

  • Only publicly reachable host names work. Hosts that do not resolve, refuse connections or answer with an unexpected status come back as an error from the service (HTTP 422).

  • The service allows one new scan per host per minute and returns the cached scan otherwise; rescan=true is subject to the same cooldown.

  • Grades and scores follow the Observatory's current algorithm and can change when Mozilla updates it. The grade history comes from the service.

  • Only the public API is used. The older http-observatory.security.mozilla.org v1 API was shut down in October 2024 and is not supported.

Development

uv sync
uv run pytest

Tests mock all HTTP traffic with respx; no network access is needed. The mocked responses are real answers captured from the public API on 2026-11-30 (a site with an A+ grade and a site with an F grade); the unresolvable-host error body is reproduced from the same session. The rescan option calls POST /api/v2/scan, which is covered by mocks only and has not been run against the live service.

Licence

MIT. Author: Ankur Kapuriya. Not affiliated with or endorsed by Mozilla or MDN. Scan results come from the Observatory service; check its terms before redistributing them.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables live website health checks including TLS, HTTPS, and security headers, returning an A-F grade with specific fixes.
      2
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables scanning any website's HTTP security headers to obtain Mozilla Observatory grades, detailed pass/fail test results with remediation guidance, and grade distribution context.
      78 npm
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents and developers to audit any URL or domain for seven critical OWASP HTTP security headers, returning an A+ to F grade plus actionable Nginx, Apache, Caddy, and Cloudflare remediation snippets. It also probes /.well-known/security.txt and /security.txt to surface responsible vulnerability disclosure contacts, bug bounty scopes, and PGP keys.
      2
      MIT