Edge / CDN · vercel.json Headers

Vercel vercel.json Headers, MIME Types & Static /.well-known/ Hosting

Configure Vercel Edge Network vercel.json headers and rewrite exclusions to serve /.well-known/agent-card.json, MCP server.json, and extensionless RFC 9728/8414 metadata as strict application/json.

Manifest Parameters

Zero Telemetry · Strict CSP
Authentication & OAuth Scopes
RFC 9728 Protected Resource Metadata Options
Exact Well-Known Endpoint URL application/json
https://agent.example.com/.well-known/oauth-protected-resource
/.well-known/oauth-protected-resource
{
  "resource": "https://agent.example.com/mcp",
  "authorization_servers": [
    "https://auth.example.com"
  ],
  "scopes_supported": [
    "agent:invoke",
    "mcp:tools",
    "mcp:read"
  ],
  "bearer_methods_supported": [
    "header"
  ],
  "resource_name": "Acme Cloud Assistant",
  "resource_documentation": "https://docs.example.com/agents"
}
curl Verification Command
curl -i "https://agent.example.com/mcp"
curl -fsSL "https://agent.example.com/.well-known/oauth-protected-resource" | jq .
curl -fsSL "https://auth.example.com/.well-known/oauth-authorization-server" | jq .
HTTP 401 WWW-Authenticate Header (RFC 9728 / MCP-PRO-002)
WWW-Authenticate: Bearer resource_metadata="https://agent.example.com/.well-known/oauth-protected-resource", scope="agent:invoke mcp:tools mcp:read"
Live Well-Known Audit 98.4% Lack Agent Cards

Verify live A2A, MCP, OAuth & AEO discovery in production

In RungLab's N=140 B2B SaaS Readiness Benchmark, 98.4% (62/63) of full-telemetry domains lacked agent-card.json. Audit your live domain with ReadyCheck, cut MCP schema token tax with MCPDiet, or automate fleet discovery checks via Apify & RapidAPI.

Required Endpoints, Paths & MIME Types

Path / Endpoint Purpose Required Content-Type
public/.well-known/agent-card.json Static file served directly by Vercel Edge Network application/json; charset=utf-8
public/.well-known/oauth-protected-resource Extensionless static file requiring explicit Content-Type override in vercel.json application/json; charset=utf-8

Production vercel.json for Agent Discovery + SPA Rewrite Safety

vercel.json
{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "headers": [
    {
      "source": "/.well-known/(agent-card\\.json|mcp/server\\.json|oauth-protected-resource.*|oauth-authorization-server.*)",
      "headers": [
        { "key": "Content-Type", "value": "application/json; charset=utf-8" },
        { "key": "Access-Control-Allow-Origin", "value": "*" },
        { "key": "Access-Control-Allow-Methods", "value": "GET, HEAD, OPTIONS" },
        { "key": "Cache-Control", "value": "public, max-age=300" },
        { "key": "X-Content-Type-Options", "value": "nosniff" }
      ]
    }
  ],
  "rewrites": [
    {
      "source": "/((?!\\.well-known/|assets/|api/).*)",
      "destination": "/index.html"
    }
  ]
}

Verify Vercel Extensionless MIME & Status via curl

verify-vercel.sh
curl -fsSI "https://yourdomain.com/.well-known/oauth-protected-resource" | grep -iE "content-type|access-control|cache-control"
curl -fsSL "https://yourdomain.com/.well-known/agent-card.json" | jq .

Key Empirical & Architectural Takeaways

  • Extensionless static files in public/.well-known/oauth-protected-resource frequently default to application/octet-stream or trigger browser downloads unless vercel.json explicitly overrides Content-Type: application/json; charset=utf-8.
  • On Vite/React SPAs deployed to Vercel, a greedy "source": "/(.*)" rewrite swallows /.well-known/* unless excluded with a negative lookahead or placed inside public/.well-known/.
  • Do not enable Vercel Deployment Protection on production domains if external A2A orchestrators and ReadyCheck audits need unauthenticated access to public discovery cards.

Common Production Pitfalls to Avoid

  • Setting trailingSlash: true in vercel.json injects 308 redirects onto discovery paths.
  • Duplicating conflicting Cache-Control headers between vercel.json and Next.js route handlers.
  • Serving 404 errors as HTML 200 pages instead of true HTTP 404 JSON when an optional discovery file is absent.

More Agent Discovery Specifications & Framework Guides

← Back to AI Agent Discovery Generator & Validator Hub

Frequently Asked Questions

Why does Vercel serve /.well-known/oauth-protected-resource as binary download instead of JSON?

Because the RFC 9728 filename has no .json extension, static CDNs cannot infer application/json from extension alone. Add the explicit Content-Type: application/json; charset=utf-8 rule in vercel.json shown above.

Will public/.well-known/ files survive Vite or Next.js builds on Vercel?

Yes — both Vite and Next.js copy files from public/ into the final build output root, preserving the .well-known/ directory.

Should I set Access-Control-Allow-Origin: * on /.well-known/* in vercel.json?

Yes. Public discovery documents contain zero private credentials and browser-based MCP/A2A inspectors require CORS headers to read them.