MCP Authentication
The Auth Chain
┌─────────────────────────────────────────────────┐
│ External agent │
│ signs JWT with agent's signing key │
└────────────────┬────────────────────────────────┘
│ Authorization: Bearer <jwt>
▼
┌─────────────────────────────────────────────────┐
│ Brain edge │
│ - Validates JWT signature │
│ - Resolves principal (tenant + scopes) │
└────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ MCP dispatcher │
│ Three pre-call checks: │
│ 1. Agent record in `agents` is `active` │
│ 2. JWT `scope_hash` claim matches on-chain │
│ hash in BrainMCPAgentRegistry │
│ (verified once, cached 60 s per agent) │
│ 3. JWT `tenant_id` equals agent's tenant │
└────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ Per-tool scope enforcement │
│ Method dispatcher checks the called tool's │
│ scope against the agent's granted scopes │
└─────────────────────────────────────────────────┘JWT Structure
Claim
Purpose
On-Chain Scope Verification
Step
Check
The Capability Scopes
Scope
Allows
Per-Call Scope Enforcement
Error Codes: two surfaces
Code
Meaning
Token Lifetimes
Token
TTL
Refreshable
Revoking an Agent
Path
Effect
What's Next
Last updated
