ext-apps/examples/lazy-auth-server/src
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mel Ludowise fcc4b03bde
Add lazy-auth-server example (#679)
Adds an example MCP App server demonstrating lazy (on-demand) OAuth:
the server connects and lists tools without authentication, and only
prompts for auth when a protected tool is called, by responding 401
with a WWW-Authenticate header pointing at protected-resource metadata.

- Public `show_auth_button` app calls the protected `get_secret` tool
  via callServerTool; the host runs the OAuth flow on 401 and retries
- Embedded mock authorization server (authorization-code + PKCE,
  short-lived HS256 tokens, refresh + session revocation) so the whole
  flow runs from a single process
- TTL-scoped endpoint paths (/ttl/<seconds>/mcp) let slow or automated
  clients request longer-lived tokens per connection, threaded through
  OAuth via RFC 8707 resource indicators
- `elicit_url` / `elicit_by_error` tools demonstrating URL elicitation
2026-06-01 11:19:53 +01:00
..
global.css Add lazy-auth-server example (#679) 2026-06-01 11:19:53 +01:00
mcp-app.css Add lazy-auth-server example (#679) 2026-06-01 11:19:53 +01:00
mcp-app.ts Add lazy-auth-server example (#679) 2026-06-01 11:19:53 +01:00
secret-app.ts Add lazy-auth-server example (#679) 2026-06-01 11:19:53 +01:00