Signed Egress, Web Bot Auth & UCP Commerce

Run RFC 9421 HTTP message signing, Web Bot Auth key directories, and Universal Commerce Protocol (REST & MCP) natively inside agentmesh-node with zero sidecars.

When an agent talks to external merchants, payment gateways, or Web Bot Auth verifiers, plain API keys are no longer enough:

  1. Verifiable outbound requests (RFC 9421 + RFC 9530): The verifier checks a cryptographic HTTP message signature (Signature / Signature-Input) and Content-Digest bound to the exact method, authority, path, headers, and body.
  2. Public HTTPS key discovery behind NAT: The verifier must fetch the signer’s public key (/.well-known/jwks.json, /.well-known/http-message-signatures-directory, or /.well-known/ucp-profile.json) over public HTTPS even when the egress node runs on a private network.
  3. Zero secrets in the agent: Signing keys stay in the egress node’s --secrets-dir, and payment credentials never enter the agent (checkout returns a human continue_url).

The runnable example in development/examples/egress-commerce/ runs Web Bot Auth (WBA) and Universal Commerce Protocol (UCP 2026-08-25, REST & MCP) live against https://flowers.ucpsandbox.com using only stock agentmesh-one and agentmesh-node binaries — zero external sidecars and zero custom plugins.


How the Egress-to-Ingress Loop Works

sequenceDiagram
  participant Agent as Calling Agent (0 external secrets)
  participant PEP as agentmesh-node (PEP · --secrets-dir)
  participant Router as agentmesh-router (Kademlia DHT + HTTPS)
  participant Merchant as flowers.ucpsandbox.com

  Note over PEP,Router: Startup: PEP signs public JWKS + UCP profile with its Ed25519 peer key and publishes to Kademlia DHT
  PEP->>Router: DirectoryProvide(PeerKey, SignedIngressDocuments)

  Agent->>PEP: POST /egress/flowers.ucpsandbox.com/mcp (Mesh Biscuit only)
  Note over PEP: 1. Biscuit + RBAC/TAR<br/>2. Declarative transforms (UCP-Agent, MCP meta)<br/>3. Content-Digest + ES256 RFC 9421 + Signature-Agent
  PEP->>Merchant: Signed HTTPS request

  Merchant->>Router: GET /ingress/<peer_id>/.well-known/http-message-signatures-directory
  Note over Router: Verifies Ed25519 peer_signature offline<br/>Serves directly from DHT (0 hop to PEP)
  Router-->>Merchant: 200 OK (JWKS + pre-signed headers + nosniff + CSP sandbox)

  Merchant-->>PEP: 200 OK / 201 Created (catalog / continue_url)
  PEP-->>Agent: Verified response

Three native Agent Mesh primitives make this work without an external proxy:

  1. Outbound RFC 9421 signing (egress[].signing): Loads an ES256 (P-256) or Ed25519 PEM bundle from --secrets-dir (first key signs; all keys publish for zero-downtime rotation), computes Content-Digest: sha-256=:...:, passes tag verbatim, emits Signature-Agent from key_directory_url, and signs after content inspection and credential brokering.
  2. Signed read-only Kademlia DHT documents (publish_public_key + ingress_documents): The PEP signs .well-known/jwks.json, pre-signed .well-known/http-message-signatures-directory, and any templated JSON/text documents (such as .well-known/ucp-profile.json using {{public_jwks}}) with its Ed25519 libp2p identity key. Routers replicate the signed bundle via Kademlia and serve GET/HEAD /ingress/<peer_id>/<path> directly with zero inbound stream opened to the PEP node.
  3. Stateless declarative transforms (egress[].transforms): Sets protocol headers (UCP-Agent, default Idempotency-Key: {{uuid}}) and injects JSON fields (params.arguments.meta["ucp-agent"].profile on MCP tools/call) before Content-Digest and RFC 9421 signing. Protected headers (Authorization, Cookie, Host, Signature*, X-Mesh-*) cannot be modified.

Policy Configuration

One EgressDestination in development/examples/egress-commerce/policy.json configures WBA, UCP REST, and UCP MCP together:

{
  "name": "flowers.ucpsandbox.com",
  "served_by": ["mesh:role:node"],
  "signing": {
    "key": "commerce-operator.pem",
    "tag": "web-bot-auth",
    "publish_public_key": true,
    "key_directory_url": "{{ingress_url}}/.well-known/http-message-signatures-directory",
    "extra_headers": ["ucp-agent", "idempotency-key"]
  },
  "ingress_documents": [
    {
      "path": ".well-known/ucp-profile.json",
      "content_type": "application/json",
      "body_template": "{\"ucp\":{\"version\":\"2026-08-25\",\"capabilities\":{\"dev.ucp.shopping.checkout\":[{\"version\":\"2026-08-25\",\"spec\":\"https://ucp.dev/2026-08-25/specification/shopping/checkout/\",\"schema\":\"https://ucp.dev/2026-08-25/schemas/shopping/checkout.json\"}]}},\"keys\":{{public_jwks}}}"
    }
  ],
  "transforms": [
    {
      "set_headers": {
        "UCP-Agent": "profile=\"{{ingress_url}}/.well-known/ucp-profile.json\""
      }
    },
    {
      "match": { "methods": ["POST", "PUT", "PATCH", "DELETE"] },
      "default_headers": {
        "Idempotency-Key": "{{uuid}}"
      }
    },
    {
      "match": {
        "methods": ["POST"],
        "path_prefix": "/mcp",
        "json_equals": { "method": "tools/call" }
      },
      "set_json": [
        {
          "path": ["params", "arguments", "meta", "ucp-agent", "profile"],
          "value": "{{ingress_url}}/.well-known/ucp-profile.json",
          "only_if_absent": true
        }
      ]
    }
  ]
}

Run It Yourself

make build
TUNNEL=cloudflare ./development/examples/egress-commerce/run.sh

The script boots agentmesh-one with a public Cloudflare HTTPS tunnel, posts policy.json, starts a stock agentmesh-node PEP with a freshly generated P-256 key in --secrets-dir, verifies all three signed DHT documents over HTTPS, and executes live UCP MCP (search_catalog, create_checkout) and UCP REST (POST /ucp/checkout-sessions → 201 Created) calls against flowers.ucpsandbox.com.


When to Use an External Adapter (PAP 1.0 / Poppy)

agentmesh-node stays intentionally stateless. Protocols that require a persistent per-user OAuth token database and interactive human browser redirects (GET /oauth/callback) — such as Personal Agent Protocol (PAP 1.0 / Poppy) — belong in an external adapter behind egress:// (target_url + preserve_host: true + forward_context: true). Reference Go packages for PAP 1.0 live in development/examples/egress-commerce/external-pap/.

Next Steps