Keycloak MCP server authentication: what the official guide covers and what it does not
Before any AI client signs in through your company identity provider, decide which part of the Keycloak MCP story you are approving. The official Keycloak guide, Integrating with Model Context Protocol (MCP), covers Keycloak acting as the OAuth authorization server for MCP servers. It was added in Keycloak 26.5.0, released January 06 2026, and Red Hat documents the same integration as Chapter 12 of the Securing Applications and Services Guide for Red Hat build of Keycloak 26.6. The guide does not describe an official Keycloak admin MCP server. Any tool that lets an AI client create users, change realms or edit clients is a separate project, and the community sshaaf/keycloak-mcp-server is one example. Treat it as a third-party component with its own review, not as part of Keycloak's documented feature set.
The official guide's conformance ratings matter for your decision. It rates MCP version 2025-03-26 as Supported with no special setup required, and it rates 2025-06-18, 2025-11-25 and 2026-07-28 as Experimental. The initial 2024-11-05 version does not cover authorization at all. Ask your engineering team which MCP specification version each client and server negotiates, and whether your approval covers only Supported versions. Confirm the guide's current wording with Keycloak directly, since ratings can change between releases. The guide also lists three client registration mechanisms (Client ID Metadata Documents, pre-registration and Dynamic Client Registration), and each one changes who can introduce a new client into your realm.
The community server's documented model is simpler and narrower in one way that matters: its README says users authenticate with their own JWT tokens from Keycloak, and its getting started guide shows an Authorization Bearer header carrying that token in Cursor and Claude Desktop configurations. Its prerequisite is a Keycloak instance of version 20.0 or later, with HTTPS for production. Before approving it, confirm that your identity team can issue those tokens, that the token's audience and scopes limit what the server can do, and that the server is run only over HTTPS. Keycloak's server administration guide lists user event and admin event auditing, which is the place to verify that changes made through any admin API are recorded.
Which MCP capabilities are documented, by source and conformance level
This table compares each Keycloak MCP capability by who documents it and, for the official guide, its conformance rating. Read the Source column first, because official Keycloak documentation and the community admin server carry very different levels of vendor backing. The main takeaway is that Keycloak documents itself as an OAuth authorization server for MCP servers, but it does not document an official admin MCP server.
| Capability | Source and status | What to confirm |
|---|---|---|
| Keycloak as MCP authorization server | Official Keycloak guide, open source (Apache-2.0) | Confirm your Keycloak version includes the guide, since it was added in 26.5.0 |
| MCP spec 2025-03-26 | Official guide rates it Supported, no special setup required | Confirm your MCP client also speaks this version |
| MCP spec 2025-06-18 | Official guide rates it Experimental | Ask Keycloak support whether it is suitable for production use |
| MCP spec 2025-11-25 | Official guide rates it Experimental | Ask Keycloak support whether it is suitable for production use |
| MCP spec 2026-07-28 | Official guide rates it Experimental | Confirm current status with the vendor, since newer editions can change |
| MCP spec 2024-11-05 | Official guide notes it does not cover authorization | Do not rely on this version for access control |
| Client registration: Client ID Metadata Documents, pre-registration, Dynamic Client Registration | Official, three mechanisms listed in the Keycloak guide | Decide which mechanism your org allows and restrict the others |
| Community admin server with user JWT authentication | Community (sshaaf/keycloak-mcp-server), not part of the Keycloak project, uses SSE transport | Review the code and maintenance status yourself before use |
| Official Keycloak admin MCP server | Not documented. The official guide does not describe one | Treat any admin MCP server as community unless Keycloak documents it |
How user tokens flow from the identity provider to the MCP server
The key design question is where the user's identity is established and where each authorization decision is enforced. In the official pattern, Keycloak acts as the OAuth authorization server for the MCP server, as described in the Keycloak guide Integrating with Model Context Protocol (MCP). The AI client is redirected to Keycloak, the user signs in there under the realm's own login policies (including any MFA or identity brokering you have configured), and the client receives an access token issued for that user. The client then presents that token to the MCP server, which validates the token's signature, issuer, expiry and audience before executing any tool. Authorization stays in the layers you control: Keycloak decides which scopes and roles the token carries, and the MCP server or the downstream system decides what those scopes permit.
The community pattern is simpler and carries more risk. The community sshaaf/keycloak-mcp-server project states that users authenticate with their own JWT tokens from Keycloak, and its getting started guide shows the token passed in an Authorization Bearer header from clients such as Cursor or Claude Desktop. The user must obtain and paste a token into client configuration, which tends to be long-lived, copied between machines and stored in plaintext config files. Confirm with the maintainers how the server validates tokens, whether it checks audience, and whether its admin operations depend on the caller's roles. Your reviewers should also confirm that the token's lifetime is short enough for the use case and that the server cannot be reached by anyone who holds a copied token.
For either pattern, plan your enforcement points before rollout: the realm's token lifetime and session settings, the scopes and roles mapped into the token, the audience the MCP server accepts, and the admin account permissions behind any user-level token. Ask the team to demonstrate that a token issued to one user cannot be replayed against a different MCP resource or used for administrative actions that user is not authorized to perform. Keycloak's server administration guide documents the user and admin event auditing you should enable so that token-driven changes are traceable to a person.
Where sign-in, token issuance and admin actions meet
The flow starts with a user signing in to Keycloak, which acts as the authorization server and issues the token the AI client presents to the MCP server. The community admin server then forwards calls to the Keycloak Admin API, and those changes are what Keycloak records as admin events. Check three hand-offs: who issues the token, which audience the MCP server accepts, and whether the admin events for those calls are enabled and retained.
Sign-in, token issuance and admin changes flow through Keycloak's own records.
Decisions to make before connecting AI clients to Keycloak
Before an AI client reaches Keycloak, a few settings decide who can register clients, which identity provider users sign in with, and who can change the realm. Each card below names one of those choices, what it affects, and what to confirm in your own environment before approval.
Choose a client registration mechanism
The official Keycloak guide lists three ways MCP clients can register: Client ID Metadata Documents, pre-registration and Dynamic Client Registration. Pre-registration gives your team a fixed list of approved clients, while open registration lets any client that can reach the realm create its own entry. Decide which mechanism your realm uses, then confirm which clients exist and who owns each one.
Keycloak MCP guideScope anonymous registration policies
The official guide says MCP Inspector needs anonymous Client Registration policies to include allowed client scopes, allowed registration web origins and trusted hosts. Each of those settings widens who can register a client without signing in. Keep them as narrow as your testing allows, and record which origins and hosts you added and why, so the list can be reviewed later.
Pick the identity provider for user sign-in
Users reach an MCP server through tokens issued by the Keycloak realm, so the identity provider behind that realm decides who can sign in and which MFA rules apply. Confirm whether users authenticate with a local Keycloak account or through a federated provider, and check that offboarding in the upstream directory also ends Keycloak sessions and tokens.
Official authorization or community admin server
The official Keycloak guide covers Keycloak as the OAuth authorization server for MCP servers, and it does not describe an official Keycloak admin MCP server. The community sshaaf/keycloak-mcp-server manages users, realms, clients and roles, and it authenticates with each user's own JWT. Treat admin tooling as a separate approval, with its own owner, rather than assuming the authorization setup covers it.
Community server repositorySet TLS for production, HTTP only for development
The community getting started guide lists HTTPS for production and HTTP for development. Tokens travel in the Authorization Bearer header, so plain HTTP exposes them to anyone on the network path. Decide before rollout that production Keycloak and MCP endpoints use HTTPS, and confirm that development HTTP endpoints are never reachable from staff laptops on shared networks.
Getting started guideLimit who holds admin roles
Any account with realm admin rights can change clients, roles and identity providers, and an MCP admin server acts with that account's permissions. Keycloak's administration guide documents auditing of user events and admin events, which records changes made through the Admin API. Name a small set of admins, require separate accounts for AI-assisted work, and confirm in your environment that admin event logging is enabled and retained.
Keycloak admin guideHow the answer changes by deployment and identity setup
In the simplest layout, one realm holds every user, one identity provider handles sign-in, and every MCP client trusts the same authorization server. Registration policy is easy to review because there is one place to confirm allowed client scopes, registration web origins and trusted hosts. Admin scope is also simpler, but any realm administrator can still reach every client an AI tool might register.
- Registration policy: Decide which of the three MCP registration mechanisms (Client ID Metadata Documents, pre-registration or Dynamic Client Registration) are enabled, and keep anonymous registration off unless a test client such as MCP Inspector needs it for a bounded period.
- Admin scope: Limit realm administration to a named group, and tie each community admin server's user JWT to a personal account with the narrowest realm role that works.
- Logging: Turn on user event and admin event auditing so that client registrations and Admin API changes trace back to a person.
- Identity provider: Record which upstream provider signs users in, the token lifetimes in effect, and whether an AI client session ends when a user's roles change.
Before the first AI client connects, confirm that the realm's anonymous registration setting matches the approved client list.
When business units, customers or tenants each get a realm, the realm becomes the authorization boundary. A token issued in one realm should be refused by another realm's MCP server, so issuer and audience checks must be confirmed for each realm separately. Administrators often manage more than one realm, which widens the reach of a single community admin server.
- Per-realm registration: Set each realm's client registration policy on its own, since allowed scopes, origins and trusted hosts are configured per realm.
- Cross-realm admin roles: Identify which administrator accounts can act in each realm, and keep master-realm administrators out of any workflow where an AI tool manages tenant realms.
- Token audience: Verify that each MCP server validates the issuer and audience of the user's JWT against its own realm, and test that a token from another realm is refused.
- Logging by realm: Confirm that event auditing is enabled in every realm, because each realm's events are recorded separately and a gap in one realm does not show up in the others.
Ask the platform team for a list of every realm, its registration mechanism and the accounts that can administer it before approving any AI client.
When a realm holds regulated personal data, or when an MCP server can reach records under a regulatory scope, reviewers will ask for evidence rather than convenience. They will want to know which accounts can change identity data, which AI clients were approved, and whether every registration and admin change can be shown later. DeployOpen prepares these controls and documentation for compliance assessments, but independent auditors and certification bodies issue any reports or certifications. The official Keycloak MCP guide is the starting point for confirming which registration paths exist in your version.
- Approved client list: Keep a written list of allowed MCP clients, and consider disabling Dynamic Client Registration in regulated realms so that each new client requires an admin action.
- Least-privilege roles: Make sure no account used by an AI tool can change authentication flows or client registration policies.
- Event retention: Confirm where user and admin events are stored, how long they are kept and who can read them, and compare those answers to your own retention policy.
- Transport: Keep HTTPS on every Keycloak and MCP endpoint in production, since the community server's getting started guide calls for HTTPS in production and HTTP only for development.
- Individual identity: Require each user's own JWT instead of shared service credentials, so every action traces to a named person.
Ask your compliance lead which controls need evidence, then confirm each one in the Keycloak and MCP configuration before approval.
In an air-gapped or on-premise deployment, Keycloak, the MCP server and the AI client sit inside a network without general internet access. Documentation and the community repository help with planning, but container images, packages and updates must enter through an approved path. Any registration mechanism that depends on fetching external metadata needs a local equivalent, so each path must be tested from inside the enclosed network.
- Registration mechanism: Check whether Client ID Metadata Documents can be fetched from inside the network. If they cannot, plan on pre-registration or tightly controlled Dynamic Client Registration.
- Version floor: The community server requires a Keycloak instance of version 20.0 or later, and the official MCP guide was added in Keycloak 26.5.0. Confirm that the version you run supports each feature you rely on.
- Local images: Pull the community server's container images through an internal registry, and record the exact versions that were approved.
- Admin access path: Restrict the admin console and Admin API to an internal network or jump host, and review admin events for every configuration change.
- Patch process: Document how Keycloak and the community server are patched, since neither can rely on an upstream pull inside a closed network.
Confirm with the network team which endpoints each AI client and MCP server must reach, then test every registration path from inside the enclosed network.
Order of work for a controlled Keycloak MCP rollout
This sequence moves a Keycloak MCP setup from a confirmed version baseline to a reviewed, audited rollout, so each control is checked before more users or clients depend on it.
Confirm Keycloak and MCP spec versions
The platform team records the Keycloak version running in your environment and checks it against the official MCP guide, which is part of the Keycloak 26.5.0 documentation line. Confirm which MCP specification version your clients negotiate, since the guide rates 2025-03-26 as Supported and the 2025-06-18, 2025-11-25 and 2026-07-28 versions as Experimental. Done when the team has a written record of both versions and a decision on whether Experimental features are acceptable for your risk level.
Choose one client registration mechanism
The security architect selects one of the three registration mechanisms the official guide lists: Client ID Metadata Documents, pre-registration or Dynamic Client Registration. Pick one for production and document why the others are off. Pre-registration gives the most direct review of each client, so it is the easiest to justify to an audit reviewer, but confirm the fit with your own client inventory. Done when the chosen mechanism and the list of approved MCP clients are written down and signed off by the identity owner.
Restrict anonymous client registration
The Keycloak administrator reviews the Client Registration anonymous access policies and removes any that are broader than the chosen mechanism needs. The official guide notes that MCP Inspector requires these policies to include allowed client scopes, allowed registration web origins and trusted hosts, so any loosening for testing should be time-limited and recorded. Done when a test registration from an unapproved origin is refused and the policy export is saved as evidence.
Pilot with named users and bounded scopes
A small group of named users connects an MCP client using their own tokens, not a shared service account. Limit client scopes to what the pilot needs and confirm each token's audience and roles match the MCP server's expectations. The community admin servers, if considered, use each user's JWT in the Authorization header, so confirm that every pilot admin action is traceable to one person. Done when the pilot log shows each request tied to a named user and no unexpected scope was granted.
Enable user and admin event auditing
The administrator turns on auditing of user events and admin events, which the Keycloak server administration guide describes as the feature for logging changes made through the Admin API. Decide where the events are stored and how long they are kept under your own retention policy. Test by making a harmless change through an MCP client and confirming the admin event records the actor, the resource and the time. Done when the test change appears in the audit store and the security team can query it.
Review the setup before wider rollout
The security and identity reviewers walk through the version record, the registration policy, the pilot scope and the audit evidence against your approval criteria. For any community admin server in use, confirm its transport, its deployment target and whether it requires HTTPS, since its getting started guide lists HTTPS for production and HTTP for development. Done when the reviewers sign a go or no-go decision and any open findings have named owners and a retest date.
What a security reviewer asks to see for this control
This table lists what a security reviewer should ask for before approving a Keycloak MCP setup, the question behind each item, and where the answer comes from. Read the official guide rows first, since they describe Keycloak as the authorization server, and review the community admin server as a separate component. The main takeaway is that admin actions depend on the token the server receives and on Keycloak's audit settings, so both need written evidence, starting with the Keycloak server administration guide.
| Control | Question asked | Where it comes from |
|---|---|---|
| Registration policy settings | Which client registration mechanisms are enabled (Client ID Metadata Documents, pre-registration or Dynamic Client Registration), and who may register clients? | Official Keycloak MCP guide, client registration section |
| Supported spec version | Which MCP specification versions are enabled, and which are rated Supported versus Experimental for our deployment? | Official Keycloak MCP guide conformance table; 2025-03-26 is rated Supported |
| Token issuance and audience | Which realm and client issue the user's JWT, and is the token audience limited to the MCP server? | Official Keycloak MCP guide for authorization setup; community README for user JWT use |
| Admin event logging | Are changes made through the Admin API recorded, who can read those records, and how long are they kept? | Keycloak server administration guide, auditing section |
| User event logging | Are login and token events for MCP users recorded, where are they stored, and who reviews them? | Keycloak server administration guide, auditing section |
| Community server source and version | Is the sshaaf/keycloak-mcp-server build pinned to a reviewed release, and does it meet the Keycloak version requirement? | Community repository and getting started guide, which lists Keycloak 20.0 or later |
| Deployment transport | Does production use HTTPS only, and is SSE transport restricted to approved hosts and networks? | Community getting started guide (HTTPS for production) and README (SSE, container, OpenShift, Kubernetes) |
Questions buyers ask before approving Keycloak MCP access
Does Keycloak have an official admin MCP server?
No. The official Keycloak guide, Integrating with Model Context Protocol (MCP), covers Keycloak acting as the OAuth authorization server for MCP servers. It does not describe an official Keycloak admin MCP server that lets an AI client create users, realms or clients. The guide was added in Keycloak 26.5.0, released January 06 2026, and Red Hat documents the same integration as Chapter 12 of the Securing Applications and Services Guide for Red Hat build of Keycloak 26.6. Any MCP server that administers Keycloak is therefore a third-party project, and the reviewer should treat it under vendor-neutral governance rules. Ask the team which server they plan to run, who maintains it, and whether its code has been reviewed against the Keycloak release they operate. Confirm the exact guide version that matches your deployment before relying on it.
What can a community Keycloak admin MCP server change?
According to its own description, the community sshaaf/keycloak-mcp-server is an MCP server for Keycloak administration covering users, realms, clients, roles, groups, identity providers and authentication. That scope means a connected assistant could in principle change almost any identity setting the authenticated account can reach, including client definitions, role assignments and identity provider configuration. The README says users authenticate with their own JWT tokens from Keycloak, so the server acts with that user's rights rather than a separate service identity. Consequences include privilege escalation if a broadly privileged administrator's token is used, and silent changes to clients that other applications trust. Ask for a list of every admin tool the server exposes, a mapping of each tool to the Keycloak role it requires, and a test in a non-production realm showing which write operations succeed.
How does a Keycloak MCP access rollout cost and effort vary?
No price or duration is supplied for this work, so no figure should be assumed. Cost comes from several components: the people who design realm and client scopes, the team that reviews the chosen server's code and configuration, the platform staff who run and upgrade the Keycloak instance, and the security reviewers who test the result. One-time work includes scope design, role mapping, transport setup and testing. Recurring work includes upgrades, monitoring and periodic access reviews. Effort rises with the number of realms, the number of admin tools enabled, the need for HTTPS and container or Kubernetes deployment, and the number of client registration paths in use. Ask any vendor or partner for a written scope listing the components above, the assumptions behind each, and the recurring items after go-live.
Can our own team set up Keycloak MCP without outside help?
It depends on the team's Keycloak depth and on whether the work is limited to the official authorization guide or extends to a community admin server. Using Keycloak as the OAuth authorization server for MCP servers is documented by Keycloak itself, and the team can follow that guide, noting that MCP specification versions 2025-06-18, 2025-11-25 and 2026-07-28 are rated Experimental conformance. Running a community admin server adds review work: the team must check its code, its permissions model and its dependencies, and must test client registration controls. Teams without an identity engineer who has reviewed OAuth and client registration in production usually need an outside security review. DeployOpen can plan, implement, harden and test self-hosted Keycloak inside your infrastructure and runs AI agent rollout security reviews on a fixed scope agreed in writing. Confirm internal skills before choosing.
Is plain HTTP acceptable for a Keycloak MCP server?
HTTP is acceptable only for development. The getting started guide for the community sshaaf/keycloak-mcp-server lists a Keycloak instance of version 20.0 or later as a prerequisite, with HTTPS for production and HTTP for development. Tokens in an Authorization Bearer header carry the user's identity and rights, so plain HTTP would expose them to anyone on the network path. Production use should therefore require HTTPS between the AI client, the MCP server and Keycloak, with certificates managed under your own policy. The MCP server should also be kept on a restricted network segment. Before approval, ask the team to show the transport configuration for each hop, confirm that development settings are removed from production images, and record who owns certificate renewal.
How does audit logging work for Keycloak admin changes?
Keycloak's server administration guide lists auditing of user events and admin events, which is the feature that records changes made through the Admin API. An MCP server that calls that API therefore produces admin events, but these events identify the authenticated account, not the AI assistant or the person who prompted it, unless the setup records that link. Reviewers should confirm three things: that admin event logging is enabled in each realm, that events are exported to a system your security team monitors and retains under policy, and that the MCP server's own logs record which tool ran and with what parameters. Ask for a test showing that a change made through the assistant appears in Keycloak's event records and in your central log store, and that retention periods match your compliance requirements.
How do we control which MCP clients can register with Keycloak?
The official guide lists three client registration mechanisms: Client ID Metadata Documents, pre-registration and Dynamic Client Registration. Pre-registration gives the security team the most control, because each client is defined in advance by an administrator. Dynamic Client Registration lets clients register themselves, so it needs tight anonymous access policies. The guide says MCP Inspector needs Client Registration anonymous access policies to include allowed client scopes, allowed registration web origins and trusted hosts, which shows that these policies gate who can register. Confirm which mechanism is enabled, restrict allowed scopes and origins to named values, and disable mechanisms you do not use. Review the registered client list on a schedule and tie approvals to a change record.
How DeployOpen tests and documents a Keycloak MCP setup
DeployOpen works on Keycloak MCP setups as a fixed-scope engagement inside your own infrastructure, separating what the official Keycloak authorization guide covers from what a community admin server can change. The result is a documented, tested configuration that your security and identity teams can review before staff connect AI clients.
How we scope
- Written scope names which Keycloak realms, clients and MCP servers are in and out of the engagement.
- We record which MCP client registration mechanism each client uses and who may approve it.
- Scope states whether any community admin server is in use and which of its admin actions are allowed.
How we build
- We configure Keycloak as the authorization server for MCP servers, following the official guide for the MCP versions you approve.
- We restrict client registration policies, allowed scopes, registration web origins and trusted hosts.
- We test user token audience and scope limits, and check that any community server runs with HTTPS in production.
How we hand over
- Deliverables include a findings report, the realm and client configuration record and the lockdown settings applied.
- Documentation maps each approved AI client to its registration method, scopes, admin role and owner.
- We walk your identity and security teams through admin event and user event auditing so changes can be reviewed.
How we support
- Ongoing support is available as a retainer for upgrades to new Keycloak and MCP specification versions.
- Retests cover changes to client registration policies, new MCP clients and any community server updates.
- Continuous testing can be added to watch for drift in realm settings and token policies over time.
Sources and further reading
- Integrating with Model Context Protocol (MCP) - Keycloak ↗
- Keycloak server administration guide ↗
- Red Hat build of Keycloak 26.6, Chapter 12 Integrating with Model Context Protocol (MCP) ↗
- Keycloak 26.5.0 released ↗
- sshaaf/keycloak-mcp-server (community) on GitHub ↗
- keycloak-mcp-server getting started (community) ↗

