ADR-012: MCP Tools Architecture β RBAC & Multi-Tenant Governance
Metadataβ
| Field | Value |
|---|---|
| Status | β Accepted |
| Date | 16 January 2026 |
| Author | Christophe + Claude |
| Linear | CAB-602 (Epic) |
Contextβ
STOA expose des MCP Tools aux agents IA et dΓ©veloppeurs. L'architecture actuelle (20 tools, 7 scopes) est insuffisante pour:
- GranularitΓ© RBAC β Pas de distinction claire entre personas (Admin vs Developer vs Consumer vs Agent)
- Multi-tenancy β Namespace tools hardcodΓ©, pas de dynamic generation
- Agent Governance β Manque de framework pour contrΓ΄ler les agents IA (attestations, policy gates)
- ScalabilitΓ© β Tools statiques vs gΓ©nΓ©ration dynamique depuis UAC contracts
Decisionβ
Refactorer l'architecture MCP Tools selon le pattern Core + Proxied avec RBAC granulaire par persona.
Architectureβ
Pattern: Core vs Proxied Toolsβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STOA MCP Tool Registry β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β CORE TOOLS (35 static) β PROXIED TOOLS (dynamic) β
β βββββββββββββββββββββββββ β ββββββββββββββββββββββββββ β
β stoa_{domain}_{action} β {tenant}:{api}:{operation} β
β Built-in, versioned β Generated from UAC contracts β
β Platform management β Business API exposure β
β β β
β Examples: β Examples: β
β - stoa_list_apis β - acme:crm:search_customers β
β - stoa_get_metrics β - acme:billing:create_invoice β
β - stoa_create_subscription β - beta:inventory:check_stock β
β β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Tool Categories (35 Core Tools)β
| Category | Count | Tools |
|---|---|---|
| Platform & Discovery | 6 | stoa_platform_info, stoa_health_check, stoa_list_tools, stoa_get_tool_schema, stoa_search_tools, stoa_get_config |
| API Catalog | 8 | stoa_list_apis, stoa_get_api, stoa_search_apis, stoa_get_api_versions, stoa_create_api, stoa_deploy_api, stoa_undeploy_api, stoa_deprecate_api |
| Subscriptions & Access | 6 | stoa_list_subscriptions, stoa_get_subscription, stoa_create_subscription, stoa_update_subscription, stoa_revoke_subscription, stoa_rotate_api_key |
| Observability & Metrics | 8 | stoa_get_metrics, stoa_get_metrics_timeseries, stoa_get_slow_requests, stoa_list_alerts, stoa_list_errors, stoa_get_error_details, stoa_get_error_snapshot, stoa_analyze_errors |
| UAC Contracts | 4 | stoa_validate_contract, stoa_import_openapi, stoa_export_openapi, stoa_export_mcp |
| Security & Compliance | 3 | stoa_get_security_score, stoa_list_audit_events, stoa_scan_vulnerabilities |
OAuth2 Scopes (12 scopes)β
| Scope | Description | Tier |
|---|---|---|
stoa:platform:read | Read platform config & health | Community |
stoa:platform:write | Modify platform config | Enterprise |
stoa:catalog:read | Browse API catalog | Community |
stoa:catalog:write | CRUD APIs | Enterprise |
stoa:subscriptions:read | View own subscriptions | Community |
stoa:subscriptions:write | Manage subscriptions | Community |
stoa:metrics:read | Access metrics & analytics | Community |
stoa:logs:technical | App logs (debug, traces) | Enterprise |
stoa:logs:functional | Business logs (API calls) | Community |
stoa:logs:full | All logs including PII (masked) | Enterprise |
stoa:security:read | View audit trails, compliance | Enterprise |
stoa:security:write | Security operations, scans | Enterprise |
RBAC Matrix β 6 Personasβ
1. Platform Administrator (stoa.admin)β
| Attribute | Value |
|---|---|
| Description | Full platform control |
| Scopes | ALL |
| Tools Access | ALL 35 core + all proxied |
| Tier | Enterprise / Partner |
2. API Product Owner (stoa.product_owner)β
| Attribute | Value |
|---|---|
| Description | Manages API lifecycle for their team |
| Scopes | catalog:*, subscriptions:*, metrics:read, logs:technical, logs:functional |
| Tools Access | Catalog CRUD, Subscriptions, Metrics, Errors |
| Constraints | Own team APIs only |
3. API Developer (stoa.developer)β
| Attribute | Value |
|---|---|
| Description | Builds and deploys APIs |
| Scopes | catalog:read, catalog:write (dev/staging only), metrics:read, logs:technical |
| Tools Access | Deploy dev/staging, Read metrics/errors |
| Constraints | Own team APIs, non-prod environments |
4. API Consumer (stoa.consumer)β
| Attribute | Value |
|---|---|
| Description | Uses APIs via subscriptions |
| Scopes | catalog:read, subscriptions:read, subscriptions:write (own), metrics:read (own usage) |
| Tools Access | Browse catalog, Manage own subscriptions, View own usage |
5. Security Officer (stoa.security)β
| Attribute | Value |
|---|---|
| Description | Compliance, audit, security oversight |
| Scopes | security:*, logs:full, metrics:read, catalog:read |
| Tools Access | Audit trails, Security scans, Compliance reports |
| Constraints | Read-only by default, approval gates for actions |
6. AI Agent (stoa.agent)β
| Attribute | Value |
|---|---|
| Description | Autonomous AI agent (Claude, GPT, custom) |
| Scopes | Whitelist-only (defined per agent registration) |
| Tools Access | Explicitly whitelisted tools only |
| Constraints | 10min token TTL, mandatory attestations, policy gates (OPA), full audit |
Agent Governance Frameworkβ
Security Layersβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Agent Request Flow β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β 1. Authentication (OAuth2 + DPoP/mTLS) β
β βββ Verify agent identity, check token validity β
β β
β 2. Whitelist Check β
β βββ Is this tool in agent's allowed list? β
β β
β 3. Policy Gate (OPA) β
β βββ Evaluate business rules (time, data sensitivity, etc.) β
β β
β 4. Attestation Required? β
β βββ If sensitive action, require signed attestation β
β β
β 5. Execute & Audit β
β βββ Run tool, log everything, return result β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Token Securityβ
| Mechanism | Standard | Purpose |
|---|---|---|
| DCR | RFC 7591/7592 | Dynamic Client Registration |
| DPoP | RFC 9449 | Proof-of-Possession (public clients) |
| mTLS | RFC 8705 | Cert-bound tokens (confidential clients) |
| Short TTL | β | 10min max for agents |
MCP Resources (15)β
| Resource URI | Description |
|---|---|
stoa://platform/info | Platform metadata |
stoa://platform/health | Health status |
stoa://apis | API catalog list |
stoa://apis/{id} | Single API details |
stoa://apis/{id}/versions | API version history |
stoa://subscriptions | User's subscriptions |
stoa://subscriptions/{id} | Single subscription |
stoa://metrics/{api_id}/summary | API metrics summary |
stoa://metrics/{api_id}/timeseries | Time-series data |
stoa://errors/{api_id}/recent | Recent errors |
stoa://errors/{snapshot_id} | Error snapshot detail |
stoa://alerts/active | Active alerts |
stoa://audit/events | Audit trail |
stoa://security/score | Security posture |
stoa://tools | Available tools for current user |
Comparison: Before vs Afterβ
| Aspect | Before | After |
|---|---|---|
| Core Tools | 20 (flat) | 35 (structured by domain) |
| OAuth2 Scopes | 7 | 12 (granular) |
| Personas | Implicit | 6 explicit with RBAC matrix |
| Multi-tenant | Hardcoded namespace | Dynamic {tenant}:{api}:{op} |
| Agent Governance | None | Full framework (whitelist, attestations, policy gates) |
| Tool Generation | Manual | Auto from UAC contracts |
Consequencesβ
Positiveβ
- β Enterprise-grade access control (RBAC by persona)
- β Scalable multi-tenant architecture
- β Safe AI agent integration with policy gates
- β Automatic tool exposure from UAC contracts
- β Compliance-ready (NIS2/DORA audit trails)
Negativeβ
- β οΈ Migration effort for existing integrations
- β οΈ Increased complexity in authorization layer
- β οΈ OPA policy maintenance overhead
Mitigationsβ
- Backward compatibility layer for v1 tools during migration
- Policy templates for common use cases
- Gradual rollout by tenant
Referencesβ
- RFC 7591/7592 β Dynamic Client Registration
- RFC 9449 β DPoP (Proof-of-Possession)
- RFC 8705 β mTLS Certificate-Bound Tokens
- MCP Specification
- OPA
- ADR-001: API Exposure Strategy