The open-source protocol for the agentic ad economy.
Merchants pay AI agents to prioritize and display their products during user conversationsβwith zero-config discovery, signed bidding, Proof of Human, and mandatory transparency. E-commerce transacts on the last mile of the conversation with proof, not promises.
Quick Start Β· Merchant onboarding Β· Concepts Β· Development
Two parties, one protocol: merchants bid for placement; agents show sponsored recommendations only when a real human is in the loop. Every impression is attested, disclosed, and settled via a Proof of Impression receipt.
| π Merchant | π€ AI Agent | |
|---|---|---|
| Goal | Get products in front of humans in conversation | Monetize the last mile with paid, verifiable ads |
| Deploys | .well-known/fairad.json + Merchant MCP |
Discovery crawler + MCP client |
| Gets | Qualified impressions, settlement on proof | Payment commitment + rich product metadata |
| Guide | Merchant onboarding β | Concepts & protocol β |
- Zero-config discovery β
fairad.jsonatdomain.com/.well-known/fairad.json; crawler builds a local merchant directory for agents. - Signed bidding β Merchant MCP returns product metadata (Markdown/JSON) and a Payment Commitment: a cryptographic promise to pay $X upon proof of human-verified impression.
- Proof of Human (PoH) β
X-FairAd-Human-Tokenin the handshake; attestations from Worldcoin, Privy, or OIDC. Payment commitments are binding only when PoH is valid. - Mandatory transparency β Sponsored replies must include "Sponsored Recommendation from [Merchant]"; the Proof of Impression hash includes this disclosure.
- Proof of Impression (PoI) β Ad-receipt combining bid signature + human token + disclosure hash; the invoice for settlement.
git clone https://github.com/Fairfetch-co/fairad.git
cd fairad
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
make setup-devFor merchants β serve a manifest and run the Ad-Server
Host fairad.json at https://yourdomain.com/.well-known/fairad.json:
{
"mcp_endpoint": "https://yourdomain.com/mcp",
"public_key": "<base64 Ed25519 public key>",
"bidding_categories": ["electronics", "apparel"],
"currency": "USD",
"min_bid": "100"
}export FAIRAD_MERCHANT_DOMAIN=yourdomain.com
export FAIRAD_MERCHANT_NAME="Your Store"
python -m mcp_server.serverFor AI agents β discover and query
# Discover merchants (crawls .well-known/fairad.json)
python examples/run_discovery.py example.com
# MCP Inspector: connect and call get_sponsored_context
npx @modelcontextprotocol/inspector python -m mcp_server.serverHTTP API (same semantics as MCP):
make dev-api
# API runs on http://localhost:8403
curl -X POST http://localhost:8403/sponsored-context -H "Content-Type: application/json" -d '{"category":"electronics"}'| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/manifest |
GET | FairAd manifest (same as .well-known/fairad.json) |
/well-known/fairad.json |
GET | Manifest at well-known path |
/sponsored-context |
POST | Body: { "category": "electronics", "amount": "100" }. Header: X-FairAd-Human-Token for binding commitment |
/settlement/submit |
POST | Submit Proof of Impression JSON; returns settlement_id |
/settlement/status/{id} |
GET | Status of a settlement |
# Get sponsored context (no PoH)
curl -X POST http://localhost:8403/sponsored-context -H "Content-Type: application/json" -d '{"category":"electronics"}'
# Submit PoI for settlement
curl -X POST http://localhost:8403/settlement/submit -H "Content-Type: application/json" -d @receipt.jsonSet FAIRAD_POH_STRICT=true to enforce:
- OIDC β When you have the raw token, use
verify_poh_with_token(raw_token)to verify JWT signature against the issuerβs JWKS (.well-known/jwks.json). - Worldcoin / Privy β Non-empty
subjectand (in strict mode)signaturerequired.
The settlement ledger accepts PoI receipts at POST /settlement/submit. It validates:
- Payment Commitment signature (Ed25519)
- Disclosure hash format (
sha256:+ 64 hex chars) - Unique
poi_id(no duplicate submissions)
Optional: set FAIRAD_LEDGER_PATH=/path/to/ledger.json to persist settlements to disk. By default the ledger is in-memory.
python scripts/poi_generator.py \
--commitment commitment.json \
--human-token poh_token.json \
--merchant-name "Example Merchant" \
--snippet "Sponsored Recommendation from [Example Merchant]\nProduct snippet..." \
-o receipt.json- Discovery β Agent crawls
/.well-known/fairad.json, getsmcp_endpoint,public_key,bidding_categories,min_bid. - Signed bidding β Agent calls Merchant MCP
get_sponsored_context(category, amount?, human_token?). Receives product metadata + Payment Commitment (signed). Commitment is binding only ifhuman_tokenis valid PoH. - Transparency β Agent must append "Sponsored Recommendation from [Merchant]" to the UI. Disclosure is hashed into the Proof of Impression.
- Proof of Impression β On human-verified impression, agent builds PoI: commitment + PoH token id + disclosure hash. This is the settlement invoice.
fairad/
βββ api/ # HTTP API (REST wrapper)
β βββ main.py # FastAPI app, CORS
β βββ routes.py # /manifest, /sponsored-context, /settlement
βββ settlement/ # Ledger stub
β βββ ledger.py # Accepts PoI, validates, persists (optional)
βββ docs/
β βββ CONCEPTS.md # Protocol concepts and headers
β βββ MERCHANT_ONBOARDING.md
β βββ PROTOCOL_STANDARDS.md # RFCs and world standards
β βββ WELL_KNOWN_SPEC.md
βββ interfaces/ # Open standard types
β βββ manifest.py # fairad.json schema
β βββ payment.py # Payment Commitment
β βββ poh.py # Proof of Human attestation
βββ core/ # Signing, PoH, transparency, PoI
β βββ signatures.py
β βββ poh_verifier.py
β βββ transparency.py
β βββ transparency_middleware.py
β βββ poi.py
β βββ url_validation.py # SSRF protection
βββ discovery/ # Zero-config discovery
β βββ crawler.py
βββ mcp_server/ # Merchant MCP (Ad-Server)
β βββ logic.py
β βββ server.py
βββ scripts/
β βββ poi_generator.py
β βββ run_api.py
βββ examples/
β βββ well-known/fairad.json
β βββ run_discovery.py
βββ tests/
βββ .github/workflows/
βββ pyproject.toml
βββ Makefile
βββ LICENSE # Apache 2.0
FairAd follows world-standard protocols:
- Well-known URI β RFC 8615 for
/.well-known/fairad.json. - HTTPS β TLS in production; discovery blocks private IPs and SSRF targets.
- Ed25519 β RFC 8032 for Payment Commitments and PoI.
- JSON β RFC 8259; OIDC/JWT for Proof of Human.
See docs/PROTOCOL_STANDARDS.md for the full list. SECURITY.md for reporting and best practices.
| Guide | What's inside |
|---|---|
| Merchant onboarding | Publish your manifest and run the Ad-Server |
| Concepts | Terms, headers, and flows in plain language |
| Protocol standards | RFCs and world standards (well-known, HTTPS, Ed25519) |
| Development | Local setup, running services, testing |
| Contributing | How to contribute, CLA, code standards |
| Security | Reporting vulnerabilities and security measures |
| Code of Conduct | Community standards |
Apache 2.0 β use it freely, commercially or otherwise.
Docs Β· Issues Β· Contributing
Built so merchants and AI agents can transact on the last mile of the conversationβwith proof, not promises.