keycloak
An MCP server for Keycloak, designed to work with Keycloak for identity and access management, covering, Users, Realms, Clients, Roles, Groups, IDPs, Authentication. Searching keycloak discourse, Native builds available.
claude mcp add --transport stdio sshaaf-keycloak-mcp-server docker run -d -p 8080:8080 -e KC_URL=https://keycloak.example.com -e KC_REALM=master -e OIDC_CLIENT_ID=mcp-server quay.io/sshaaf/keycloak-mcp-server:latest \ --env KC_URL="Keycloak base URL" \ --env KC_REALM="Default Keycloak realm (e.g., master)" \ --env OIDC_CLIENT_ID="OAuth2/OpenID Connect client ID used by the MCP server"
How to use
The Keycloak MCP Server provides programmatic access to Keycloak administration via the Model Context Protocol (MCP). It enables AI assistants and development tools to manage users, realms, clients, roles, groups, and authentication flows through a standardized MCP interface backed by Keycloak's Admin Client. The server supports SSE (Server-Sent Events) transport for HTTP-based communication, and is designed for production-ready deployment in OpenShift or Kubernetes environments. To use it, run the server in a container (as shown in the quick start) and connect your MCP client to the SSE endpoint, providing a Bearer JWT token issued by Keycloak for authentication. Your MCP client can then issue requests to perform operations such as creating users, configuring realms, or managing clients and roles within Keycloak, all through the MCP abstraction.
How to install
Prerequisites:
- Docker (for container deployment) or a Java development environment if you prefer building from source
- Java JDK 11+ and Maven if building from source
- Access to a Keycloak instance for integration and authentication
Installation options:
-
Run via Docker (quick start):
- Ensure Docker is installed and running
- Start the MCP server container:
docker run -d
--name keycloak-mcp-server
-p 8080:8080
-e KC_URL=https://keycloak.example.com
-e KC_REALM=master
-e OIDC_CLIENT_ID=mcp-server
quay.io/sshaaf/keycloak-mcp-server:latest
-
Build from source and run locally (optional):
- mbt prerequisites installed (JDK and Maven)
- Clone the repository and navigate to the project directory
- Build: mvn clean package
- Run the application (example using Quarkus jar): java -jar target/quarkus-app/quarkus-run.jar
-
Pull and run pre-built image (alternative container approach):
- docker pull quay.io/sshaaf/keycloak-mcp-server:latest
- docker run -d -p 8080:8080 quay.io/sshaaf/keycloak-mcp-server:latest
Prerequisite notes:
- The MCP server relies on Keycloak accessibility and proper network routing from the host or cluster where it runs.
- If you deploy to Kubernetes/OpenShift, configure the corresponding deployment descriptors and Secrets for KC_URL, KC_REALM, and client credentials.
Additional notes
Tips and common considerations:
- The server uses JWT tokens issued by Keycloak for authentication. Ensure your MCP client obtains a valid token and passes it in the Authorization header when connecting to the SSE endpoint.
- The default exposed port is 8080; adjust firewall and ingress rules accordingly when deploying behind load balancers.
- If you plan to run in production, consider configuring TLS termination at the ingress and avoiding expose of the internal port directly.
- For Kubernetes/OpenShift deployments, use the provided container image and apply the standard MCP deployment patterns and health checks.
- Review the docs folder (docs/index.md and related guides) for authentication, OpenShift deployment, and developers guide to customize behavior.
- When using the container image, environment variables (KC_URL, KC_REALM, OIDC_CLIENT_ID) should reflect your Keycloak deployment and OAuth client configuration.
Related MCP Servers
mcp-for-beginners
This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
sonarqube
SonarQube MCP Server
wanaku
Wanaku MCP Router
quarkus-workshop-langchain4j
Quarkus Langchain4J Workshop
WigAI
Bitwig Controller Extension that provides an MCP Server for AI Agent control
vertx
A Vert.x MCP Server built on top of MCP Java SDK