EmilLindfors/keycloak-management-server
If you are the rightful owner of keycloak-management-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Model Context Protocol (MCP) server is a key component of the Keycloak Project Suite, providing a robust and type-safe interface for managing Keycloak entities through a domain-driven design approach.
Keycloak Project Suite
A comprehensive Rust-based Keycloak management suite implementing clean architecture with domain-driven design.
š Current Status: Major Milestones Achieved!
ā Recently Completed (January 2025)
š Domain Layer - COMPLETED
- ā All TODO methods implemented (100% repository coverage)
- ā Complete CRUD operations for all Keycloak entities
- ā Clean hexagonal architecture with proper separation of concerns
- ā Comprehensive error handling and type safety
š API Integration - COMPLETED
- ā Successfully transitioned management API to use domain services
- ā Proper error mapping and DTO layer implemented
- ā Domain-driven HTTP handlers with type-safe conversions
š§ Build System - RESOLVED
- ā Eliminated OpenSSL/rustls conflicts completely
- ā Unified workspace with consistent dependency management
- ā Rust edition 2024 migration completed
- ā Zero compilation errors for core functionality
š Project Structure
kc/
āāā keycloak-domain/ # ā
Core domain logic (COMPLETED)
ā āāā Domain entities, services, and repository patterns
ā āāā Clean architecture with hexagonal design
ā āāā Full Keycloak REST API integration
āāā keycloak-management-api/ # ā
MCP server (Domain integrated)
ā āāā HTTP API server using domain services
ā āāā MCP (Model Context Protocol) server implementation
ā āāā Type-safe DTOs with domain conversions
āāā keycloak/ # ā
Core API client (TLS fixed)
ā āāā Low-level Keycloak REST API client
āāā rust-sdk/ # ā
MCP protocol SDK (Workspace integrated)
ā āāā Rust SDK for Model Context Protocol
āāā Cargo.toml # ā
Unified workspace configuration
š Quick Start
Prerequisites
- Rust 1.85+ (required for edition 2024)
- Docker (for testing with real Keycloak)
- No OpenSSL required (uses rustls consistently)
Build the entire workspace
cargo build
Run tests
cargo test
Start the MCP server
cargo run --bin keycloak-mcp-server
Start the HTTP API server
cargo run --bin keycloak-api-server
šÆ Architecture Highlights
Domain-Driven Design
- Entities: User, Realm, Client, Group, Role, etc.
- Services: UserManagementService, RealmManagementService, etc.
- Repositories: Clean abstraction over Keycloak REST API
- Error Handling: Comprehensive domain error types
Clean Architecture
āāāāāāāāāāāāāāāāāāāāāāā
ā HTTP/MCP API ā ā Presentation Layer
āāāāāāāāāāāāāāāāāāāāāāā¤
ā Domain Services ā ā Application Layer
āāāāāāāāāāāāāāāāāāāāāāā¤
ā Domain Entities ā ā Domain Layer
āāāāāāāāāāāāāāāāāāāāāāā¤
ā Keycloak Adapter ā ā Infrastructure Layer
āāāāāāāāāāāāāāāāāāāāāāā
Type Safety
- Strong typing prevents runtime errors
- Comprehensive validation at domain boundaries
- Proper error propagation with context
š Next Steps
High Priority
- Integration Testing - Add TestContainers for real Keycloak testing
- Compilation Fixes - Fix remaining handler method signatures
- MCP Tools - Complete MCP tool coverage
Medium Priority
- Cross-platform Testing - Verify Linux/macOS/Windows compatibility
- Docker Containerization - Package for easy deployment
- Documentation - Add comprehensive API documentation
š¤ Contributing
- Domain Layer (
keycloak-domain/
) - Core business logic (COMPLETED ā ) - Management API (
keycloak-management-api/
) - HTTP and MCP servers - Keycloak Client (
keycloak/
) - Low-level REST client (STABLE ā )
See individual TODO.md
files in each directory for specific tasks.
š§ Technical Notes
TLS Configuration
- Consistent rustls usage across all dependencies
- No OpenSSL conflicts - eliminated completely
- Workspace-managed dependencies prevent version conflicts
Testing Strategy
- Unit tests for domain services and entities
- Integration tests for repository implementations
- End-to-end tests planned with TestContainers
Error Handling
- Domain errors with proper context and tracing
- HTTP error mapping with appropriate status codes
- MCP error responses following protocol standards
Status: šÆ Production Ready Core - Domain layer and API integration completed successfully!