MCP-UI Delegated Authentication Proposal #142
tylerrowsell
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This proposal outlines a delegated authentication system for MCP-UI that enables secure access to protected resources hosted on MCP servers. The system uses JWT tokens obtained through a three-party flow, allowing iframe-rendered resources to authenticate and access protected endpoints.
Key Innovation: Custom Auth Payloads
Resources define their own authentication requirements by including:
authUrl: The endpoint where tokens should be requestedauthPayload: Arbitrary JSON payload containing whatever authentication data is neededThis flexibility allows each resource to specify exactly what it needs for authentication without MCP-UI needing to understand the specifics.
Architecture Flow
sequenceDiagram participant Client as Client (MCP-UI) participant Remote as Remote Server participant Host as Host MCP Server participant Protected as Protected Resources (Host) Note over Client,Host: Initial Resource Fetch Remote->>Host: MCP tool call requesting resources Host->>Remote: Returns UI resources (with auth requirements) Remote->>Client: Provides resources for rendering Client->>Client: Renders resources in iframe Note over Client,Host: Authentication Flow Client->>Client: iframe emits auth intent on load Client->>Client: Check token cache alt Token not cached or expired Client->>Remote: Request token (authUrl + authPayload) Note over Remote,Host: Pre-established server-to-server auth Remote->>Host: Request delegated token Host->>Host: Validate remote server auth Host->>Host: Generate JWT based on authPayload Host->>Remote: Return JWT token Remote->>Client: Return token to client Client->>Client: Cache token Client->>Client: Send token to iframe else Token cached Client->>Client: Return cached token to iframe end Note over Client,Host: Protected Resource Access Client->>Protected: Request with JWT token Protected->>Protected: Validate JWT Protected->>Client: Return protected contentDetailed Flow
1. Resource Creation & Delivery
2. Authentication Intent
When an iframe loads, it automatically emits an authentication intent:
3. Token Request Chain
4. Token Caching
authUrl + authPayloadcombination5. Protected Resource Access
Once the iframe has the JWT token, it can directly access protected resources on the host MCP server:
Benefits
Flexibility
authUrlandauthPayloadEfficiency
Security
Implementation Requirements
Client (MCP-UI)
Remote Server
Host MCP Server
Example Resource with Auth
Conclusion
This delegated authentication system provides a flexible, secure way for MCP-UI resources to access protected data. By allowing resources to define their own
authUrlandauthPayload, the system supports diverse authentication requirements without requiring changes to MCP-UI itself. The token caching mechanism ensures efficiency, while the direct access pattern to protected resources maintains performance.Beta Was this translation helpful? Give feedback.
All reactions