open-source product · 16 npm packages + Python SDK · MIT
AHTMLthe contract layer of the agent web
tldr
AHTML (Agentic HTML) lets a website declare a single semantic snapshot of a page and emit, from that one source, every protocol an AI agent might want: an MCP tool manifest, an OpenAPI 3.1 document, JSON-LD, an llms.txt shim, an RSL 1.0 license, a Markdown view, and a token-optimal, optionally signed snapshot with typed, priced actions. One config in, every agent-readable protocol out. RSS, but for AI agents. It is a sixteen-package npm scope (@ahtmljs/*) at v1.1.0, plus the ahtml Python SDK, and its universal extractor lets agents consume any site today, with or without adoption.
install
npx @ahtmljs/cli init # detects Next/Astro/SvelteKit/Vite/Hono, wires everything npm install @ahtmljs/next # Next.js plugin npm install @ahtmljs/astro # Astro integration npm install @ahtmljs/sveltekit # SvelteKit hook npm install @ahtmljs/vite # Vite / SolidStart / vanilla Vite npm install @ahtmljs/hono # Hono · Node · Bun · Deno · Workers · Lambda npm install @ahtmljs/agent # typed client SDK for agents (dry-run sandbox) npm install @ahtmljs/langchain # RAG document loader pip install ahtml # Python SDK, LangChain loader included npx @ahtmljs/cli mcp <url> # turn ANY site into MCP tools, no adoption needed
the sixteen packages (plus Python)
| Package | What it does |
|---|---|
| @ahtmljs/schema | The contract layer: snapshot types, validator, dual serializers, emitters. Edge-safe. |
| @ahtmljs/next | Next.js plugin: one route emits MCP, OpenAPI, JSON-LD, llms.txt, RSL, snapshot. |
| @ahtmljs/astro | Astro integration: same five-endpoint surface, zero astro dependency. |
| @ahtmljs/sveltekit | SvelteKit server hook or per-endpoint handlers, same surface. |
| @ahtmljs/vite | Vite plugin: byte-identical output for SolidStart and vanilla Vite. |
| @ahtmljs/hono | Hono adapter: same handler on Node, Bun, Deno, Workers, Lambda. |
| @ahtmljs/extract | Framework-neutral extractor pipeline with a plugin API. |
| @ahtmljs/agent | Typed client SDK: ETag caching, retries, dry-run sandbox, tokenizer cost, HTML fallback. |
| ahtml (PyPI) | Python consumer SDK: LangChain loader, JWS verification, byte-identical canonical JSON. |
| @ahtmljs/langchain | LangChain.js loader: chunks with citation anchors preserved. |
| @ahtmljs/cli | init · analyze · score · doctor · benchmark · mcp proxy. Works on any URL. |
| @ahtmljs/kv | Pluggable KV/cache backends: Memory, Upstash Redis, Cloudflare KV. |
| @ahtmljs/webmcp | WebMCP tool registry & browser bookmarklet for page actions. |
| @ahtmljs/insights | Agent-traffic analytics: verified agents vs bots vs humans, zero-PII. |
| @ahtmljs/conformance | Language-agnostic conformance corpus + certification runner. |
| @ahtmljs/index | The AHTML Index: registry + crawler with an MCP query surface. |
| @ahtmljs/badge | Hosted score-badge service: README-embeddable SVG + linked report. |
why it wins
The moat is not being best at any one protocol: it is being the only thing that emits all of them from one source of truth. And it is measured, not estimated: 5.6× fewer tokens than the HTML a browser loads on the flagship benchmark page (4.5-7.3× across the corpus, real OpenAI and Anthropic tokenizers), and in a 146-run multi-model benchmark across gpt-4o-mini, claude-haiku-4.5, gemini-2.5-flash, and llama-3.3-70b, fact-extraction accuracy rises from 91% on raw HTML to 100% on AHTML JSON, versus 89% for llms.txt.
It is framework-native and additive: your existing Next.js, Astro, SvelteKit, Vite, or Hono app becomes an MCP server at /ahtml/mcp.json (same database, same auth, one deploy) instead of you standing up a separate server.
And it is safe to act on, not just read: actions carry typed cost, reversibility, auth, and side-effects; sites can require verified agents (RFC 9421 signed requests), price actions over x402, and license content with RSL 1.0, and agents can rehearse priced or irreversible actions in the SPEC §4.7 dry-run sandbox before real money moves. Snapshots are signable with detached JWS. 700+ tests pass across the sixteen packages and the Python SDK, and both implementations certify 100% against a language-agnostic conformance corpus.
faq
How do I add MCP to a Next.js app?
Install @ahtmljs/next and wrap your config. The plugin auto-discovers routes and emits an MCP tool manifest at /ahtml/mcp.json from the same snapshot it uses for OpenAPI, JSON-LD, and llms.txt. No separate MCP server to write or deploy.
Is AHTML a replacement for llms.txt or JSON-LD?
No. It emits both, plus MCP and OpenAPI, from one config. llms.txt is a human-readable index and JSON-LD targets search engines; AHTML adds typed actions, cost and reversibility metadata, freshness, and a signed snapshot on top, and generates the others for you.
Does it work outside Next.js?
Yes. Dedicated adapters cover Astro (@ahtmljs/astro), SvelteKit (@ahtmljs/sveltekit), and other Vite-based apps like SolidStart (@ahtmljs/vite), and @ahtmljs/hono covers Node, Bun, Deno, Cloudflare Workers, and AWS Lambda, all with byte-identical output. `npx @ahtmljs/cli init` detects your framework and wires everything.
Do the sites my agent reads need AHTML installed?
No. The consumer side works on any URL today: @ahtmljs/agent's fetchPage() and the ahtml Python SDK fall back to extracting typed entities from ordinary HTML (schema.org, OpenGraph, microdata), and `npx @ahtmljs/cli mcp <url>` turns any site into MCP tools for Claude, ChatGPT, or Cursor.
Can a site charge AI agents or verify who is calling?
Yes. Actions declare typed cost with x402 payment rails behind a standards-compliant HTTP 402 flow, sites can require RFC 9421-signed requests from verified agents, and content licensing ships via an RSL 1.0 file plus Content Signals, with a dry-run sandbox so agents rehearse priced or irreversible actions before paying.
npm
Live npm stats: refreshed a few times a day.
21,939 total downloads · 16 packages
- 4,541downloads
- 3,205downloads
- 145downloads
- 147downloads
- 2,765downloads
- 1,401downloads
- 87downloads
- 3,501downloads
- 3,160downloads
- 1,415downloads
- 495downloads
- 463downloads
- 148downloads
- @ahtmljs/conformancelanguage-agnostic conformance corpus + certification runnerv1.1.0 · since Jul 11, 2026156downloads
- 155downloads
- 155downloads
get it
compare
more projects
Klinder-OSS · Diffcore · whatbroke · Roy UI · Fresco · all work · about the maker
Built by Dibbayajyoti Roy. Questions or want to use it? Get in touch.