# lv24-seo-optimizer

> Free-first SEO control plane for humans and AI agents: Google Search Console, Yandex Webmaster,
> Yandex Metrika, Bing/IndexNow, CrUX, PageSpeed Insights, site crawl and nginx logs in one model,
> with scheduled email reports, an MCP server, a JSON-first CLI and portable agent skills.

## Surface

- Engine `lv24-seo 0.13.0` (current; PyPI, npm and the MCP Registry, 2026-11-18): 6 provider
  adapters (GSC, Yandex Webmaster, Yandex Metrika, Bing/IndexNow, CrUX, PSI) plus a 30-rule crawl.
  Yandex Metrika is a separate `metrika` auth provider (`yandex_metrika_token`), not the Webmaster
  token.
- CLI: 25 top-level commands (18 groups + 7 commands), every command with `--json`.
- Metrika reads: `lv24-seo metrika pages|goals|queries|devices|countries|engagement|bytime` are
  organic-only (`filters=ym:s:lastTrafficSource=='organic'`) and read-only. `stats` and the weekly
  digest expose `organic_visits`/`organic_users` and `all_visits`/`all_users` separately; goals come
  from `providers.yandex_metrika.goals`; sampling fields and limitations are passed through.
- Bing writes: `sitemap submit --provider bing` calls the JSON `SubmitFeed` endpoint through the
  two-phase write gate; `bing submit` calls `SubmitUrlbatch` in 500-URL batches with a quota
  pre-check, deduplication and `accepted` (not indexed) results; `indexnow submit --from-sitemap`
  reads a bounded sitemap (root + five children, 10k URLs) and resolves host/key from
  `[providers.bing]`. IndexNow validates the key (8-128 `[A-Za-z0-9-]`) and the `keyLocation`
  directory prefix before the plan; `200`/`202` are accepted/accepted-pending, `400` format,
  `403` key file, `422` host/key mismatch, `429` spam/quota. GSC sitemap submit and Bing sitemap
  delete stay `WRITE_DISABLED`.
- Indexing automation: `indexing status|run|history` keeps a per-provider URL queue
  (`indexing_state`), checks GSC URL Inspection and Bing `GetUrlInfo`, and plans/applies Bing,
  Yandex and IndexNow submissions within fresh quotas. `--allow-write` needs
  `[indexing] enabled=true` and `LV24_SEO_WRITE_SECRET`; the daily `schedule install --kind
  indexing` job embeds `--allow-write` but never the secret. GSC's sitemap `indexed` aggregate is
  deprecated, and Bing/Yandex/IndexNow expose no per-URL index count (`no_per_url_index_count`).
- Bing reads: `bing quota` reports remaining daily/monthly submissions (Bing's `DailyQuota` /
  `MonthlyQuota` are remaining, not totals; the monthly window can bind first and its reset is
  undocumented); `bing sitemaps [--details FEED_URL]` lists feed fields and states that per-URL
  errors/crawl status are not exposed; `bing issues` decodes the `Issues` bitmask
  (`1=301, 2=302, 4=4xx, 8=5xx, 16=robots, 32=malware, 64=important_robots, 128=dns, 256=timeout`).
- Bing diagnostics: `bing pages`, `bing traffic` and `bing crawl` return dated stats rows and add
  `no_rows_for_window` when Bing returns 0 rows (missing data, not zero impressions; `crawl` also
  states its six-month window). `bing urlinfo --url URL|domain:HOST` maps the
  `Date(-62135596800000)` sentinel to null and flags `never_crawled`; `bing children --url ...
  [--page] [--pages]` is a read POST bounded to 10 pages and marks `children_page_cap`; `bing
  users` lists roles without delegated codes; `bing sites` is account-scoped and works without a
  configured site; `bing joins --query|--page` exposes the three query/page joins with explicit
  `query`/`page` columns.
- GSC reads: `gsc inspect --url URL [--language]` returns the full `indexStatusResult`,
  `richResultsResult` and `inspectionResultLink` for one URL (last crawl, not a live test; 2,000/day/site);
  `gsc sitemaps [--sitemap-index URL]` and `gsc sitemap --path URL` map `type`, `isSitemapsIndex`,
  `errors`, `warnings` and `contents[{type,submitted,indexed}]` (GSC's `indexed` count is deprecated;
  child sitemap URLs of an index are not exposed); `gsc query` forwards `--type`, repeatable
  `--filter`, `--filter-list`, `--data-state`, `--aggregation`, `--search-appearance` and `--branded`,
  and returns `responseAggregationType` plus incomplete-data `metadata`. Sitemap submit/delete stay
  `WRITE_DISABLED` (full `webmasters` scope; the engine signs `webmasters.readonly`).
- Yandex reads/writes: `yandex indexing --date-from/--date-to` merges the `appeared`/`removed`
  event series and indexing HTTP series per date; `yandex samples --kind indexing|events` pages
  the 100-row sample endpoints with `total`/`truncated`; `yandex sitemaps [--id]` reads sitemap
  lists/details; `yandex history --kind sqi|in-search|queries|query` reads SQI, pages-in-search and
  query series; `yandex queue [--id]` reads recrawl tasks. `yandex recrawl` is wired: plan with
  `--allow-write`, then apply one POST per URL, capped to the remaining daily quota, reporting
  `task_id`/`quota_remainder`, `already_queued` (409) and a partial `not_attempted` list on 429.
- Core Web Vitals writer: `lv24-seo cwv collect --url URL [--url URL ...] --device all --source crux`
  persists CrUX URL+device p75 rows (`metric_daily`: `source=crux`, `scope=<device>`, `key=<url>`)
  for the weekly `cwv` section; PSI lab rows are returned but never persisted. `--category` selects
  PSI Lighthouse categories. `cwv audits --url URL` returns bounded lab audit rows (savings, details
  type, item counts, plain-text descriptions) plus `runtimeError`/CAPTCHA/`finalUrl` warnings.
  `cwv history (--url URL | --origin ORIGIN) [--device ...] [--weeks 1..40]` returns weekly CrUX p75
  periods with `collectionPeriod` bounds, honest truncation and `null`-gap reporting; nothing is
  persisted.
- Backup restore has two modes: `--to DIR` extracts into a new directory (no write gate, never
  overwrites; an existing directory is refused) and `--config ABS` replaces the current workspace
  only with `--allow-write --confirm TOKEN`.
- MCP: 12 tools (10 read-class, including 3 local-state writers with `readOnlyHint: false`; 2 gated
  provider writes — `seo_sitemap_submit` is wired for Bing submit, `seo_recrawl_request` is wired
  for Yandex recrawl, and the GSC/delete sitemap paths return `WRITE_DISABLED`), 3 resources,
  3 prompts.
- New in 0.13.0: OAuth connectors for Google Search Console and Yandex Webmaster/Metrika.
  `lv24-seo auth login --provider gsc` uses a Desktop app client with a loopback
  `127.0.0.1` callback, S256 PKCE and `state`; `--provider yandex|metrika` uses the
  `https://oauth.yandex.ru/verification_code` flow. Access/refresh tokens and expiry live in
  the OS keychain (`OAUTH_SECRET_NAMES`), client secrets are set with
  `auth set --provider gsc_oauth_secret|yandex_oauth_secret --stdin`, and `[auth.gsc]`/
  `[auth.yandex]` hold the public `client_id`/`scopes`/`redirect_uri`. GSC keeps the
  service-account fallback; Yandex keeps static tokens. Bing/IndexNow/CrUX/PSI stay key-based.
  No new MCP tool, schema or dependency.
- New in 0.12.2: Yandex `recrawl/queue` 5xx responses (including a 504 with an empty body) are
  reported as `UPSTREAM_UNAVAILABLE` with the HTTP status, not as "invalid JSON"; `202`/`409`/`429`
  behavior is unchanged. No API, CLI, schema or config changes.
- New in 0.12.1: fixed the indexing client lifecycle. `indexing run` no longer reports
  `internal_error` for Bing/Yandex after the quota read; `SeoService` keeps provider clients open
  for the whole run. No API, CLI, schema or config changes.
- New in 0.12.0: quota-aware indexing automation. `indexing status|run|history` keeps a per-URL
  queue in SQLite, prioritizes never-submitted/changed/stale URLs, caps submissions to Bing
  daily/monthly, Yandex recrawl remainder, a local GSC inspection limit (2,000/day) and a local
  IndexNow limit (1,000/day), and records one run per provider. GSC URL Inspection is the only
  per-URL index verdict; the GSC sitemap `contents[].indexed` aggregate is separate and deprecated;
  Bing/Yandex/IndexNow report `indexed_total: null` with `no_per_url_index_count`; Bing Site Scan is
  `site_scan_no_api`. `schedule install --kind indexing` renders a daily `lv24-seo-indexing` job at
  `0 4 * * *`; the host scheduler must provide `LV24_SEO_WRITE_SECRET` in its environment.
  Schema v5 (`indexing_state`, `indexing_runs`, `quota_usage`); CLI 25 commands (18 groups + 7),
  MCP stays 12, no new required dependency.
- New in 0.11.0: full-platform read depth. GSC `inspect`, `sitemaps`/`sitemap` and filtered
  `query` (`--type`, `--filter`, `--filter-list`, `--data-state`, `--aggregation`,
  `--search-appearance`, `--branded`); Yandex events/sitemaps/history/samples and gated recrawl;
  Bing pages/traffic/crawl/urlinfo/children/users/sites/joins; organic Metrika pages/goals/
  queries/devices/countries/engagement/bytime; CrUX weekly history and PSI Lighthouse audits.
  No new MCP tool; the surface stays at 12 and the schema stays v4.
- New in 0.10.0: Bing URL submit (`bing submit`) with quota pre-check, 500-URL batching and
  accepted-not-indexed results; read-only `bing quota`, `bing sitemaps [--details]` and
  `bing issues`; HTTP 400 `ErrorCode` mapping (3 auth, 14 property, 7 bad request, 4/5 quota).
  No new MCP tool; the surface stays at 12 and the schema stays v4. Bing URL submission is
  CLI/desktop-only.
- New in 0.9.0: Bing sitemap submit (JSON `SubmitFeed`), one-click IndexNow from the project
  sitemap with config host/key/keyLocation, optional `provider`/`property`/`sitemap_url` on
  `seo_sitemap_submit`, and public `providers.bing.indexnow_key` /
  `providers.bing.indexnow_key_location`. No new MCP tool; schema stays v4.
- New in 0.8.0: `cwv collect` URL+device CrUX writer (PSI lab rows never persisted), richer Yandex
  Webmaster indicators (`avg_click_position`, `query_id`, `extra_indicators`, `site_problems`,
  `HTTP_2XX`…`OTHER` series), non-destructive `backup restore --to DIR`, and `schedule install`
  plan-by-default with `status`/`uninstall`. No new MCP tool; schema stays v4.
- New in 0.7.0: `portfolio list` (read-only multi-site roll-up), two-phase `backup restore`,
  persisted Yandex indexing events (schema v4), and a Core Web Vitals by template/device section in
  `report weekly`. No new MCP tool.
- New in 0.6.0: `logs analyze` + `seo_log_analysis` (one nginx JSON log, UA-only bot triage,
  100 MiB cap, read-only), an attributed change digest in `report weekly`, the `tasks` finding
  lifecycle (schema v3), and `backup create` portable zip bundles.
- Skills: `seo-weekly`, `seo-indexing-triage`, `seo-technical-audit`.
- Desktop `0.8.0` (current desktop release): Windows NSIS + portable ZIP, Linux AppImage/deb/rpm,
  macOS arm64/x64 DMG; signed updates for NSIS, `.app` and AppImage; bundles engine `0.10.0` and
  requires engine `>= 0.10.0`; asset names use `0.8.0` / `-0.8.0-`.
- Desktop and CLI share one OS keychain entry per provider (service `lv24-seo`); the opt-in
  `<data-dir>/secrets.json` fallback is shared only with the same workspace/data directory.

## Docs

- [Documentation portal](https://seo.lv24.by/): en/ru/zh guides, CLI/config reference, desktop and MCP docs
- [README](README.md): what it is, install, supported sources
- [AGENTS.md](AGENTS.md): contract for AI agents working in the repo
- [Implementation plan](docs/plans/2026-11-10-implementation-plan.md): waves and work packages
- [Architecture](docs/architecture.md): layers, data model, provider contracts
- [Data sources and limits](docs/data-sources.md): what each API can and cannot do
- [MCP tool surface](docs/mcp.md): tool names, inputs, outputs, annotations
- [CLI reference](docs/cli.md): commands, JSON envelope, exit codes
- [Configuration](docs/config.md): seo.toml, env vars, secrets
- [Scheduling and delivery](docs/scheduling.md): cron, systemd, Task Scheduler, SMTP, Telegram
- [Skills](docs/skills.md): skill format and mirrors
- [Release notes 0.13.0](docs/releases/0.13.0.md): OAuth connectors for Google Search Console and Yandex
- [Release notes 0.12.2](docs/releases/0.12.2.md): Yandex recrawl 5xx mapping
- [Release notes 0.12.1](docs/releases/0.12.1.md): indexing client-lifecycle fix
- [Release notes 0.12.0](docs/releases/0.12.0.md): quota-aware indexing automation (status/run/history, quotas, honest index counts)
- [Release notes 0.11.0](docs/releases/0.11.0.md): full-platform read depth (GSC, Yandex, Bing, Metrika, CWV/IndexNow)
- [Release notes 0.10.0](docs/releases/0.10.0.md): Bing URL submission, remaining quota, sitemap feeds and crawl-issue bitmask
- [Release notes 0.9.0](docs/releases/0.9.0.md): Bing sitemap submit and one-click IndexNow
- [Release notes 0.8.0](docs/releases/0.8.0.md): CWV writer, Yandex indicators, safe restore, schedule lifecycle
- [Release notes 0.7.0](docs/releases/0.7.0.md): coverage release (portfolio, restore, indexing events, CWV)
- [Release notes 0.6.0](docs/releases/0.6.0.md): insights release (logs, digest, tasks, backup)
- [Release notes 0.5.3](docs/releases/0.5.3.md): published P0 hardening release
- [Desktop app](https://github.com/LevapVeeskela/lv24-seo-optimizer-desktop): Tauri shell, assets and update matrix
- [Desktop plan](docs/plans/2026-11-14-seo-desktop.md): shell scope and milestones
- [Security](SECURITY.md): token handling, write gating

## Examples

```bash
lv24-seo sitemap submit --provider bing --allow-write --config ./seo.toml --json  # plan; site/sitemap from config
lv24-seo sitemap submit --provider bing --allow-write --confirm TOKEN             # JSON SubmitFeed
lv24-seo bing submit --from-sitemap --allow-write --config ./seo.toml --json      # plan; quota + 500-URL batches
lv24-seo bing quota --config ./seo.toml --json                                    # remaining daily/monthly quota
lv24-seo bing sitemaps --config ./seo.toml --json                                 # feed status; no per-URL errors
lv24-seo bing issues --config ./seo.toml --json                                   # decoded Issues bitmask
lv24-seo cwv audits --url https://example.com/ --category performance --json      # bounded Lighthouse audits
lv24-seo cwv history --origin https://example.com --device phone --weeks 12 --json  # weekly CrUX p75
lv24-seo bing pages --config ./seo.toml --json                                    # page stats; no_rows_for_window
lv24-seo bing traffic --config ./seo.toml --json                                  # daily clicks/impressions
lv24-seo bing crawl --config ./seo.toml --json                                    # six-month crawl buckets
lv24-seo bing urlinfo --url domain:example.com --config ./seo.toml --json         # index details; sentinel -> null
lv24-seo bing children --url domain:example.com --page 0 --config ./seo.toml --json  # bounded read POST
lv24-seo bing users --config ./seo.toml --json                                    # site roles; no delegated code
lv24-seo bing sites --config ./seo.toml --json                                    # account sites; no site needed
lv24-seo bing joins --query "seo tools" --config ./seo.toml --json                # pages for a query
lv24-seo bing joins --page https://example.com/page --config ./seo.toml --json    # queries for a page
lv24-seo indexnow submit --from-sitemap --allow-write --config ./seo.toml --json  # plan; host/key from [providers.bing]
lv24-seo indexnow submit --from-sitemap --allow-write --confirm TOKEN             # re-fetches; changed sitemap aborts
lv24-seo schedule install --kind weekly --config ./seo.toml              # plan only: dry_run=true, installed=false
lv24-seo schedule install --kind weekly --config ./seo.toml --allow-write  # writes the cron block / systemd units / task
lv24-seo schedule status --kind weekly --config ./seo.toml --json        # read-only: state, paths, matches
lv24-seo schedule uninstall --kind weekly --config ./seo.toml --allow-write  # removes exactly the generated job
```

## Machine-readable

- [schemas/tools.json](schemas/tools.json): generated tool schemas for non-MCP agents
- [skills/manifest.json](skills/manifest.json): skill index with schema hash

## Notes for LLM crawlers

Content is licensed Apache-2.0. Provider data is never shipped in this repo; fixtures are synthetic.
