README.md
# SEO Audit (AgentRove native agent)
On-page SEO hygiene checks for pages **you own**. Give it the HTML of your pages and get a report with
rule ids, severities and metrics per page, plus duplicate titles and descriptions across pages. An
optional fetch tool downloads pages, but only over https from hosts you list in `owned_hosts`.
The report checks markup against common published guidelines. It does not measure, predict or
guarantee rankings or traffic, and it does not crawl or fetch arbitrary sites.
- ID: `agentrove.seo-audit` · version 0.2.2 · MIT
- Published by AgentRove (provisional, configurable name). Package identifiers keep the agentrove prefix for compatibility.
- Runtime: Node.js 20 or newer, no npm dependencies
- Permissions: no filesystem access by tools, no credentials; network only in `fetch_pages`, limited to
the hosts you pass in `owned_hosts` for that call
- External costs: none
## Tools
| Tool | What it does | Side effects |
| --- | --- | --- |
| `audit_html` | Audits HTML you supply: one page (`html`, optional `url_or_path`) or up to 200 (`pages: [{url_or_path, html}]`). `site_host` tells internal from external links when pages are given as paths. `thresholds` overrides the guideline numbers. | none |
| `fetch_pages` | Downloads up to 20 `https://` URLs whose host is listed (exactly) in `owned_hosts`, follows redirects only within those hosts (max 5), caps each page at `max_bytes` (default 2 MB), reads `X-Robots-Tag`, and audits the HTML (or returns it with `audit: false`). | external_read |
### Rules
| Rule | Severity | Check |
| --- | --- | --- |
| `html-empty` | error | No HTML supplied |
| `title-missing` / `title-empty` | error | No `<title>`, or an empty one |
| `title-too-short` / `title-too-long` | warning | Outside 30–60 characters (configurable) |
| `title-multiple` | warning | More than one `<title>` |
| `title-duplicate` | warning | Same title as another audited page |
| `meta-description-missing` / `-empty` / `-multiple` | warning | `<meta name="description">` absent, empty, or repeated |
| `meta-description-too-short` / `-too-long` | notice | Outside 70–160 characters (configurable) |
| `meta-description-duplicate` | notice | Same description as another audited page |
| `h1-missing` | error | No `<h1>` |
| `h1-multiple` / `h1-empty` | warning | More than one `<h1>`, or one without text |
| `heading-first-not-h1` | notice | First heading is not an `<h1>` |
| `heading-level-skip` | warning | A heading jumps more than one level down (e.g. h2 → h4) |
| `img-alt-missing` | warning | `<img>` without an `alt` attribute (`alt=""`, `role="presentation"` and `aria-hidden="true"` count as decorative) |
| `canonical-missing` / `canonical-relative` / `canonical-cross-host` | notice | No canonical link; relative canonical; canonical on another host |
| `canonical-multiple` / `canonical-invalid` | warning | Conflicting or unusable canonical links |
| `canonical-not-https` | warning / notice | Canonical uses `http://`: a warning when the page URL is known to be https, otherwise a notice |
| `canonical-other-url` | notice | Canonical points to a different URL on the same site (trailing slash, `www.` and `#fragment` ignored); expected for duplicates and pagination, otherwise a mistake. Needs an absolute `url_or_path`, or a `/path` plus `site_host` |
| `robots-noindex` | warning | `noindex`/`none` in robots meta (or `X-Robots-Tag` when fetched) |
| `robots-nofollow` | notice | `nofollow`/`none` in robots directives |
| `og-missing` / `og-incomplete` | notice | No Open Graph tags, or some of og:title, og:type, og:image, og:url, og:description missing |
| `lang-missing` / `viewport-missing` | notice | No `<html lang>`; no viewport meta |
| `word-count-low` | notice | Fewer visible words than `min_words` (default 300) |
| `link-javascript` / `links-internal-none` | notice | `javascript:` links; no internal links |
| `link-no-text` | notice | Links with no anchor text: no words, no image `alt` and no `aria-label`/`title` (`#`, `mailto:`, `tel:` and `javascript:` links are ignored) |
| `link-generic-text` | notice | English generic anchor text such as "click here", "read more", "learn more", "here" |
Metrics per page: title and length, meta description and length, h1 count, heading outline, visible
word count (excluding `<head>`, scripts, styles, templates, SVG, `<noscript>`), image counts (total,
missing alt, empty alt), link counts (internal / external / other such as `mailto:` and `#` / nofollow),
canonical, robots, Open Graph values, `lang`, viewport, and the host used for link classification
(`www.` is treated as the same site).
## Typed IO (AgentRove composition)
| Name | Type | Where |
| --- | --- | --- |
| input `html` | `text` | `audit_html.html` |
| input `urls` | `url_list` | `fetch_pages.urls` |
| output `report` | `seo_report` | the whole `audit_html` result, or `fetch_pages` → `report` |
## Usage (Node CLI)
Audit saved HTML files (only reads the files you name):
```sh
node -e "const fs=require('node:fs');const pages=process.argv.slice(1).map(f=>({url_or_path:f,html:fs.readFileSync(f,'utf8')}));fs.writeFileSync('input.json',JSON.stringify({pages,site_host:'example.com'}))" index.html about.html
node bin/cli.js audit_html --input input.json
```
Fetch and audit pages on your own site:
```sh
node bin/cli.js fetch_pages --json '{"urls":["https://www.example.com/","https://www.example.com/about"],"owned_hosts":["example.com","www.example.com"]}'
node bin/cli.js --help
```
`--input -` reads the input JSON from stdin instead of a file. Output is JSON on stdout; errors are JSON on stderr with exit code 1, for example
`{"error":"network_denied","message":"Refusing to fetch: Host other.example is not in owned_hosts"}`.
On Windows, `--input` files avoid shell quoting problems.
## Use as an MCP server (stdio)
`bin/mcp.js` implements MCP over stdio (`initialize`, `tools/list`, `tools/call`). Register it with an
absolute path, for example in Claude Code:
```sh
claude mcp add seo-audit -- node /absolute/path/to/seo-audit/bin/mcp.js
```
or in a project `.mcp.json`:
```json
{ "mcpServers": { "seo-audit": { "command": "node", "args": ["/absolute/path/to/seo-audit/bin/mcp.js"] } } }
```
`claude-code/SKILL.md` is an optional Claude Code skill that drives the CLI instead.
**Status:** tested with Node.js (unit tests with an injected fetch, `tests/netguard.test.ts` for the IPv6
address checks and connect-time pinning with fake resolvers, plus MCP message handling and CLI/MCP stdio
runs on synthetic pages). This version (0.2.2) is not yet verified inside Claude Code by AgentRove. The
fetch tool has not been exercised against live sites in AgentRove's tests.
## Limitations
- Static HTML only: content rendered by JavaScript is invisible to this audit, and scripts are never run.
- The HTML scanner is tolerant but simpler than a browser parser (no implied-end-tag rules beyond the
basics); unusual markup can skew heading or word counts.
- `link-generic-text` only knows a short list of English phrases.
- Checks are guideline-based hygiene. It does not assess content quality, backlinks, speed, Core Web
Vitals, structured data validity, hreflang, sitemaps or robots.txt.
- `owned_hosts` is your declaration that you own or administer those hosts; the agent cannot verify
ownership. Hosts match exactly (list `www.` and subdomains separately); ports are not restricted.
- IP addresses, `localhost` and local/intranet host names are refused in `owned_hosts`, and hosts must
resolve to public addresses (IPv6 forms of private addresses included), checked again at connect time
so the address used is the one checked; intranet or staging sites on private networks cannot be
fetched (audit their saved HTML with `audit_html` instead).
- Fetches are sequential, at most 20 per call, 15 s timeout each (SDK default), no cookies or auth.
## Security and privacy
See [SECURITY.md](SECURITY.md).
## License
MIT, see [LICENSE](LICENSE).