MPP Service Discovery
Before writing code
Fetch live docs:
- Fetch
https://paymentauth.org/draft-payment-discovery-00.htmlfor the canonical service discovery specification - Web-search
mpp service discovery openapi x-payment-info llms.txtfor implementation examples - Web-search
site:mpp.dev directoryfor the MPP payments directory and listing requirements - Fetch
https://mpp.dev/overviewfor discovery-related documentation
Conceptual Architecture
What Service Discovery Does
MPP service discovery allows AI agents to autonomously find, understand, and pay for HTTP services. It uses two mechanisms:
- OpenAPI Document — Machine-readable API spec with payment extensions
- llms.txt — Human/AI-readable service description for LLM agent discovery
OpenAPI Document (GET /openapi.json)
Services publish an OpenAPI 3.x document with two custom extensions:
x-service-info (Top-Level)
{
"openapi": "3.0.0",
"info": { "title": "My Paid API", "version": "1.0.0" },
"x-service-info": {
"categories": ["compute", "data", "media"],
"docs": {
"apiReference": "https://api.example.com/docs",
"homepage": "https://example.com",
"llms": "https://api.example.com/llms.txt"
}
}
}
x-payment-info (Per-Operation)
{
"paths": {
"/api/data": {
"get": {
"summary": "Get premium data",
"x-payment-info": {
"intent": "charge",
"method": "tempo",
"amount": "100",
"currency": "0x20C000000000000000000000b9537d11c60E8b50",
"description": "$0.01 per request"
},
"responses": {
"200": { "description": "Premium data" },
"402": { "description": "Payment required" }
}
}
}
}
}
x-payment-info Fields
| Field | Required | Description |
|---|---|---|
intent | Yes | "charge" or "session" |
method | Yes | Payment method (e.g., "tempo", "stripe") |
amount | No | Price (null for dynamic pricing) |
currency | Yes | Currency identifier (contract address for crypto, code for fiat) |
description | No | Human-readable pricing description |
Discovery Properties
amountcan benullfor dynamic pricing — the 402 challenge remains authoritative- Discovery data is advisory only — agents should still handle the actual 402 challenge
- Servers should include
Cache-Control: max-age=300 - Size limit: 64 KB per OpenAPI document
- Registries recrawl every 24 hours minimum
- Services are delisted after 7+ consecutive crawl failures
llms.txt
A text file (analogous to robots.txt) describing the service for autonomous agents:
# My Paid API
> AI-powered data analysis service
## Endpoints
- GET /api/analyze — Analyze data ($0.05/request, Tempo USDC)
- GET /api/summarize — Summarize text ($0.02/request, Tempo USDC)
## Pricing
All prices in USDC. Volume discounts available via session payments.
## Authentication
Payments via MPP (HTTP 402). No API key required.
## Contact
support@example.com
MPP Payments Directory
Services can be listed in the MPP payments directory (100+ services):
- Categories: model providers, developer tools, compute, data vendors
- Listing requires a valid OpenAPI document with
x-payment-info - Directory recrawls services periodically
Implementation Pattern
app.get('/openapi.json', (c) => {
return c.json({
openapi: '3.0.0',
info: { title: 'My API', version: '1.0.0' },
'x-service-info': {
categories: ['data'],
docs: { llms: 'https://api.example.com/llms.txt' },
},
paths: {
'/api/data': {
get: {
summary: 'Get data',
'x-payment-info': {
intent: 'charge',
method: 'tempo',
amount: '100',
currency: '0x20C000000000000000000000b9537d11c60E8b50',
description: '$0.01 per request',
},
responses: {
'200': { description: 'Data returned' },
'402': { description: 'Payment required' },
},
},
},
},
});
});
app.get('/llms.txt', (c) => {
return c.text(`# My API\n> Premium data service\n\n## Endpoints\n...`);
});
Best Practices
- Include both
openapi.jsonandllms.txtfor maximum discoverability - Keep the OpenAPI document under 64 KB
- Set
Cache-Control: max-age=300on discovery endpoints - Include all payable operations with 402 responses declared
- Use descriptive
descriptionfields for human-readable pricing - Update discovery documents when pricing changes
- Register with the MPP payments directory for broader visibility
Fetch the latest service discovery specification from paymentauth.org for exact extension schemas, directory listing requirements, and llms.txt format before implementing.