Skip to main content
Glama

AgentGate

CI Release License Go

AgentGate is an open-source gateway for the agentic web. It is a single static Caddy v2 binary that sits in front of an existing website, store or REST API — or next to an existing Nginx, Apache or LiteSpeed in sidecar mode — and exposes five standard agent-facing interfaces with zero changes to your origin backend and zero LLM calls:

  AI Agents (Claude, ChatGPT, Codex, x402 & UCP clients)
                         │
                         ▼
  ┌──────────────────────────────────────────────────────┐
  │                  AgentGate (Caddy v2)                │
  │  /llms.txt · *.md · /mcp · x402 · /acp/* · /ucp/*    │
  └──────────────────────────┬───────────────────────────┘
                             │  front_proxy (HTTP / php_fastcgi)
                             │  or sidecar (Nginx / Apache / LiteSpeed)
                             ▼
     Your existing website, WooCommerce store, or REST API
  1. Content — /llms.txt, /llms-full.txt, per-section /llms-{section}.txt, .md mirrors of indexed pages and safe Accept: text/markdown negotiation, with offline token estimates.

  2. Tools — an MCP server (Streamable HTTP, official Go SDK) with site and catalog search and tools generated from OpenAPI 3.0/3.1.

  3. Payments — a non-custodial x402 paywall (v2, v1 compatible) for EVM networks on HTTP routes and individual MCP tools.

  4. ACP — Agentic Commerce Protocol: product feed, checkout sessions with Stripe Shared Payment Tokens, order webhooks.

  5. UCP — Universal Commerce Protocol: discovery, JWKS, signed checkout with 3DS browser escalation, order webhooks.

Commerce works with WooCommerce (Store API + REST v3), schema.org JSON-LD stores (browser hand-off), digital catalogs and any backend through a signed webhook protocol. Checkout follows an Order-First saga: the order exists in your store before the card is charged, and every step is journaled so a crash never loses money or orders.

Install

Homebrew (macOS / Linux):

brew install ronskii2/tap/agentgate

Docker (distroless multi-arch OCI image):

docker pull ghcr.io/ronskii2/agentgate:latest

Prebuilt binaries: download linux/darwin (amd64/arm64) static archives and checksums.txt from GitHub Releases.

Build from source (Go 1.26.10+):

git clone https://github.com/ronskii2/agentgate.git
cd agentgate
make build   # produces CGO-free static binary at bin/agentgate

Related MCP server: x402-mcp-commerce

Modular by design — start read-only, enable more later

Every layer (content, mcp, x402, commerce) is toggled independently in agentgate.yaml. You do not have to adopt payments or commerce to use AgentGate:

What you want to do

Modules to enable

Risk to existing traffic

Add /llms.txt, *.md mirrors, Accept: text/markdown & MCP docs search to Nginx / Apache / WordPress

content + mcp (sidecar)

None — browsers stay on your origin

Expose an OpenAPI REST API as paid MCP tools & HTTP x402 endpoints (USDC)

mcp + x402

None — paywall applies only to configured rules

Add ACP (ChatGPT) & UCP (Google) checkout with Stripe SPT to WooCommerce or a custom backend

commerce (+ optional content/mcp)

Isolated under /acp/*, /ucp/*, /.well-known/*

Sell digital downloads directly to agents with Stripe or x402

commerce (driver: digital) + mcp

Isolated endpoints; 0% marketplace fees

Live demo & 5-second site audit

Live in production (read-only content + mcp sidecar behind Nginx + Cloudflare):

Before changing any config on your own site, run agentgate audit (human output or --json for agents):

agentgate audit https://yoursite.com --profile docs      # or: api | store | wordpress
agentgate audit https://yoursite.com --profile docs --json

Sample run against https://caddyserver.com/ (docs profile):

  • Audit result: 26/100 — HTTPS passes, while /llms.txt, Accept: text/markdown, and /mcp return 404 (commerce checks are marked n/a and not penalized).

  • HTML → Markdown conversion on https://caddyserver.com/docs/quick-starts/caddyfile (deterministic Readability + CommonMark, zero LLM calls): 37,258 bytes (14,039 tokens) → 1,772 bytes (454 tokens) — 96.8% fewer tokens, with navigation, sidebars, scripts, and footers stripped while preserving prose, links, and code blocks.

Quick start

agentgate init --domain shop.example.com --profile docs --mode sidecar --server nginx
agentgate validate --config agentgate.yaml
agentgate run --config agentgate.yaml
agentgate audit https://shop.example.com --profile docs

Operator guides: front_proxy mode (AgentGate is the web server) and sidecar mode (behind an existing Nginx, Apache or LiteSpeed). Ready-made test beds live in examples/.

Set up with your AI coding agent

Every AgentGate command is non-interactive with deterministic exit codes and --json audit output. This repository also ships an agent index (llms.txt) and a ready-to-use Agent Skill (skills/agentgate/SKILL.md).

To let Claude Code, Codex, Cursor, or another agent set it up for you, edit only the first two lines below and paste the block:

My site: https://YOUR-DOMAIN.com
Modules I want: read-only content + MCP (or add: x402, commerce/woocommerce, commerce/digital)

Use AgentGate (https://github.com/ronskii2/agentgate) and follow skills/agentgate/SKILL.md to set it up for my site above:
1. Run `agentgate audit <my site> --json` and summarize what is missing.
2. Only enable the modules I listed above (keep unused modules disabled; start in `sidecar` mode if Nginx/Apache/LiteSpeed already serves my site so human browser traffic is untouched).
3. Generate `agentgate.yaml` and any web-server snippets with `agentgate init`, keep all secrets strictly in environment variables (never in YAML or git), and run `agentgate validate` until there are zero errors.
4. Start AgentGate, run `agentgate sync`, verify locally before reloading the web server, and confirm the live endpoints (`/llms.txt`, `.md`, `Accept: text/markdown`, `/mcp`).
5. Only if I enabled payments or commerce, walk me step-by-step through the external account steps I need to complete (Stripe restricted key permissions, OpenAI/Stripe ACP feed submission, Google Merchant Center UCP link, or x402 `pay_to` wallet).

Commands

Command

Purpose

agentgate init

Generate agentgate.yaml and web-server snippets for a profile (api, store, docs, wordpress) and mode

agentgate validate [--online]

Check the configuration; refuse placeholder wallets, non-restricted Stripe keys, missing merchant data; --online verifies the token contract over RPC

agentgate run / reload / stop

Run the server (Caddy commands, with the AgentGate config adapter)

agentgate audit URL

Score what agents see on a site, per profile, without manipulative penalties

agentgate sync

Re-index content, reload the catalog, push the ACP product feed

agentgate refunds

List x402 payments that need a manual refund; record the refund transaction

agentgate top

Live terminal dashboard of agent traffic, payments and orders

Principles

  • Caddy does the HTTP. TLS, HTTP/3, reverse proxying and FastCGI are Caddy's; there is no hand-written server.

  • No LLM calls. The gateway is deterministic.

  • Non-custodial. AgentGate never holds wallet keys or raw card data: x402 payments go straight to your pay_to address through a facilitator; cards are charged with Stripe Shared Payment Tokens using a restricted key.

  • Static and offline. One CGO-free binary; no network access at startup; reference data (USDC token registry, tokenizer vocabulary) is embedded.

  • Privacy. Every SQLite connection uses PRAGMA secure_delete = ON; buyer personal data is scrubbed after at most 24 hours and never reaches the logs.

Token estimates

Markdown responses and llms*.txt carry X-Estimated-Tokens: <n>; tokenizer="o200k_base". The count uses the OpenAI o200k_base BPE vocabulary embedded in the binary (no network access) and equals tiktoken's count for that encoding. For models outside the OpenAI o200k_base family it is an approximation: other tokenizers split text differently, most of all in non-English scripts and in code.

Honest boundaries

The first two limits are part of the product definition (SPEC §1.2) and are printed by every agentgate audit:

  • Protocol readiness is not platform listing. Deploying /.well-known/ucp, /acp/* and the product feed covers the technical requirements of ACP and UCP. A native buy button inside the closed storefronts of ChatGPT and Google additionally requires merchant registration with those platforms (a partner application and feed submission to OpenAI/Stripe for ACP; linking Google Merchant Center for UCP).

  • x402 cannot paywall open HTML. x402 enforces payment on every configured API endpoint, MCP tool, data export and paid resource, regardless of User-Agent. Public HTML pages that stay open to humans without authorization cannot be protected with 402 from a scraper that perfectly imitates a browser, without also showing a paywall to real visitors.

  • Token counts are estimates outside the o200k_base family (see above).

  • Bot identity is only as strong as its proof. Web Bot Auth signatures and reverse-DNS checks of search crawlers are verified; a User-Agent alone is never trusted for anything but analytics.

Performance

Measured with make bench (SPEC §8.1: vegeta, 1000 RPS, 100 connections, 60 s, local mock upstream). Latest run (bench/results/):

Measure

SPEC budget

Measured

HTML proxying overhead, p99 vs stock Caddy

≤ 1.5 ms

below noise (2.67 ms vs 3.22 ms)

Cached Markdown, p99

≤ 3.0 ms

1.64 ms

Idle memory, 1 site (10k pages, 50k offers)

≤ 120 MiB

90 MiB

Each additional active site

≤ +15 MiB

+4 MiB

Static binary (linux/amd64)

≤ 95 MiB

74 MiB

OCI image, compressed / uncompressed

≤ 40 / 100 MiB

28 / 81 MiB

Development

make build                 # bin/agentgate
make test                  # unit + end-to-end tests, no network
make conformance-offline   # protocol conformance against the frozen specs, network disabled
make conformance-live      # release gate: real Base Sepolia x402 payment, WooCommerce + Stripe test mode
make bench                 # SPEC §8.1 measurements

docs/SPEC.md is the specification and docs/PHASES.md maps every requirement to its implementation and test. Protocol details come only from the frozen upstream sources in testdata/specs/upstream/.

License

Apache-2.0. See LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      A
      maintenance
      Self-hosted MCP gateway that registers upstream MCP servers and fronts them behind one governed Streamable HTTP endpoint: per-tool access control by caller API key, guardrails over tool arguments and results, rate limits, and usage logs. The same Rust gateway also proxies LLM and A2A agent traffic.
      1
      243
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      An open-source, zero-dependency Model Context Protocol (MCP) server and HTTP 402 payment gateway built for Cloudflare Workers and Node.js. This project enables AI agents (Claude Desktop, Cursor, etc.) to natively discover, negotiate, and autonomously pay for digital resources over Solana USDC using standardized MCP tools and standard HTTP 402 Payment Required headers.
      MIT