# auth.md

You are an agent. This service supports **agentic registration**: discover → register → (claim if needed) → exchange for an access_token → call API → handle revocation. Follow the steps in order; do not skip ahead.

This service is **La Excelente Pizzería Napolitana** (Providencia, Santiago, Chile).

## Step 1 — Discover

Discovery is two hops.

The Protected Resource Metadata (PRM) is available at:
`https://laexcelente.cl/.well-known/oauth-protected-resource`

### 1a. Fetch the Protected Resource Metadata

```http
GET /.well-known/oauth-protected-resource HTTP/1.1
Host: laexcelente.cl
```

Response:

```json
{
  "resource": "https://laexcelente.cl/",
  "resource_name": "La Excelente Pizzería Napolitana",
  "authorization_servers": ["https://laexcelente.cl/"],
  "scopes_supported": ["read:menu", "read:restaurant", "write:orders"],
  "bearer_methods_supported": ["header"],
  "resource_documentation": "https://laexcelente.cl/auth.md"
}
```

### 1b. Fetch the Authorization Server metadata

```http
GET /.well-known/oauth-authorization-server HTTP/1.1
Host: laexcelente.cl
```

## Step 2 — Register

Agents register at the registration endpoint declared in the `agent_auth` block:

```http
POST /oauth/register HTTP/1.1
Host: laexcelente.cl
Content-Type: application/json

{
  "client_name": "MyAgent/1.0",
  "identity_type": "agent",
  "credential_type": "bearer_token"
}
```

## Step 3 — Token Exchange & API Usage

Exchange credentials for access tokens and call protected APIs with the Bearer header:

```http
GET /api/menu HTTP/1.1
Host: laexcelente.cl
Authorization: Bearer <access_token>
```

### Public Resources (No Token Required)
- Menu JSON: `/.well-known/agent-skills/menu.json`
- MCP Server Card: `/.well-known/mcp/server-card.json`
- Agent Skills Index: `/.well-known/agent-skills/index.json`
- LLM Context: `/llms.txt`
- AI Catalog: `/.well-known/ai-catalog.json`
