OAuth Scope Migration - Three-Tier Model
Summary
Simplified the OAuth scope model from 65+ granular scopes to a three-tier permission system.New Scope Model
Three Scopes
-
api:read
- Read-only access to all resources- List operations (campaigns, creatives, brand agents, etc.)
- Get operations (retrieve specific resources)
- Analytics and reporting
- Product discovery
-
api:manage
- Create, update, delete resources- Campaign management
- Creative operations
- Brand agent management
- Brand stories and standards
- Tactics and media buys
- Signal management
-
api:admin
- Administrative operations- Sales agent registration/management
- Signals agent registration/management
- Webhook registration
- System-level configuration
WorkOS Configuration Required
Configure these scopes in WorkOS atidentity.scope3.com
:
-
Resource Server:
https://api.agentic.scope3.com/mcp
-
Scopes to Add:
-
Discovery Endpoint: Ensure
https://identity.scope3.com/.well-known/openid-configuration
includes these scopes inscopes_supported
Code Changes Made
Files Modified
-
src/auth/mcp-auth-config.ts
- Replaced
TOOL_SCOPES
with simplified three-tier model - Updated
getAllScopes()
to return only three scopes - Remapped all tools in
TOOL_SCOPE_MAPPING
to new scopes
- Replaced
-
src/__tests__/auth/mcp-auth-dual.test.ts
- Updated tests to validate three-tier model
- Changed scope assertions to match new model
- All tests passing ✅
Tool Scope Assignments
READ (api:read
): 35 tools
- List operations: campaigns_list, creatives_list, brand_agents_list, etc.
- Get operations: campaigns_get_summary, creatives_get, brand_agents_get, etc.
- Analytics: assets_analytics, metrics_show_agentic, reporting_export_data
- Discovery: products_list, sales_agents_list, signals_list_custom
api:manage
): 43 tools
- Create operations: campaigns_create, creatives_create, brand_agents_create
- Update operations: campaigns_update, creatives_update, tactics_update
- Delete operations: campaigns_delete, creatives_delete, media_buys_delete
- Assignments: creatives_assign, creatives_unassign, signals_activate
api:admin
): 7 tools
- Agent registration: sales_agents_register, signals_agents_register
- Agent management: sales_agents_update, signals_agents_update
- Unregistration: sales_agents_unregister, signals_agents_unregister
- Webhooks: webhooks_register
Migration Benefits
- Simplicity: 3 scopes vs 65+ - much easier to reason about
- Standards-compliant: Follows common OAuth patterns (read/write/admin)
- Easier client integration: Simple permission model for API consumers
- Future-proof: Room to add finer-grained scopes later if needed
- Backward compatible: API key auth still grants all scopes
Testing
All authentication tests pass:- Three-tier scope model
- Tool scope mappings
- API key authentication (grants all scopes)
- Scope validation logic
Next Steps
- ✅ Code updated and tested
- ⏳ Configure WorkOS with three scopes
- ⏳ Verify OIDC discovery returns new scopes
- ⏳ Test OAuth flow with new scope model
- ⏳ Deploy to production