AHTML logo

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)

PackageWhat it does
@ahtmljs/schemaThe contract layer: snapshot types, validator, dual serializers, emitters. Edge-safe.
@ahtmljs/nextNext.js plugin: one route emits MCP, OpenAPI, JSON-LD, llms.txt, RSL, snapshot.
@ahtmljs/astroAstro integration: same five-endpoint surface, zero astro dependency.
@ahtmljs/sveltekitSvelteKit server hook or per-endpoint handlers, same surface.
@ahtmljs/viteVite plugin: byte-identical output for SolidStart and vanilla Vite.
@ahtmljs/honoHono adapter: same handler on Node, Bun, Deno, Workers, Lambda.
@ahtmljs/extractFramework-neutral extractor pipeline with a plugin API.
@ahtmljs/agentTyped 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/langchainLangChain.js loader: chunks with citation anchors preserved.
@ahtmljs/cliinit · analyze · score · doctor · benchmark · mcp proxy. Works on any URL.
@ahtmljs/kvPluggable KV/cache backends: Memory, Upstash Redis, Cloudflare KV.
@ahtmljs/webmcpWebMCP tool registry & browser bookmarklet for page actions.
@ahtmljs/insightsAgent-traffic analytics: verified agents vs bots vs humans, zero-PII.
@ahtmljs/conformanceLanguage-agnostic conformance corpus + certification runner.
@ahtmljs/indexThe AHTML Index: registry + crawler with an MCP query surface.
@ahtmljs/badgeHosted 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

  • @ahtmljs/schema
    the contract layer · snapshot types, validator, emitters
    v1.1.0 · since May 13, 2026
    4,541downloads
  • @ahtmljs/next
    Next.js plugin → /.well-known/ahtml.json + MCP
    v1.1.0 · since May 13, 2026
    3,205downloads
  • @ahtmljs/astro
    Astro integration · same five-endpoint surface
    v1.1.0 · since Jul 11, 2026
    145downloads
  • @ahtmljs/sveltekit
    SvelteKit server hook · same five-endpoint surface
    v1.1.0 · since Jul 11, 2026
    147downloads
  • @ahtmljs/vite
    Vite plugin · byte-parity with next plugin
    v1.1.0 · since May 14, 2026
    2,765downloads
  • @ahtmljs/hono
    Hono adapter · Node · Bun · Deno · Workers · Lambda
    v1.1.0 · since Jun 02, 2026
    1,401downloads
  • @ahtmljs/extract
    framework-neutral extractor pipeline + plugin API
    v0.1.0 · since Jul 11, 2026
    87downloads
  • @ahtmljs/agent
    agent SDK · dry-run sandbox · works on any URL
    v1.1.0 · since May 13, 2026
    3,501downloads
  • @ahtmljs/langchain
    LangChain.js loader · citation metadata
    v1.1.0 · since May 14, 2026
    3,160downloads
  • @ahtmljs/cli
    init · score · doctor · turn any site into MCP tools
    v1.1.0 · since Jun 02, 2026
    1,415downloads
  • @ahtmljs/kv
    pluggable KV & cache backends · Memory · Upstash · Cloudflare
    v1.1.0 · since Jun 19, 2026
    495downloads
  • @ahtmljs/webmcp
    W3C WebMCP bridge · page actions as browser tools
    v1.1.0 · since Jun 19, 2026
    463downloads
  • @ahtmljs/insights
    agent-traffic analytics · zero-PII · OTel export
    v1.1.0 · since Jul 11, 2026
    148downloads
  • @ahtmljs/conformance
    language-agnostic conformance corpus + certification runner
    v1.1.0 · since Jul 11, 2026
    156downloads
  • @ahtmljs/index
    the AHTML Index · registry + crawler + MCP query surface
    v1.1.0 · since Jul 11, 2026
    155downloads
  • @ahtmljs/badge
    hosted score badge · README-embeddable SVG
    v1.1.0 · since Jul 11, 2026
    155downloads

Built by Dibbayajyoti Roy. Questions or want to use it? Get in touch.