Reference resolver implementation for NAIS identifiers. This is the public resolver powering resolver.nais.id.
The resolver takes a domain and returns structured NAIS identity data:
- Looks up
_agent.<domain>DNS TXT records - Parses the NAIS record fields (
v,manifest,mcp,auth,pay) - Fetches the
/.well-known/agent.jsonmanifest - Validates the manifest against the NAIS schema
- Returns a normalized JSON response
GET https://resolver.nais.id/resolve.php?domain=example.com
{
"ok": true,
"cached": false,
"domain": "example.com",
"resolver_version": "0.1",
"discovery": {
"agent_txt_host": "_agent.example.com"
},
"dns": {
"agent_records": ["v=nais1; manifest=https://example.com/.well-known/agent.json"]
},
"resolved": {
"manifest_url": "https://example.com/.well-known/agent.json",
"mcp_endpoint": "https://example.com/mcp",
"auth": ["wallet"],
"payments": ["x402"],
"version": "nais1"
},
"manifest": {
"fetched": true,
"http_status": 200,
"data": { ... },
"validation": {
"valid": true,
"errors": [],
"warnings": []
}
}
}resolve.php # Main resolver endpoint
.htaccess # Apache URL rewriting
cache/ # Filesystem cache (300s TTL)
- PHP 8.1+
- Apache with mod_rewrite (or equivalent)
dns_get_record()function enabled
- HTTPS-only manifest fetching with full TLS verification
- Redirect limit (max 3 hops)
- Cross-domain redirect detection
- Response size cap (1 MiB)
- Request/connection timeouts
- CORS headers
Drop the files into any PHP-capable web server. The resolver uses filesystem caching with a 300-second TTL. Ensure the cache/ directory is writable by the web server.