What Gets Protected
When you configureauth=MyAuthProvider(), all MCP endpoints are automatically protected:
- All tools
- All resources
- All prompts
Quick Start
How It Works
BearerAuthProvider
Extend this class and implementverify_token():
AccessToken
claims
Theclaims dictionary stores user information that your tools can access during request handling. You decide what to include based on your application’s needs.
Common fields:
sub- User ID (standard JWT claim)email- User’s email addressname- Display name- Custom fields like
plan,org_id,role, etc.
scopes
Use for permission checks in your tools:"admin" in token.scopes.
Accessing Token Data in Tools
Since the middleware already validates authentication, these helpers are for accessing user information from the token - not for protection.Client Configuration
HTTP Responses
All 401 responses include the
WWW-Authenticate: Bearer header.
All MCP protocol traffic (
/mcp/*) requires authentication - this includes all tools, resources, and prompts. Debug paths like /docs, /inspector, /health, and /openmcp.json are excluded by default.