# Mumm gateway SDK

## Serve AI agents from your own data.

Put the gateway in front of your website. Agents get clean markdown from your sources. People and search crawlers get your pages unchanged.

[Start the quickstart](https://www.trymumm.com/developers/sdk/quickstart) [API reference](https://www.trymumm.com/developers/sdk/reference)

`$npm install @rebilder/gateway`

## Every page, by task.

- Getting started
  - Install, verify and keep the SDK current.
  - [Choose your tools](https://www.trymumm.com/developers/sdk/distribution)
  - [Quickstart](https://www.trymumm.com/developers/sdk/quickstart)
  - [SDK presentation updates](https://www.trymumm.com/developers/sdk/sdk-updates)
  - [Use Mumm with @vercel/agent-readability](https://www.trymumm.com/developers/sdk/vercel-agent-readability)

- Adapters
  - One config object, mounted on your stack.
  - [Next.js adapter](https://www.trymumm.com/developers/sdk/adapters/nextjs)
  - [Shopify adapter](https://www.trymumm.com/developers/sdk/adapters/shopify)
  - [WordPress plugin](https://www.trymumm.com/developers/sdk/adapters/wordpress)
  - [Node adapter (Express & Fastify)](https://www.trymumm.com/developers/sdk/adapters/node)
  - [Cloudflare Worker & edge](https://www.trymumm.com/developers/sdk/adapters/cloudflare)
  - [SvelteKit, Nuxt, Astro, React Router and Hono](https://www.trymumm.com/developers/sdk/adapters/frameworks)
  - [Bun, Deno, Netlify and Vercel](https://www.trymumm.com/developers/sdk/adapters/runtimes)

- Concepts
  - What the gateway serves, records and reports.
  - [Sources](https://www.trymumm.com/developers/sdk/sources)
  - [Classification](https://www.trymumm.com/developers/sdk/classification)
  - [Access control](https://www.trymumm.com/developers/sdk/access-control)
  - [Events](https://www.trymumm.com/developers/sdk/events)
  - [Agent intent](https://www.trymumm.com/developers/sdk/intent)
  - [The Mumm tag](https://www.trymumm.com/developers/sdk/tag)
  - [Answers Hub](https://www.trymumm.com/developers/sdk/answers-hub)
  - [AI answer evidence](https://www.trymumm.com/developers/sdk/answer-evidence)
  - [Outcomes](https://www.trymumm.com/developers/sdk/outcomes)
  - [llms.txt](https://www.trymumm.com/developers/sdk/llms-txt)
  - [Help agents find your markdown](https://www.trymumm.com/developers/sdk/discovery)

- Reference
  - Every export, header and failure mode.
  - [Troubleshooting](https://www.trymumm.com/developers/sdk/troubleshooting)
  - [API reference](https://www.trymumm.com/developers/sdk/reference)

## What the gateway is

`@rebilder/gateway` connects your existing website to AI agents using content-negotiation middleware. It classifies every request as AI agent, human, search crawler, or protocol client, and serves agents a clean markdown transformation of the canonical page, rendered from your source of truth. Humans and crawlers pass through untouched, as if the gateway weren’t there.

Mumm gateway

One connection.

The right response.

Incoming request → matching format

AI request
Markdown from your sources

People and crawlers
Your original website

Protocol request
Your endpoint

Activity is recorded through your configured event handler.

- **Markdown path**: an agent asking with `Accept: text/markdown` (or an identified agent platform) gets a `text/markdown` response rendered from your service descriptions, feature guides, product data and policies. Important facts come first, under 5KB by default.
- **Pass-through**: humans and search crawlers get `null` from the gateway, so your HTML pipeline runs unchanged. Googlebot always receives canonical HTML.
- **Events**: every handled request, including pass-throughs, emits one `RebilderEventV0` to your `onEvent` hook: who asked, what they got, how long it took. That feed powers the [Mumm for Business console](/content/console/index.html).

In the captured demo, the same product request dropped from 91,226 bytes of PDP HTML to 1,315 bytes of markdown, a 98.6% reduction, with the price moving from character offset 23,185 to line 4. The capture includes the source page and both responses.

## Install and verify the gateway

Connect your business sources and event reporting, then verify serving and reporting separately. The scope depends on your website and the available sources:

1. Install `@rebilder/gateway`, which has zero external runtime dependencies by policy. Our packages are published on npm under `@rebilder`, the company behind Mumm.
2. Wire your source of truth: up to five optional resolver functions from URL to your own data. Three are commerce shaped (`product`, `policies`, `catalog`). Two are universal: `document` for any other page, such as a guide or a service, and `collection` for an index of them. Wire only the ones you have.
3. Mount the adapter for your stack: Next.js middleware, Shopify app proxy, Express/Fastify, a Cloudflare Worker, or the fetch middleware for SvelteKit, Nuxt, Astro, React Router, Hono, Bun, Deno, Netlify and Vercel.
4. Connect event reporting with your site-scoped key and the event sink. Use the runtime-specific flush or waitUntil instructions so events reach your Console.
5. Verify with curl: same URL, markdown for agents, unchanged HTML for everyone else. Then confirm that the request appears in Console → AI visits.

For WordPress, use the **[free plugin](https://www.trymumm.com/developers/sdk/adapters/wordpress)**. For a custom integration, start with **[Quickstart: Next.js end to end](https://www.trymumm.com/developers/sdk/quickstart)**. On another stack? Jump straight to the [Shopify](https://www.trymumm.com/developers/sdk/adapters/shopify), [Node](https://www.trymumm.com/developers/sdk/adapters/node), [Cloudflare](https://www.trymumm.com/developers/sdk/adapters/cloudflare), [framework](https://www.trymumm.com/developers/sdk/adapters/frameworks) or [runtime](https://www.trymumm.com/developers/sdk/adapters/runtimes) pages; the config object is identical everywhere.

## Built for production stacks

- **Zero external runtime dependencies.** The gateway’s only runtime deps are internal workspace packages, and it re-exports their public types, so you install one package. No framework imports anywhere: the core is written against web-standard `Request`/`Response`.
- **Edge latency budget: p95 < 50ms compute, no network calls on the hot path.** Classification is a handful of header string scans (well under 1ms); rendering is pure string assembly. Your source resolvers are the only variable, so back them with in-memory data or a fast cache.
- The gateway passes unmatched requests and source or rendering failures through to your existing application.
- **Open source under Apache-2.0.** The source, tests and ARS conformance corpus are on [GitHub](https://github.com/rebilder/rebilder), where issues and pull requests are welcome.

## Guarantees

## Key pages

| Page | What it covers |
| --- | --- |
| [Quickstart](https://www.trymumm.com/developers/sdk/quickstart) | Next.js end to end: install, wiring, a complete catalog example, curl verification. |
| [Next.js adapter](https://www.trymumm.com/developers/sdk/adapters/nextjs) | `proxy.ts` / `middleware.ts` integration, the dedicated markdown route, matcher scope. |
| [Shopify adapter](https://www.trymumm.com/developers/sdk/adapters/shopify) | App-proxy setup in Partners, the HMAC security model, response semantics. |
| [Node adapter](https://www.trymumm.com/developers/sdk/adapters/node) | Express middleware, Fastify via `@fastify/middie` or an `onRequest` hook, structural types. |
| [Cloudflare & edge](https://www.trymumm.com/developers/sdk/adapters/cloudflare) | The worker fetch handler, origin pass-through, Vercel Edge and other WinterCG runtimes. |
| [Frameworks](https://www.trymumm.com/developers/sdk/adapters/frameworks) | The `/fetch` middleware, with recipes for SvelteKit, Nuxt, Astro, React Router, Remix and Hono. |
| [Runtimes](https://www.trymumm.com/developers/sdk/adapters/runtimes) | Bun, Deno, Netlify Edge Functions and Vercel Routing Middleware. |
| [Sources](https://www.trymumm.com/developers/sdk/sources) | The `GatewaySources` contract: field-by-field types, resolution order, error containment. |
| [Classification](https://www.trymumm.com/developers/sdk/classification) | How requests are detected: the five checks, the crawler guardrail, confidence semantics. |
| [Events](https://www.trymumm.com/developers/sdk/events) | `RebilderEventV0` field reference, the wire protocol, the HTTP and console sinks. |
| [llms.txt](https://www.trymumm.com/developers/sdk/llms-txt) | Generate an llms.txt directory from your source configuration. |
| [Troubleshooting](https://www.trymumm.com/developers/sdk/troubleshooting) | Real failure modes with fixes. |
| [API reference](https://www.trymumm.com/developers/sdk/reference) | Every public export of `@rebilder/gateway` and `@rebilder/events`, with signatures. |

Last updated October 30, 2026.
