open-source product · 7 npm packages · 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, and a token-optimal, optionally signed snapshot. One config in, every agent-readable protocol out — RSS, but for AI agents. It is a seven-package npm scope (@ahtmljs/*) at v0.9.0.
install
npm install @ahtmljs/next # Next.js plugin npm install @ahtmljs/vite # Vite / SvelteKit / SolidStart / Astro npm install @ahtmljs/hono # Hono · Node · Bun · Deno · Workers · Lambda npm install @ahtmljs/agent # typed client SDK for agents npm install @ahtmljs/langchain # RAG document loader npm install @ahtmljs/schema # types + JSON Schema + validator npm install -g @ahtmljs/cli # ahtml doctor — validate the discovery chain
the seven packages
| Package | What it does |
|---|---|
| @ahtmljs/schema | Canonical snapshot types, validator, dual serializers, emitters. Edge-safe. |
| @ahtmljs/next | Next.js plugin — one route emits MCP, OpenAPI, JSON-LD, llms.txt, snapshot. |
| @ahtmljs/vite | Vite plugin — byte-identical output for SvelteKit, SolidStart, Astro. |
| @ahtmljs/hono | Hono adapter — same handler on Node, Bun, Deno, Workers, Lambda. |
| @ahtmljs/agent | Typed client SDK — ETag caching, retries, dry-run gates, tokenizer cost. |
| @ahtmljs/langchain | LangChain.js loader — chunks with citation anchors preserved. |
| @ahtmljs/cli | ahtml doctor — walks the discovery chain end to end; CI-wirable. |
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: on a fact-extraction benchmark with real tokenizers and real model calls, the AHTML compact snapshot hits 95% accuracy at roughly half the tokens of raw HTML, and the canonical JSON form hits 100% — versus 91% for plain HTML and 89% for llms.txt.
It is framework-native and additive: your existing Next.js, 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.
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. @ahtmljs/vite covers SvelteKit, SolidStart, Astro, and vanilla Vite, and @ahtmljs/hono covers Node, Bun, Deno, Cloudflare Workers, and AWS Lambda — all with byte-identical output.
get it
related
Compare vs llms.txt · Other projects: Klinder-OSS · Diffcore · whatbroke · Roy UI · all work · about the maker
Built by Dibbayajyoti Roy. Questions or want to use it? Get in touch.