Case Study7 min read·Last verified: June 11, 2026

How Better Auth Became AI Agents' #2 Docs Source in Two Years

The lesson: A product with no training-data prior and a mediocre trust score can still out-rank React at the agent retrieval layer. The way to do it: saturate every surface agents touch (docs index, MCP, skills, in-product features) in a category where agents are forced to look things up. Capturing demand, not earning reputation, is the part you can copy.

At a glance

CategoryAuthentication framework (TypeScript)
Repo created2024-05-19 (GitHub-API verified)
Agent retrieval share4.59% of all Context7 library traffic. #2 overall, behind only Next.js, ahead of React (2026-06-11)
Context7 entry502,435 tokens · 2,557 snippets · trust 7.6 · benchmark 77.5 · updated 3 d (2026-06-11)
30-day momentum+7% (within-top-50 share)
Agent skills installs~115.5K org total (order-of-magnitude; skills.sh telemetry)

What they built

Better Auth is the headline surprise of our research. It is a roughly two-year-old auth framework that, as of 2026-06-11, is out-fetched by nothing except Next.js. It can't be coasting on training data, because the repo didn't exist before May 2024. And it isn't coasting on reputation either: its Context7 trust score is 7.6, a number the index sets partly by org age. It still ranks #2 on demand.

What we saw directly is a full-stack agent surface that runs from the docs layer down into the product itself:

SurfaceWhat we observed (2026-06-11)Layer
llms.txtRich index with a dedicated "AI Resources" sectionRetrieval (Play 5)
Markdown mirrors.md docs served, but only under a nonstandard /llms.txt/docs/...md prefix. The canonical-path .md is emptyRetrieval (Play 6)
Docs MCPRemote server at mcp.better-auth.com, installed by Better Auth's own CLI: npx auth@latest mcp --cursor or --claude-code, plus a Cursor deeplinkRetrieval + environment (Play 3)
Agent skillsInstallable skills that encode library conventions. About 115.5K org-total installs (order-of-magnitude)Environment (Play 4)
In-docs AI chatEmbedded assistant inside the documentationRetrieval
Product featuresAn MCP auth-provider plugin and an Agent Auth plugin. These are agent-native features built into the product itselfProduct (Play 10)

"so your coding assistant follows library conventions" (better-auth.com docs, describing its installable agent Skills, observed 2026-06-11)

The CLI-installed MCP is the move worth dwelling on. Most products publish an MCP server and hope developers wire it up. Better Auth's CLI writes its docs server into the agent's own configuration. Run one command, and every future Cursor or Claude Code session in that environment can query Better Auth's live docs. That is environment-layer installation, the mechanism our pilot experiments found strongest.

Our report maps these cases on a 2×2 grid (retrieval demand by training prior). Better Auth is the clearest "retrieval-carried" product: weak prior, all surface, high demand. The opposite corner is Tailwind, with a strong prior and zero first-party surface. That is why the two cases bracket the strategy space (see the Tailwind case study).

Research · the evidence

The receipts

All figures observed 2026-06-11; single-day snapshot, ±10% error bars (we watched Stripe's snippet count read 130 and 207 on the same day).

The ranking. From the Context7 top-50 share table (2026-06-11):

#LibraryShare
1/vercel/next.js10.97%
2/better-auth/better-auth4.59%
3/websites/vercel3.35%
4/vercel/ai3.12%
5/anthropics/claude-code2.63%
6/reactjs/react.dev2.57%

A repo created 2024-05-19 sits ahead of React's official docs, Supabase, shadcn/ui, and Tailwind. 30-day momentum is +7%, modest but positive while it holds the slot.

The surprise, stated precisely (report §5, A1). The #2 position can't come from training data (too young) and can't come from reputation-by-age (trust 7.6). What it does have: category-leading task friction (auth is maximum boilerplate), a CLI that installs its docs-MCP into the agent's own config, skills that encode its conventions, and a large fresh Context7 corpus (502K tokens, 3-day freshness). The explanation that fits the evidence: retrieval-layer dominance in a high-retrieval-demand category, plus agent-environment installation.

The benchmark is unremarkable, and it didn't matter for demand. Better Auth's Context7 benchmark is 77.5, below Bun (84.4), Next.js (84.9), and shadcn/ui (87.1). Demand rank and quality score are different things. Better Auth won the first without leading the second.

The flaw in the stack. Its .md mirrors work only under the nonstandard /llms.txt/docs/... prefix, while canonical-path .md URLs return empty. Agents guess the standard convention first, so a working mirror at the wrong path is undiscoverable. The #2 ranking happened despite this, not because of it.

The sobering control result. In our pilot E1 (single model, Claude Haiku 4.5, n=3 per arm, tools disabled, 2026-06-11), bare agents asked to add auth to a fresh Next.js app chose NextAuth 3/3 and Better Auth 0/3. Its dominance lives at the retrieval layer, where agents fetch docs mid-task. The bare-model prior in auth still belongs to the established player. This is pilot-grade, but it shows exactly which layer Better Auth actually owns.

Skills caveat. The roughly 115.5K org-total install count comes from skills.sh telemetry, which is opt-out, excludes CI, and is cache-noisy. We saw other vendors' totals vary between page loads. Treat it as order-of-magnitude only.

Skills detail. Within that org total, better-auth-best-practices alone reads 45.7K installs. That is the {product}-best-practices pattern that dominates the skills leaderboard (see Play 4).

What to copy

  • Add a dedicated "AI Resources" section to your llms.txt so agents find your MCP, skills, and agent docs from the index file (Play 5).
  • Ship a remote docs-MCP, then make your own CLI install it into Cursor and Claude Code with one command. Don't wait for developers to wire it up (Play 3).
  • Publish skills that encode your library's conventions, so agents follow your idioms instead of improvising (Play 4).
  • Keep your Context7 entry large and fresh. 502K tokens at 3-day freshness is part of this story, so claim and curate the entry (Play 2).
  • Build agent-native product features, not just agent-readable docs. Better Auth sells an MCP auth-provider plugin and an Agent Auth plugin (Play 10).
  • Serve .md mirrors at the canonical-path convention, not a custom prefix. Copy the surface and fix their flaw (Play 6).

What NOT to over-copy

  • The category did heavy lifting. Auth is the highest-friction, most boilerplate-heavy task in app scaffolding, so retrieval demand for auth docs is structurally enormous (report §4.2). Better Auth's win is capturing that demand against older players (Auth0, NextAuth, and Clerk all predate it in training data). If your category generates few mid-task doc lookups, the same stack yields a smaller prize.
  • Retrieval rank is a flow metric, not a stock metric. The same dataset shows openclaw falling −50% in 30 days while still ranked #10. Better Auth's +7% momentum is solid, but the position must be held, not banked.
  • One day, one index. All numbers are a 2026-06-11 Context7 snapshot with ±10% error bars. Context7 is the dominant retrieval directory we can measure, not the whole retrieval layer.
  • The nonstandard .md prefix. This is a real defect. Do not replicate it.
  • Retrieval dominance hasn't flipped the bare-model default. E1's control arm picked NextAuth 3/3. Copy this stack to win agents that look things up, not agents answering from memory.

FAQ

Why does Better Auth rank #2 on Context7? Not training data and not reputation. The repo dates to May 2024 and its trust score is 7.6. The explanation that fits the evidence is retrieval-layer dominance in a structurally high-demand category (auth), plus environment installation: a CLI that writes its docs-MCP into Cursor and Claude Code configs, along with skills, llms.txt, and a large, fresh index entry.

Does Better Auth have an MCP server? Yes. It runs a remote docs MCP at mcp.better-auth.com, installable via its own CLI (npx auth@latest mcp --cursor or --claude-code) with a Cursor deeplink. It also ships MCP as a product feature: an MCP auth-provider plugin and an Agent Auth plugin (observed 2026-06-11).

Is Better Auth proof that any new product can become an AI-agent default in two years? It's proof the break-in is possible, not that it's easy. Better Auth paired a maximum-retrieval-demand category with a complete agent surface and environment installation. In our pilot, bare models still defaulted to NextAuth 3/3. The win is at the retrieval layer, and it has to be re-earned as rankings move.


Snapshot date 2026-06-11; single-day metrics carry ±10% error bars. Part of Case Studies · The Complete Playbook to Agentic Discovery.

Stay ahead of the agents. We re-test this playbook quarterly and publish what changed: new data, busted myths, ranking shifts. Get the update digest →

Want this done for you? Synscribe runs agentic-discovery programs for B2B SaaS and developer platforms. Talk to us →

Get a diagnosis

Are you the default an AI agent reaches for?

Get an agent-readiness diagnosis of your product, especially API and MCP products, plus the punch-list to become the one agents pick by default.

Subscribe to research