OAuth 2.1 Authentication for Kafka MCP Server
Overview
Features
Architecture
OAuth Flow
┌─────────────────┐
│ MCP Client │
│ (Cursor, etc) │
└────────┬────────┘
│
│ Bearer Token
│ Authorization: Bearer <token>
▼
┌─────────────────────────────────┐
│ HTTP Server │
│ │
│ ┌──────────────────────────┐ │
│ │ OAuth Middleware │ │
│ │ - Token Extraction │ │
│ │ - Token Validation │ │
│ │ - User Context Inject │ │
│ └──────────┬───────────────┘ │
│ ▼ │
│ ┌──────────────────────────┐ │
│ │ MCP Server Handler │ │
│ │ /mcp endpoint │ │
│ └──────────────────────────┘ │
└─────────────────────────────────┘
│
▼
┌─────────────────┐
│ Kafka Cluster │
└─────────────────┘Implementation Architecture
OAuth Modes
Native Mode (Client-Managed)
Proxy Mode (Server-Managed)
Supported Providers
1. HMAC (Development/Testing)
2. Okta
3. Google
4. Azure AD (azure)
Environment Variables
HTTP Server Configuration
Variable
Description
Default
Required
OAuth Configuration
Variable
Description
Default
Required
OIDC Configuration
Variable
Description
Required
Proxy Mode Only
Variable
Description
Required
OAuth Endpoints
Discovery Endpoints
Proxy Mode Endpoints
MCP Endpoint
Testing OAuth
Local Testing with HMAC Provider
Testing with Token
Security Considerations
Production Requirements
Environment-Specific Recommendations
Troubleshooting
Server Fails to Start
OAuth Endpoints Return 404
Token Validation Fails
Graceful Shutdown Issues
Code Examples
Accessing User Context in Tools
Custom OAuth Configuration
Migration Guide
From STDIO to HTTP with OAuth
References
Support
Last updated
Was this helpful?