Problem
MCP endpoints (/mcp/sse, /mcp/message) currently require OAuth2 interactive authentication, making them unsuitable for:
- Programmatic access (CI/CD, automation, webhooks)
- Service accounts & API keys
- Non-browser MCP clients (Claude Code, custom agents, monitoring tools)
- Enterprise LDAP/SAML deployments (see Discussion How can I use MCP server with ldap auth ? #1496)
Current Limitation
- Session IDs from SSE handshake are ephemeral and garbage-collected when the stream closes
- No HTTP-based alternative endpoint
- No bearer token support
- No API key support
- No service account authentication
- Blocks entire category of programmatic use cases
Requested Solution
Add Spring Security filter chain for /mcp/** endpoints that:
- Accept
Authorization: Bearer <token> header
- Support static API keys or JWT tokens
- Keep OAuth2 for main UI endpoints (backward compatible)
- Enable LDAP/SAML integration via bearer tokens
Use Cases Enabled
- Claude MCP integration (Claude Code, Claude UI)
- CI/CD automation (Jenkins, GitHub Actions, GitLab CI)
- Monitoring agents (Prometheus exporters, custom collectors)
- Webhooks and event processors
- Service-to-service communication
- Enterprise LDAP/SAML with bearer token delegation
Implementation Details
- Location:
kafka-ui-api/src/main/java/io/kafbat/ui/config/McpAuthSecurityConfig.java (new)
- Scope: MCP endpoints only (/mcp/**)
- Backward Compatibility: Full (OAuth2 remains default for UI)
- Effort: ~2-4 hours
- Example:
curl -H 'Authorization: Bearer your-api-key' https://kafka-ui/mcp/sse
Why This Matters
MCP (v1.3.0+) is a powerful feature, but without programmatic authentication, it's unusable for automation. Currently:
- Users must manually extract browser SESSION cookies (hack, not production-ready)
- Session IDs expire unpredictably (ephemeral architecture)
- Cannot integrate with Claude AI or other AI agents
- Blocks enterprise adoption (LDAP users especially)
References
Community Impact
This would:
Problem
MCP endpoints (
/mcp/sse,/mcp/message) currently require OAuth2 interactive authentication, making them unsuitable for:Current Limitation
Requested Solution
Add Spring Security filter chain for
/mcp/**endpoints that:Authorization: Bearer <token>headerUse Cases Enabled
Implementation Details
kafka-ui-api/src/main/java/io/kafbat/ui/config/McpAuthSecurityConfig.java(new)curl -H 'Authorization: Bearer your-api-key' https://kafka-ui/mcp/sseWhy This Matters
MCP (v1.3.0+) is a powerful feature, but without programmatic authentication, it's unusable for automation. Currently:
References
Community Impact
This would: