Skip to content

Conversation

@Aveerayy
Copy link

Summary

This PR introduces User Session and Authorization Management for MCP servers, enabling per-user authentication isolation and governance for MCP tool access. When enabled, each user maintains their own OAuth session per MCP server, ensuring proper access control and session isolation.

Key Changes

  1. User Session Auth Toggle - Added userSessionAuth field to MCP server configuration allowing administrators to enable per-user session isolation
  2. Okta Identity Provider Integration - Integrated Okta as an identity provider with support for both Authorization Server and Org Authorization Server modes (for enterprises without API Access Management)
  3. Database Schema Extension - Extended mcp_oauth_session table with userId tracking and added new indexes for efficient user-scoped queries
  4. User-Context Tool Execution - Added toolCallWithUserAuth() method that checks user authentication status before executing MCP tools
  5. Inline Authentication UI - Created McpAuthRequiredCard component for seamless in-chat authorization prompts when tools require authentication

Impact & Benefits

  • Session Isolation: Each user maintains isolated OAuth sessions per MCP server
  • Token Relay: User access tokens are properly relayed to MCP tools for downstream authorization validation
  • Administrative Control: Administrators can enable/disable authentication requirements per MCP server
  • Enterprise Support: Supports enterprise Okta deployments without requiring the paid API Access Management feature
  • Seamless UX: Users are prompted inline within the chat when authentication is required, with OAuth flow handled via popup

Configuration

To enable User Session Authorization for an MCP server:

  1. Navigate to MCP Configuration
  2. Edit the MCP server
  3. Enable "User Session Authorization" toggle
  4. Configure the auth provider (Okta/OAuth2) with issuer, client ID, and scopes

Files Changed

  • src/lib/db/pg/schema.pg.ts - Schema extensions for user session tracking
  • src/lib/ai/mcp/ - OAuth provider and client manager updates
  • src/app/api/mcp/user-oauth/ - New API routes for user OAuth flow
  • src/components/mcp-editor.tsx - UI for configuring user session auth
  • src/components/mcp-auth-required-card.tsx - Inline auth prompt component
  • src/lib/auth/ - Okta configuration with Org Authorization Server support

- Add Okta as social authentication provider with OKTA_ISSUER support
- Add Google/Microsoft force account selection flags
- Respect DISABLE_EMAIL_SIGN_IN and DISABLE_SIGN_UP environment variables
- Update OAuth documentation with Okta setup and configuration options
- Implement secret tainting for enhanced security
This PR introduces User Session and Authorization Management for MCP servers,
enabling per-user authentication isolation and governance for MCP tool access.

Key Changes:
- Added userSessionAuth toggle to MCP server configuration for per-user session isolation
- Integrated Okta as identity provider with support for both Authorization Server and Org Authorization Server modes
- Extended database schema with userId tracking in mcp_oauth_session table
- Added toolCallWithUserAuth() method for user-context-aware tool execution
- Created inline authentication prompt UI for seamless in-chat authorization flow

Impact:
- Each user maintains isolated OAuth sessions per MCP server
- User access tokens are properly relayed to MCP tools for downstream authorization
- Administrators can enable/disable authentication requirements per MCP server
- Supports enterprise Okta deployments without API Access Management feature
@vercel
Copy link

vercel bot commented Dec 26, 2025

@Aveerayy is attempting to deploy a commit to the cgoinglove's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant