|
| 1 | +--- |
| 2 | +title: Overview |
| 3 | +slug: / |
| 4 | +--- |
| 5 | + |
| 6 | +MCP OAuth Proxy is an open-source OAuth 2.1 proxy server that adds authentication and authorization to MCP (Model Context Protocol) servers. |
| 7 | + |
| 8 | +## What is MCP OAuth Proxy? |
| 9 | + |
| 10 | +MCP OAuth Proxy acts as a bridge between OAuth providers (Google, Microsoft, GitHub) and MCP servers, providing: |
| 11 | + |
| 12 | +- **OAuth 2.1 Compliance** - Full OAuth 2.1 authorization server with PKCE support |
| 13 | +- **MCP Integration** - Seamless proxy to MCP servers with user context injection |
| 14 | +- **Multi-Provider Support** - Works with any OAuth 2.0 provider via auto-discovery |
| 15 | +- **Database Flexibility** - PostgreSQL for production, SQLite for development |
| 16 | + |
| 17 | +## Architecture |
| 18 | + |
| 19 | +The proxy sits in front of your MCP server to handle OAuth 2.1 authentication and validate user identity from external providers. |
| 20 | + |
| 21 | +Here's how it works: |
| 22 | + |
| 23 | +1. **OAuth 2.1 Flow** - When a client needs access, the proxy redirects to an external auth provider (Google, Microsoft, GitHub) to verify user identity |
| 24 | +2. **Token Issuance** - Once authentication is complete, the proxy issues an access token back to the client |
| 25 | +3. **MCP Auth Compliance** - Follows the MCP authentication specification and works with any compatible MCP client |
| 26 | +4. **Request Proxying** - Validates the access token and forwards authenticated requests to your MCP server |
| 27 | +5. **User Context** - Sends necessary headers to the MCP server about user identity and access to external services based on the OAuth scopes you configured |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +The proxy supports PostgreSQL for production deployments and SQLite for development, with automatic schema creation and encrypted storage for sensitive data. |
| 32 | + |
| 33 | +## Headers Sent to MCP Server |
| 34 | + |
| 35 | +When proxying requests to your MCP server, the OAuth proxy automatically injects the following headers with user information: |
| 36 | + |
| 37 | +| Header | Description | Example | |
| 38 | +| -------------------------- | ----------------------------------------- | ---------------------- | |
| 39 | +| `X-Forwarded-User` | User ID from the OAuth provider | `12345678901234567890` | |
| 40 | +| `X-Forwarded-Email` | User's email address | `[email protected]` | |
| 41 | +| `X-Forwarded-Name` | User's display name | `John Doe` | |
| 42 | +| `X-Forwarded-Access-Token` | OAuth access token for external API calls | `ya29.a0ARrdaM...` | |
| 43 | + |
| 44 | +These headers allow your MCP server to: |
| 45 | + |
| 46 | +- **Identify the user** making the request |
| 47 | +- **Personalize responses** based on user information |
| 48 | +- **Make authenticated API calls** to external services using the access token |
| 49 | +- **Implement user-specific logic** and access controls |
| 50 | + |
| 51 | +:::note |
| 52 | +Headers are only set if the corresponding user information is available from the OAuth provider. If a property is not available, the header is removed to avoid stale data. |
| 53 | +::: |
| 54 | + |
| 55 | +## Next Steps |
| 56 | + |
| 57 | +- [Getting Started](/getting-started) - Quick setup guide |
0 commit comments