One question, two tool calls
A plain question becomes Keycloak Admin API calls.
Which groups is asmith in, in realm acme?
The answer/engineering
searchUsers({ realm: "acme", search: "asmith" }) // returns asmith's user id
getUserGroups({ realm: "acme", userId: <asmith's id> }) // [{ name: "engineering", path: "/engineering" }]
Run against the sample realm that ships with the project.
Careful by default
The write tools change a live server, so the server limits them.
Deletes ask first
Deletes and realm-level changes run only after you accept a confirmation dialog in the MCP client. Clients without dialogs can set
MCP_CONFIRM_MODE=flag, where the call needsconfirm=true.The master realm is off limits
Every write tool refuses
master, because it holds the Keycloak administrators.Secrets stay hidden
Tools that return client secrets exist only when
MCP_CLIENT_SECRETS_ENABLED=true.Each user keeps their own roles
Over HTTP the server has no Keycloak identity of its own. It exchanges each user's token and calls Keycloak as that user, so Keycloak checks the user's own admin roles.
Three ways to run
Run it as a local stdio process, as a shared HTTP server behind your reverse proxy, or on Kubernetes from the Helm chart.
# the exchange client's secret is in the Secret keycloak-mcp-exchange
helm install keycloak-mcp oci://ghcr.io/strengthened/charts/keycloak-mcp \
--version <chart version> -n keycloak-mcp \
--set keycloakUrl=https://keycloak.example.com \
--set publicUrl=https://mcp.example.com/mcp \
--set exchangeClientSecret.existingSecret=keycloak-mcp-exchange
A restricted pod
The pod meets the Pod Security "restricted" profile, and the values schema rejects overrides that break it.
Probes on a private port
The kubelet checks
/q/health/*on port 9000, which no Service, Ingress or HTTPRoute of the chart reaches. The pod turns ready once it reaches the issuer realm.Your choice of route
Expose the server with an Ingress, a Gateway API HTTPRoute or your own proxy, and limit its traffic with a NetworkPolicy.
The secret stays out of Helm
Point the chart at an existing Secret, for example one made by External Secrets or Sealed Secrets.
Documentation
Before you use it
The risks of letting an MCP client change a Keycloak server, and how to limit them.
Read the risksConnect Claude Code
The container images, the admin service account, and a shared HTTP server, on its own or on Kubernetes with the Helm chart.
Connect a clientContribute
Report a bug
Open an issue with the steps that reproduce it.
Send a change
Read the contributing guide. Every commit needs a Developer Certificate of Origin sign-off.