
sitepulse
io.github.zaka337/sitepulse
Check a website's health: security headers, SEO, performance, accessibility and broken links.
Documentation
sitepulse
A quick health check for any website. One command (or one tool call from an AI assistant) fetches a page and tells you, with a score and a fix for each finding:
- Security: HTTPS, HSTS, Content-Security-Policy, clickjacking and MIME-sniffing protection, cookie flags, mixed content, post-quantum key exchange
- SEO: title, description, headings, canonical address, language, social tags, robots.txt, sitemap, structured data
- Performance: server response time, compression, page size, redirect chains
- Accessibility: alt text, form labels, link and button names, heading order, pinch zoom, landmarks
- Links: a sample of the page's links, checked for ones that are broken
It needs no browser and no account, makes a handful of requests (the page, robots.txt, the sitemap, a sample of links, and one TLS connection opened and closed to read the server's key exchange), changes nothing on the site, and finishes in a few seconds.
$ npx sitepulse example.com
sitepulse report: https://example.com/
(asked for https://example.com)
Score 68/100 (grade D) 15 passed, 11 to improve, 4 failed, 6 skipped 0.5 s
Security 57/100
pass Served over HTTPS: The page is served over HTTPS.
FAIL HTTP redirects to HTTPS: http:// serves the page without redirecting, so people can stay on the unencrypted version.
fix: Redirect all HTTP requests to HTTPS with a 301 or 308.
FAIL Strict-Transport-Security (HSTS): No Strict-Transport-Security header.
fix: Send `Strict-Transport-Security: max-age=31536000; includeSubDomains` on every HTTPS response.
warn Content-Security-Policy: No Content-Security-Policy header.
fix: Add a policy, starting from `default-src 'self'` and allowing only what the site really loads. ...
...
Use it
Command line
npx sitepulse https://your-site.com
npx sitepulse your-site.com --markdown > report.md # paste into an issue or a chat
npx sitepulse your-site.com --json # the whole report as data
npx sitepulse your-site.com --only security,seo # some categories only
npx sitepulse your-site.com --fail-under 80 # exit code 1 below a score (for CI)
npx sitepulse http://localhost:3000 --allow-private # your own dev server
| Option | Meaning |
|---|---|
--json | Print the whole report as JSON |
--markdown, --md | Print the report as Markdown |
--only <list> | Only these categories: security,seo,performance,accessibility,links |
--max-links <n> | How many links to try, 0 to 30 (default 12; 0 turns the link check off) |
--timeout <ms> | Longest wait for one request (default 8000) |
--fail-under <n> | Exit with code 1 if the score is below n |
--allow-private | Allow localhost and private-network addresses (see Safety) |
--list-checks | List every check |
--no-color | No colours (they are already off when the output is not a terminal) |
Exit codes: 0 ok, 1 the score is below --fail-under or the page could not be loaded, 2 a bad option or a refused address.
In CI
- name: Website health
run: npx sitepulse https://staging.your-site.com --fail-under 85
With an AI assistant (MCP)
sitepulse is also a Model Context Protocol server, so an assistant can check a site as part of a conversation ("is my staging site missing any security headers?"). It runs on your machine over stdio and offers two read-only tools: scan_website and list_checks.
Claude Code:
claude mcp add sitepulse -- npx -y sitepulse mcp
Claude Desktop (claude_desktop_config.json) and Cursor (.cursor/mcp.json):
{
"mcpServers": {
"sitepulse": { "command": "npx", "args": ["-y", "sitepulse", "mcp"] }
}
}
VS Code (.vscode/mcp.json):
{
"servers": {
"sitepulse": { "type": "stdio", "command": "npx", "args": ["-y", "sitepulse", "mcp"] }
}
}
scan_website returns the report as Markdown and as structured data (score, grade, per-category scores, and every problem with its fix). Its name in the official MCP Registry is io.github.zaka337/sitepulse.
As a library
import { scan, formatMarkdown } from "sitepulse";
const report = await scan("https://your-site.com", { maxLinks: 20 });
console.log(report.score, report.grade); // 87 "B"
for (const r of report.results) {
if (r.status === "fail") console.log(r.title, "-", r.fix);
}
console.log(formatMarkdown(report));
scan() returns a Report (typed, see dist/index.d.ts). It throws a ScanError with a code when the address itself is refused (blocked-address, bad-protocol, ...). A site that cannot be reached is not an exception: it comes back as a report with a failed "page loads" check, so a monitoring loop does not need a try/catch for ordinary outages.
What it checks
| Category | Checks |
|---|---|
| Security (12) | HTTPS, HTTP-to-HTTPS redirect, HSTS, Content-Security-Policy (and whether it is weak), nosniff, clickjacking protection, Referrer-Policy, Permissions-Policy, cookie flags, mixed content, post-quantum key exchange, server version disclosure |
| SEO (13) | Status 200, title, meta description, one h1, canonical, lang, viewport, Open Graph tags, noindex, robots.txt (and that it does not block everything), XML sitemap (found through robots.txt too), JSON-LD validity, favicon |
| Performance (4) | Time to first byte, compression, HTML size, redirect chain |
| Accessibility (6) | Image alt text, form labels, link and button names, heading order, pinch zoom not disabled, main landmark |
| Links (1) | A sample of the page's links, mostly its own: broken ones reported, sites that refuse robots (403, 429) reported as "could not be verified" rather than broken |
sitepulse --list-checks prints them all, and the description of each check says exactly what it looks at.
How the score works
Every check has a weight (HTTPS counts 10, a favicon counts 1). A pass earns all of its weight, a warning half, a failure none. A check that does not apply (no forms on the page, so nothing to label) is left out of the arithmetic instead of counting for or against. The score is points earned out of points possible, 0 to 100, for the whole scan and for each category. Grades: A from 90, B from 80, C from 70, D from 55.
The weights are opinions. They are all in one place per check (src/checks/), so changing what matters to you is a one-line edit.
The post-quantum check
Quantum computers that could break today's key exchanges do not exist yet, but traffic can be recorded now and decrypted later ("harvest now, decrypt later"). Current browsers therefore offer a hybrid key exchange, X25519MLKEM768 (the classic X25519 combined with ML-KEM-768, NIST FIPS 203), and a server that supports it picks it. The check opens one TLS 1.3 connection, sends the first message a browser sends (the hello, with that group first), reads which group the server picked in its first reply, and closes the connection. No handshake is completed and nothing is stored.
| What the server does | Result |
|---|---|
| Picks X25519MLKEM768 | pass |
| TLS 1.3, but a classic group (x25519, secp256r1, secp384r1) | warning, with the fix |
| No TLS 1.3 at all | warning (the hybrid needs TLS 1.3) |
| Answers a small hello but not a browser-sized one (about 2 KB, because it carries the post-quantum key share) | warning (some firewalls and old load balancers cut handshake packets that do not fit in one) |
| Does not answer, is not a TLS server, the page is not HTTPS, the host is an IP address, the port is not 443 | skipped, with the reason (a scan never fails because of this check) |
What a pass does and does not say: it says this server, answering this kind of hello, uses the hybrid key exchange. It does not say the site is "quantum safe". It looks at the key exchange only (the signatures on certificates are still classical on nearly every site; post-quantum signatures are only beginning to be deployed), at TLS over TCP only (not HTTP/3), and at the one server that answered (a CDN has many). A verdict is a snapshot: hosts change what they offer. The check weighs 2 points, so on a normal scan a warning costs under one point of the 0 to 100 score.
Safety
A tool that fetches whatever address it is given is a classic way to reach things you are not meant to reach (a cloud provider's metadata service, an admin panel behind a firewall). That is especially true when the address comes from a web form, or from an AI assistant that a hostile web page might be steering. So the fetching is the most carefully built part of this package, and it is tested by attack (test/guard.test.ts, test/fetcher.test.ts, and the refusal cases in the CLI and MCP tests).
By default it refuses:
- every scheme except
httpandhttps(file:,ftp:,gopher:,data:,javascript:), and URLs that carry a username or password - ports other than 80 and 443
- local and private names (
localhost,*.local,*.internal,*.corp,*.home.arpa, cloud metadata hostnames) - private, loopback, link-local, carrier-grade-NAT, multicast, documentation and reserved addresses, in IPv4 and IPv6, including the disguises:
2130706433,0x7f000001,017700000001,127.1,::ffff:127.0.0.1, NAT64 and 6to4 forms that wrap a private address
Two things make that more than a list of strings:
- The check happens at the moment of connecting. A name that looks public can resolve to a private address (and an attacker can change the answer between your check and your connection: "DNS rebinding"). The package resolves the name itself, refuses if any of the returned addresses is private, and connects to exactly the address it checked.
- Every redirect is checked again. At most 5 are followed, each one by hand, each through the same guard. A public page that redirects to
http://169.254.169.254/is refused.
Links found on a page are only probed if they pass the same guard, so a page cannot make the scanner touch an internal address by linking to it.
The post-quantum check is the one place the package opens a connection that is not an HTTP request: a raw TLS connection to the final page's host. It goes through the same guard. The name is resolved by the guarded lookup at every connection (every address must be public, and the socket connects to exactly an address that was checked), so a private name or address is refused before a single byte is sent. An IP address is never probed (the hello needs a name), a port other than 443 is refused unless you allow it, the whole probe has a time limit (5 seconds, both connections together), at most 20 KB are read, the socket is destroyed after the server's first reply, and the scan's own cancel signal is honoured. It is only made when the check is wanted, so --only seo makes no such connection. It is tested by attack in test/pqprobe.test.ts: names that resolve to a loopback, private, link-local or metadata address, or to a mix of public and private ones, are refused (a listening "tripwire" server on loopback counts any connection that slips through, and the count stays at zero), as are IP addresses, private names and other ports.
Also: responses are read up to a size cap, after decompression (a tiny "compression bomb" that unpacks to gigabytes is cut off); every request has a time limit and the scan has an overall budget; no cookies or credentials are ever sent; the scanner identifies itself honestly (sitepulse/0.1 (+https://github.com/zaka337/sitepulse)); and it never crawls: it fetches the one page you asked for plus robots.txt, the sitemap, /favicon.ico if the page declares none, a small sample of links, and (for the post-quantum check) opens one TLS connection to the site, two at most.
To scan a site you are developing, opt in: --allow-private, the allowPrivate option, or SITEPULSE_ALLOW_PRIVATE=1 in the environment of the MCP server. The MCP tools have no parameter for it: the person who configures the server decides, not the model.
What this does not protect against: you pointing the tool at someone else's public site. It is polite (a few requests, honest user agent), but only scan sites you have a reason to scan.
Limits (read before trusting a score)
- It reads the HTML the server sends. It does not run JavaScript. On a site that builds its page in the browser, the scan sees the empty shell: "no
h1", "no links" can be true of the HTML and false of what a visitor sees. - It does not measure rendering speed, Core Web Vitals, or layout. "Performance" here means server response time, compression and page size. For real user-facing numbers use Lighthouse or PageSpeed Insights.
- The accessibility checks are a small, reliable subset of WCAG (the kind a static scan can decide). Passing them does not make a site accessible; colour contrast, keyboard use and screen reader behaviour need a human and a browser.
- Time to first byte is measured from where the scan runs, once, so treat it as a hint.
- The link check is a sample (12 by default, 30 at most), not a crawl.
- It does not detect HTTP/2 or HTTP/3.
- The post-quantum check reads one TLS connection's first reply, so it describes the server that answered (not every server behind a CDN), only the key exchange (not certificates), and only TLS over TCP. The hello it sends carries a well-formed but random ML-KEM key, because it never completes a handshake, and is padded to a browser's size (about 2 KB, which crosses two TCP packets on an ordinary network path); a server that rejects such a key would be reported as having trouble with the larger hello.
- The checks encode common good practice. A site can have a good reason to deviate (an intentionally
noindexstaging site), so read a warning as "worth a look", not as an error.
Development
npm install
npm run check # type-check, run the tests, build
The tests run against a real local web server and the built command-line and MCP programs (the MCP tests drive the server with the official MCP client over stdio). Nothing in the test suite touches the internet.
Layout: src/net/guard.ts and src/net/fetcher.ts (the safe HTTP client), src/net/pqprobe.ts (the TLS key-exchange probe), src/checks/*.ts (each check is a pure function of a fetched page, so each is tested with made-up pages), src/scan.ts (fetches what the checks need, in parallel, under a time budget), src/score.ts, src/report.ts, src/cli.ts, src/mcp.ts.
License
MIT. By Zaka Ullah Waheed.
sitepulsenpm install sitepulse