Skip to main content
Glama
README.md
# f-seo

Zero-dependency technical SEO, AI search citation (GEO/AEO), and link-graph auditing toolkit for Node.js, CI pipelines, and Model Context Protocol (MCP) clients.

[Tiếng Việt](./docs/vi/README.md) · [Scoring Methodology](./docs/methodology.md) · [Next.js Templates](./templates/nextjs)

## Why `f-seo`?

Traditional search crawlers (`Googlebot`, `Bingbot`) execute JavaScript via headless browser pipelines, whereas major AI retrieval crawlers (`OAI-SearchBot`, `Claude-SearchBot`, `PerplexityBot`) inspect raw initial server HTML without running client bundles. A client-rendered SPA can pass basic browser checks while remaining invisible to citation-driven search engines.

`f-seo` audits the exact server payload and site discovery layer across five dimensions:

- **Technical & Semantic SEO** — `<title>`, meta descriptions, canonical/robots conflicts, `max-image-preview:large`, `hreflang` + `x-default`, sequential heading outlines, internal anchor quality, and Open Graph metadata.
- **Crawler & Transport Governance (BCO)** — Zero-JS static HTML parity, RFC 9309 `robots.txt` wildcard evaluation across search vs. model-training user-agents, `/sitemap.xml` (`<urlset>` and `<sitemapindex>`), `/llms.txt`, redirect hops, HSTS, back-button hijacking, and hidden prompt-injection / cloaking checks.
- **Answer & Generative Extraction (AEO / GEO)** — Question-phrased section headings, 40–60 word answer-first lead blocks, top-30% quantitative metric density, source attributions, publication freshness, and connected `@graph` JSON-LD validation (with deprecation checks for retired Google `HowTo` and `FAQPage` SERP features).
- **Experience & Agent Readiness (SXO / AXO)** — CLS image dimensions, LCP lazy-load traps, synchronous `<head>` scripts affecting INP, HTML5 landmarks, `Accept: text/markdown` + `Vary: Accept` negotiation, and token-efficiency ratios.
- **Site-Wide Graph Diagnostics** — Concurrent BFS crawling over live origins or static build directories (`dist/`, `out/`, `public/`) to catch broken internal links (`4xx`/`5xx`), orphan pages, duplicate titles/descriptions, H1 cannibalization, deep pages (`depth > 3`), and near-duplicate programmatic pages (`<60%` unique 4-grams).

## Installation

Requires **Node.js 20+** (uses built-in `fetch`, `node:test`, and ESM—zero runtime dependencies).

### As an Antigravity Plugin

```bash
# Install directly from GitHub
agy plugin install https://github.com/tanhaqn/f-seo

# Or install from a local clone
agy plugin install ./f-seo
```

Bundled plugin components:
- **MCP Server** (`f-seo_toolkit`) — `audit_page`, `crawl_site`, `extract_markdown`, `generate_site_kit`, `list_crawlers`
- **Skill** (`/seo-audit`) — Guided audit and remediation workflow
- **Agent** (`seo-auditor`) — Sandboxed technical SEO & link-graph specialist
- **Rule** (`seo-guardrails`) — Glob-scoped guardrails for `robots.txt`, `sitemap.xml`, `llms.txt`, and page layouts

### Standalone MCP Server (Claude Code, Cursor, VS Code, Windsurf)

```json
{
  "mcpServers": {
    "f-seo": {
      "command": "node",
      "args": ["/absolute/path/to/f-seo/scripts/mcp-server.mjs"]
    }
  }
}
```

### CLI Usage

```bash
# Audit a live URL or local HTML file / build directory
node ./bin/f-seo.js audit https://example.com
node ./bin/f-seo.js audit ./dist/index.html --format md --out ./audit-report.md

# Enforce a quality gate in CI (exits non-zero if score < 85 or any P0 blocker exists)
node ./bin/f-seo.js audit https://staging.example.com --fail-under 85

# Crawl a live site or static export directory for broken links, orphans, and cannibalization
node ./bin/f-seo.js crawl ./dist --max-pages 50 --fail-under 85
node ./bin/f-seo.js crawl https://example.com --max-pages 30 --concurrency 4

# Preview clean Agent Markdown extraction and token savings
node ./bin/f-seo.js markdown https://example.com --out ./page.md

# Scaffold robots.txt, llms.txt, @graph JSON-LD, and an IndexNow key
node ./bin/f-seo.js init --domain https://example.com --brand "Acme" --type saas --out ./public

# Push updated URLs via IndexNow
node ./bin/f-seo.js indexnow --host example.com --key <KEY> --urls https://example.com/changelog

# Inspect the crawler capability matrix
node ./bin/f-seo.js bots
```

## Example CLI Output

```text
f-seo audit  https://example.com/guides/ssr-architecture
Status: HTTP 200 (142ms TTFB)  |  Score: 98/100 (A+)
Summary: 0 critical (P0), 0 high (P1), 1 medium (P2), 13 passed

Pillars:
  SEO Foundations                  24.5/25  (98%)
  Bot & Crawl Infra (BCO)            20/20  (100%)
  Answer Engine (AEO)                15/15  (100%)
  Generative & AI (GEO/AIO)          25/25  (100%)
  Experience & Agents (SXO/AXO)    13.5/15  (90%)

Metrics: 612 words (~820 tokens, 24.6% text/HTML) | H1:1 H2:3 | Answer-first:3 | Tables:1 | JSON-LD:[Organization, WebSite, SearchAction, Article, Person]
```

## Programmatic API

```js
import { auditTarget, crawlSite, toAgentMarkdown } from 'f-seo';

const { scored, parsed } = await auditTarget('https://example.com');
console.log(scored.totalScore, scored.grade);

const graph = await crawlSite('./dist', { maxPages: 50 });
console.log(graph.siteHealthScore, graph.issues.orphanPages);
```

## GitHub Actions CI Gate

```yaml
- name: Run SEO & link-graph gate
  run: node ./bin/f-seo.js crawl ./dist --max-pages 100 --fail-under 85
```

## Development

```bash
npm run check   # Validates plugin manifest & runs the test suite
npm test        # Runs unit, HTTP crawler, MCP framing, and CLI integration tests
```

## License

[MIT](./LICENSE)