serpkin
v0.2.29
Published
SEO for coding agents: connects Claude Code, Cursor or Codex to Serpkin's ranked SEO missions, checks previews and local builds for SEO regressions, and uploads your route map.
Maintainers
Readme
serpkin
The SEO teammate for Claude Code, Codex and Cursor. Serpkin reads your site and your real search data, picks the one SEO fix worth doing next, and hands it to your coding agent with target pages and mapped source files where supported. After you ship, it checks the preview and measures whether the change helped.
npx serpkinWebsite · Guides · Free SEO checker · Claude Code · Cursor · Codex
Quick start
- In your website's repository, run
npx serpkin. It signs you in, connects your agent, registers the site and waits for its automatically queued initial audit. - Ask your agent: "What should I do for SEO?" Without a plan yet, setup shows the preview's first mission and offers the 7-day trial's checkout; after you start it, ask "Do the next Serpkin mission".
- Your agent implements the mission. Before you merge, run
npx serpkin check <preview-url>to catch SEO regressions.
Requires Node 22 or newer. No dependencies. Builder and Pro start with a 7-day free trial (card required, no charge until day 8); see pricing. Without a plan you can add one site and see its 6-page preview audit and the first mission it found; missions, scans and monitoring return TRIAL_REQUIRED with a checkout link. The free SEO checker needs no account.
What you get
- One mission at a time, chosen from a crawl of your site and, once connected, your Google Search Console data. Not a list of 200 warnings.
- Patch-ready instructions: the files to edit (from your route map), code snippets for metadata, sitemaps, redirects and structured data, and a definition of done.
- A preview check that fails on regressions such as a new
noindex, a removed title or canonical, a broken sitemap, or leftover draft text ([TODO], lorem ipsum, an unrendered{{ template }}). - Results: Serpkin verifies the fix on production and reports what changed in search afterwards.
| Agent | How it connects |
| ----------- | -------------------------------------------------------------------- |
| Claude Code | Plugin with a skill, slash commands and hooks, or a plain MCP server |
| Cursor | .cursor/mcp.json plus a project rule |
| Codex | ~/.codex/config.toml plus a section in AGENTS.md |
| Others | Any MCP client: https://serpkin.com/api/mcp with your agent key |
What npx serpkin does
Signs you in. Opens
https://serpkin.com/cliwith a code likeBCDF-GHJK. Confirm it matches your terminal and approve. That creates an agent key named "Serpkin CLI on ". You can revoke it in Settings → Agents.Detects your framework. Next.js (app and pages router) fully, plus Astro, SvelteKit, Nuxt and Remix as best effort. In a monorepo it asks which app under
apps/*orpackages/*is the website.Connects your agent.
- Claude Code: offers to install the Serpkin plugin (see below). Alternatively it merges
serpkininto.mcp.json(other servers are kept) or runsclaude mcp add. Without a terminal it writes.mcp.jsonand prints the plugin command. Pass--pluginto install the plugin without asking. - Cursor: merges into
.cursor/mcp.jsonand writes the project rule.cursor/rules/serpkin.mdcwith the SEO loop. - Codex: appends
[mcp_servers.serpkin]to~/.codex/config.tomlonce and adds a short "Serpkin SEO" section to the project'sAGENTS.md(it asks first, and creates the file if it's missing).
All three configs run a small local MCP bridge,
npx -y [email protected] mcp, which reads the key saved at sign-in and forwards requests tohttps://serpkin.com/api/mcp(a self-hosted server adds--server <origin>to the args). The configs hold no key and no environment variable, so there is nothing to export.The rule and the
AGENTS.mdsection sit between<!-- serpkin:start -->and<!-- serpkin:end -->. Re-running init refreshes only that block and keeps everything else.- Claude Code: offers to install the Serpkin plugin (see below). Alternatively it merges
Registers the site, which queues its initial audit on the server, and uploads a route map (URL path → source file), so missions can name the files to change.
Sets up ownership. Either Google Search Console (opens the browser) or a
public/serpkin-verification.txtfile. Deploy it, then runnpx serpkin verify.
The CLI waits up to 75 seconds and shows the first mission when one is ready. --no-wait skips the terminal wait; --no-scan is a compatibility alias. Neither cancels the initial audit queued by registration. If an audit is already queued or running, another scan request reuses it. Failed scans are reported separately from running scans; a finished scan may correctly produce no missions.
Without a plan, setup ends with what the 6-page preview scan found and one way forward:
✓ Preview scan: 6 pages read
Your first mission Make /pricing win "project tracker pricing" (#9 today)
Your agent can ship it today. The 7-day trial unlocks the brief, the full scan and verification.
Builder: 7-day free trial, card required. $29/month from Dec 7 unless you cancel before.
? Open checkout in your browser? [Y/n]
After you start the trial, ask your agent: "Do the next Serpkin mission"The position appears only when Serpkin has measured one. A preview with nothing to fix says so ("Clean. That's the floor."), with the checks that passed, the pages not checked yet and, when your business brief supports one, an opportunity. Press Enter to open checkout in your browser, or n to print its address. Without a terminal, with --yes or with --no-browser, the CLI prints the address and doesn't wait. Only the mission's title is shown from your site, with control characters removed. npx serpkin status shows the same preview mission and a Checkout row until a plan is active.
Under Insights → Site health, review the business brief, source pages and existing-page inventory. Unverified sites get a bounded preview; verify ownership and run a full audit before expecting content missions. Content recommendations require complete coverage, a clear business fit and supporting demand. An empty queue is valid, and started work is preserved through incomplete scans.
Then ask your agent: "What should I do for SEO?"
Claude Code plugin
claude plugin marketplace add apwn/serpkin && claude plugin install serpkin@serpkinInside a session you can run /plugin marketplace add apwn/serpkin, then /plugin install serpkin@serpkin. To keep it current, turn on auto-update for the serpkin marketplace (/plugin → Marketplaces → serpkin); Claude Code leaves it off for marketplaces outside Anthropic's. The plugin lives in plugins/serpkin and includes:
the
serpkin-seoskill, which runs the loop: next mission → implement → run checks → check the preview → submit → verify the preview → verify production after you deploy. It treats page text and search data as untrusted and never deploys.commands:
/serpkin:nextgets the next mission and implements it./serpkin:ship <preview-url>submits it, checks the preview and verifies./serpkin:check <preview-url>runsserpkin check(the pinned CLI version from the public npm registry)./serpkin:statusshows the site status./serpkin:managersets up a weekly SEO manager for one site, or/serpkin:manager allfor one check-in across every site, and runs the first check-in.the Serpkin MCP server, run as the same stdio bridge (
npx -y [email protected] mcp). It uses the key saved at sign-in, so there is nothing to export.SERPKIN_API_KEYis an optional override, andSERPKIN_SERVERpicks a self-hosted or local server (defaulthttps://serpkin.com).hooks (quiet by design, only in repositories with
.serpkin.json):- Session start: one line with the next mission and "run /serpkin:next". It is fetched with a 2.5-second timeout and cached for an hour per site (failures for 30 minutes); submitting, verifying, starting, dismissing or creating a mission through the Serpkin tools clears the cache, so the line never names a mission you just shipped. It says nothing when you are offline, signed out or the project isn't linked.
- After a push or deploy (
git push,vercel deploy/--prod,netlify deploy,wrangler deploy,fly deploy,firebase deploy,railway up,npm|pnpm|yarn|bun run deploy): one reminder per session to run/serpkin:check <preview-url>. - Turn them off with
SERPKIN_HOOKS=offin your shell or in Claude Code'ssettings.jsonenv. Keep just one withSERPKIN_HOOKS=sessionorSERPKIN_HOOKS=deploy. - Safety: the hooks run only the plugin's own scripts (never a binary or script from the repository), never print or cache your key, and follow the same server rules as the CLI: a server named only in
.serpkin.jsonis used only when it ishttps://serpkin.comor a server you already signed in to, and the key is only sent toSERPKIN_SERVER(orhttps://serpkin.com). The command text of a push or deploy is never echoed.
Clients without plugins get the same loop as MCP prompts: next_mission, ship_mission and check_preview. The Cursor rule and the Codex AGENTS.md section carry a lighter version of the hooks: at session start, ask Serpkin for the next mission and mention it in one line; after a push or deploy, suggest npx serpkin check once.
Patch-ready missions
serpkin_next_mission and serpkin_get_mission return an implementation block. It lists ordered steps, each with a file from your route map, an action (edit, create or run), an intent and, where Serpkin can generate it, a snippet (metadata export, app/sitemap.ts, app/robots.ts, a JSON-LD component with the required properties, a redirects() entry and more). It also lists verify commands and a done_when list that mirrors the acceptance checks. Snippets are templates for the agent to adapt. Page and search text only appears as clipped, escaped const UNTRUSTED_… strings.
Where the key goes
The key is never written into your repository. It is stored in ~/.config/serpkin/credentials.json (mode 600, keyed by server). Agent configs run npx -y [email protected] mcp, which reads it from there, so they hold no key and no environment variable, and you don't need to export anything.
SERPKIN_API_KEY still works and takes precedence over the saved key: use it in CI and GitHub Actions, or if you prefer it. Configs written by older versions (${SERPKIN_API_KEY} / ${env:SERPKIN_API_KEY} / bearer_token_env_var) keep working while the variable is set. Re-running npx serpkin switches .mcp.json and .cursor/mcp.json to the bridge; an existing Codex table that reads the variable is left alone and the CLI prints the new block to replace it. A Codex bridge entry pinned to an older CLI version gets just that version updated.
To connect by hand without Node (or an agent on another machine), point an HTTP MCP client at https://serpkin.com/api/mcp with Authorization: Bearer <key>, using a key from Settings → Agents.
Lanes
Every mission has a lane: code, content, outreach, research, or owner (Search Console, hosting, accounts: only you). The key npx serpkin creates takes missions from every lane. To give this agent one kind of work, pass the lanes at sign-in (CLI 0.2.23 or newer):
npx serpkin --lanes code,content--lanes applies only when a new key is created. If this machine already has one, add --login, or change the key's lanes in Settings → Agents. Owner missions are never given to an agent, whatever the key says. Agents can also pass lanes to serpkin_next_mission, serpkin_get_missions and serpkin_get_handoff; asking for a lane the key doesn't have returns LANE_NOT_ALLOWED.
.serpkin.json (server and site id, no secrets) is written to the repo root. Commit it so CI knows which site to check.
Sites that aren't live yet
Serpkin can't scan localhost. Deploy a preview (for example a vercel.app URL) and run npx serpkin init --url <preview-url>. (Once the site is registered, npx serpkin check http://localhost:3000 compares a local build with production before a deploy; see below.) Foundation checks work on the preview; production verification comes once the domain is live. Run init --url https://your-domain then.
Sites without preview deployments
If the site deploys straight to production (for example wrangler deploy to Cloudflare Workers), check a local production build before deploying:
npm run build && npm start # or your framework's production server
npx serpkin check http://localhost:3000Serpkin's server never fetches localhost. The CLI reads the local pages on your machine (the homepage and up to 10 pages Serpkin plans, plus robots.txt and the sitemap) and lists the paths it reads. The page you name comes first: the URL's own path and any paths after it (npx serpkin check http://localhost:3000 /is-down/vercel /pricing). Then the pages of missions in progress, waiting to ship or ready to start (their target pages and the new pages they create), marked (mission page), then known pages; --paths /a,/b replaces that list. A page that times out or answers 5xx is read once more with a longer wait; a dev server's slow first compile then shows as a timeout warning, not a regression. It drops inline scripts and styles, and uploads them; Serpkin fetches production itself and runs the same comparison as a preview check. localhost, 127.0.0.1, [::1] and *.local addresses work. This is a pre-deploy check, not production verification: after the deploy, check the production URL and verify the mission with environment production. Missions for sites known to deploy straight to production list it first in implementation.verify (when: "before_deploy").
Monorepos
npx serpkin and npx serpkin routes find the website app at the root, in workspace folders (package.json workspaces, pnpm-workspace.yaml), in apps/*, packages/*, sites/*, and in any top-level folder with its own package.json (web/, frontend/). A folder counts when it depends on Next.js, Astro, SvelteKit, Nuxt or Remix, or has that framework's config file. With several apps the CLI asks; without a terminal it takes the one in a website-named folder (web, www, site, …) when that is clear and says so, else it stops and asks for --app <dir>. The choice is saved in .serpkin.json as app. Route-map paths are repository-relative (web/src/app/page.tsx), even from a subfolder.
Without a route map, missions don't know your files: serpkin_next_mission warns "Routes not uploaded" and steps leave file empty, naming usual locations to confirm. Run npx serpkin routes --upload (with --app <dir> in a monorepo). npx serpkin uploads it during setup; npx serpkin status and serpkin_get_site_context (route_map) say when it is missing, with the command, and in a terminal status offers to upload it. In a repository without .serpkin.json, routes --upload, status and check find the registered site the repository names (the homepage in package.json, NEXT_PUBLIC_SITE_URL or a similar *_SITE_URL/*_BASE_URL in .env* files, metadataBase, next-sitemap siteUrl, astro site, a CNAME file, or the git remote's name), else the account's only site, and say which. routes --upload writes .serpkin.json; status writes it when the repository named the site (asks in a terminal; --yes also links the only site). Several sites and no match: status lists them with their ids; pass --site <id>. Env files are read only to compare hosts on your machine; nothing from them is sent.
Audit status and recovery
- Audit queued / running: leave it running; the app refreshes automatically.
- Preview audit: verify site ownership, then run the full audit.
- Review business brief: confirm the product, audience and specific topics under Settings → About this site. Problems and features are optional context; exclusions prevent unrelated ideas.
- Incomplete / failed audit: inspect the coverage note, fix the access or rendering issue, and retry. A page-limit issue may require a larger scan allowance; repeating the same limited scan will not add coverage.
- Audit ready, no mission: no sufficiently supported change is ready. This is a valid outcome.
Commands
| Command | |
| ----------------------------- | ---------------------------------------------------------------------------------- |
| serpkin / serpkin init | Setup (above). Safe to re-run; the stored key and site are reused. |
| serpkin check <preview-url> [/page …] | Compare a preview deploy with production. Exit code 1 on regressions, 2 on errors. Without .serpkin.json it uses --site <id>, the site whose origin matches the URL, or the site the repository names. http://localhost:PORT checks a local build before deploying (read on your machine). --allow-host allows your own preview host for the site. |
| serpkin verify | Check ownership (verification file or DNS record). |
| serpkin status | Site, ownership, route map, data level, next mission and credits. Without .serpkin.json it finds the site (see Monorepos) and offers to link the repository. |
| serpkin routes [--upload] | Print the route map; --upload sends it (and writes .serpkin.json when it's missing). Monorepos: finds or asks for the app; --app <dir>. |
| serpkin next [--oneline] | The next mission in one line (fast, cached; --oneline is silent when offline). |
| serpkin weekly [--force] | Write the weekly mission workflow and the preview check to .github/workflows/. |
| serpkin mcp [--server <origin>] | MCP server for your agent over stdio; uses the key saved at sign-in. Configs pin the exact version and the public npm registry, so a package inside a project can't stand in for it; run npx serpkin again after upgrading. |
Options: --url, --plugin, --allow-host, --server <origin> (default $SERPKIN_SERVER, then .serpkin.json, then https://serpkin.com), --agent claude,cursor,codex, --app apps/web, --ownership file|search-console|skip, --description, --audience, --country, --language, --login, --lanes code,content, --paths /,/pricing, --site <id>, --json, --yes, --no-browser.
Without a terminal (CI) or with --yes, the CLI never prompts. When it needs something it can't default, it stops and names the flag to pass.
Which server gets your key. .serpkin.json is repository content, so it can't send your key anywhere new. A server named only there is used when it is https://serpkin.com or a server you already signed in to. Otherwise the CLI asks, and without a terminal it stops until you pass --server or set SERPKIN_SERVER. The saved key, or SERPKIN_API_KEY if set, is only ever sent to SERPKIN_SERVER, or to https://serpkin.com when that is unset.
For a local Serpkin server: npx serpkin --server http://127.0.0.1:3000.
Checks on pull requests
serpkin check compares up to 25 paths (default: the homepage plus up to 10 known pages) on the preview and on production, and fails on regressions:
- HTTP errors (non-2xx, including protected previews)
noindexadded in the page's robots meta tag- title, meta description or H1 removed
- canonical removed, invalid, or pointing to another site
- unfinished draft text (
[TODO], lorem ipsum, an unrendered{{ template }}, a pasted chat reply) robots.txtfailing or removed,sitemap.xmlno longer reachable or valid
Problems that already exist in production are reported as warnings, not regressions.
Preview noindex rule. Vercel adds X-Robots-Tag: noindex to every non-production deployment (other hosts do similar). Header-level noindex on the preview is therefore reported once as a warning, never as a regression. A noindex in the page's own <meta name="robots"> is page code and fails the check. Likewise a preview robots.txt that blocks everything is a warning, since many apps do that deliberately on previews.
Preview hosts must be the site's own domain or subdomains, or a deploy platform's preview domain: *.vercel.app, *.netlify.app, *.pages.dev, *.workers.dev, *.onrender.com, *.fly.dev, *.up.railway.app, *.web.app / *.firebaseapp.com, *.amplifyapp.com, *.azurestaticapps.net, *.ondigitalocean.app, *.deno.dev, Lovable, Bolt and Replit. For your own staging domain, run npx serpkin check <url> --allow-host once (needs the full-access key npx serpkin saves; up to 5 hosts per site, *.previews.example.com covers its subdomains). Local addresses are never fetched by the server: see "Sites without preview deployments".
GitHub Action
npx serpkin weekly writes it to .github/workflows/serpkin.yml when that file is missing. The template also ships in the package at templates/github-action.yml (node_modules/serpkin/templates/github-action.yml); you can copy it to .github/workflows/serpkin.yml yourself, then add a repository secret SERPKIN_API_KEY (create a key with npx serpkin or in Settings → Agents) and a repository variable SERPKIN_SITE_ID (the site_id from .serpkin.json). The workflow doesn't check out the pull request, so code or config from a PR never runs while the key is available, and it pins the CLI version. It runs on deployment_status events, which Vercel sends when a preview finishes deploying. It checks the deployment's target_url and fails the job when the preview introduces a regression. If your previews use Vercel Deployment Protection, Serpkin's requests get HTTP 401. Allow them through, or the check reports the preview as unreachable.
Weekly mission pull requests
npx serpkin weekly also writes .github/workflows/serpkin-weekly.yml (template: templates/weekly-mission.yml). Every Monday at 08:00 UTC, or when you run it by hand, it gets your next mission from Serpkin, has Claude Code (claude-code-action) implement it on a new branch and opens one pull request labeled serpkin. You review, merge and deploy.
Setup: add the secrets SERPKIN_API_KEY and ANTHROPIC_API_KEY (or CLAUDE_CODE_OAUTH_TOKEN from claude setup-token) and the variable SERPKIN_SITE_ID. Optionally add SERPKIN_PR_TOKEN, a fine-grained token with Contents and Pull requests (read and write), so your CI runs on the pull request right away: pull requests opened with the default GITHUB_TOKEN don't start other workflows. CI then runs agent-written code before you review it, so skip the token if your CI has deploy or production secrets. The command prints the gh commands.
Guardrails:
- At most one open Serpkin pull request. A run skips while one is still open.
- The agent is treated as untrusted, because mission text comes partly from the web. Three jobs:
preparegets the mission with your Serpkin key and runs no repository code;implementgives Claude Code file-editing tools only, with a read-only token and no Serpkin key (no shell commands, package scripts, commits or pushes);publishrejects changes to.github/, git internals,package.json, lockfiles, env files, deploy configs (vercel.jsonand similar), symlinks and submodules, applies the patch with git hooks disabled and opens a draft pull request without running repository code. The patch is built in a fresh checkout, so git never reads settings the agent could have written. Claude Code can only read and edit files inside the repository and the mission folder, and the publish job refuses any patch or description that looks like it contains a key. - If a mission can't be done this way (it needs a change outside the code or to a protected file), the workflow dismisses it with a note, so next week moves on to another mission. Restore it in Serpkin to do it yourself.
- A new branch every run. Your CI and preview deployment test the change on the pull request.
- The mission is passed as a file and treated as untrusted data, never put into the prompt.
- Per-job minimal permissions, pinned action versions, timeouts and one run at a time.
- The pull request is recorded on the mission. After you merge and deploy, verify it with
/serpkin:shipor in Serpkin.
What leaves your machine
- Sent to Serpkin: your site URL, the answers you give during setup (the site description defaults to the one in
package.json), the route map (URL paths and the source file names that serve them, up to 2,000 routes), and your computer's hostname at sign-in, used to name your agent key. Your agent sends what it asks Serpkin for through MCP. - Never sent: your source code, environment files or the contents of your repository. To detect the framework and build the route map, the CLI reads
package.jsonand the file names in your routes folder, not their contents. It also updates your agent's config files (.mcp.json,.cursor/,AGENTS.md,~/.codex/config.toml) as described above. - Stored locally: your agent key in
~/.config/serpkin/credentials.json(mode 600), never in the repository.
The server also fetches public page content for the audit. When automatic contextual assessment is configured, bounded public excerpts, saved business context and selected query text are assessed by the model service; source code and Search Console metrics are not sent.
Details: privacy policy.
Troubleshooting
- Serpkin can't reach your site: Serpkin needs a public URL to scan. Use a preview deploy with
--url, notlocalhost. To check a local build before deploying, usenpx serpkin check http://localhost:3000. - Missions name
app/...files that don't exist: the route map isn't uploaded (monorepo?). Runnpx serpkin routes --upload --app <dir>. - Preview check returns 401: your preview is behind deployment protection. Allow Serpkin's requests or check a public preview.
- The agent doesn't see Serpkin: restart the agent after setup, and check
node --versionis 22 or newer where it runs. - 401 or "not signed in" from the agent: the saved key was revoked or is missing. Run
npx serpkin --login, then restart the agent. With an older or by-hand config, make sureSERPKIN_API_KEYis set in the shell your agent starts from. - Windows: the written configs start the bridge with
command: "npx". Some agents on Windows can't launchnpxdirectly (it isnpx.cmd). If the agent reports that it can't start the server, run the agent in WSL, or edit the config to"command": "cmd"with"args": ["/c", "npx", …the existing args]. This note is untested on Windows. - Start over: re-run
npx serpkin. It reuses the stored key and site and refreshes only its own blocks.
Support and license
Questions or bugs: serpkin.com or the plugin repository. MIT licensed (this CLI and the Claude Code plugin).
Setup success means the project connection is saved, not that every audit prerequisite is complete. The receipt reports the selected market and available first recommendation, or a recovery step. New sites need a reachable public URL or preview; localhost cannot be scanned. Without a plan, a site gets a 6-page preview audit; full scans come with the 7-day trial or a plan (Builder covers 300 pages, Pro 1,000). Hitting a crawl/render limit requires changing capacity or readability before a repeat scan can help; checked-page findings remain useful.
Automatic initial and monthly topic research can use plan credits (2 per keyword seed and 3 for an initial ranking estimate). It is off by default. Pass --auto-research when registering a new site to enable it, or change future research in Settings → Automation. Already queued work continues. --no-wait controls the terminal wait only, not automatic research or the initial audit.
Hermes and other agents
--agent also accepts hermes, grok-bot and other. Use npx serpkin --connect-only --agent hermes to authenticate and prepare a connection without a repository or site registration. A new Hermes profile config receives an HTTP server entry referencing SERPKIN_API_KEY; a nonempty existing config is preserved and the entry is printed for a deliberate merge. Honor HERMES_HOME when using another profile. Set the key in its private environment and reload MCP. Grok Bot and generic clients get manual URL/header instructions, not a claimed native installation. Grok Bot and Grok Build are different products.
A saved config is not connection verification. Ask the client to call serpkin_get_workspace, choose a site and read its summary. The connection supplies the workspace id. CLI device-login keys retain full access; use Settings → Agents in the web app to create read-only, research or implementation keys and optional monthly credit ceilings. Never paste a key into agent chat or include it in a delegation brief.
