Client ID Metadata Documents (CIMD) Setup
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Client ID Metadata Documents (CIMD) let an application use an https URL that serves its metadata as its client_id. Keycloak reads that document, creates one client for the application and reuses it on every later request, so AI clients and MCP servers no longer register a new client for each connection.
A complete setup has two parts: the cimd feature flag on the cluster, which Skycloak applies for you, and a client policy in each realm that decides which metadata URLs are accepted. This page covers both.
Requirements
Section titled “Requirements”- Minimum version.
cimdneeds Keycloak 26.6.0 or later. Turning it on for an older cluster is refused in the dashboard, the API, MCP and Terraform, and the message names the flag, the cluster version and the minimum version. Upgrade the cluster first. - Plan and access. Feature management is available on the Launch, Business and Enterprise plans. The API and Terraform need an API key with the
clusters:readandclusters:writescopes. - One flag is enough.
cimdis all the CIMD setup needs.resource-indicatorsis a separate experimental flag with the same minimum version, and turning it on is optional.
A change restarts Keycloak
Section titled “A change restarts Keycloak”Every change to the enabled flags restarts Keycloak on the cluster, and the restart interrupts live sign-ins for a short time.
- With a maintenance window, a change made through the API, MCP or Terraform stays pending until the next window opens, then moves to applying while Keycloak restarts.
- With no maintenance window, the change applies at once.
- With apply now, the restart starts immediately whatever the window says. Use it on a development cluster, or when you have picked a quiet moment for production.
You can set the window on the cluster edit page, see Auto-upgrade & Maintenance Windows.
Turn on the flag
Section titled “Turn on the flag”Each surface sets the complete list of enabled flags. A flag you leave out is turned off, so read the current list first and send it back with cimd added. Flags that only Skycloak can set are never listed and never changed.
Dashboard
Section titled “Dashboard”- Open your cluster’s edit page.
- Expand Advanced Keycloak Configuration.
- Under Protocol Support, turn on Client ID Metadata Documents. It shows the experimental badge.
- Confirm the warning that asks you to accept the risk, then save.
Read the enabled flags and any change still rolling out:
curl "https://api.skycloak.io/clusters/$CLUSTER_ID/features" \
-H "API-Key: $SKYCLOAK_API_KEY" \
-H "API-Version: 2026-06-01.beta"
{
"features": ["token-exchange"]
}
While a change is pending or applying, the response also carries a change object whose state is pending or applying, and features lists the requested set. To see which flags you can enable, with their minimum versions and whether they are experimental, call GET /cluster-features.
Replace the set with PUT:
curl -X PUT "https://api.skycloak.io/clusters/$CLUSTER_ID/features" \
-H "API-Key: $SKYCLOAK_API_KEY" \
-H "API-Version: 2026-06-01.beta" \
-H "Content-Type: application/json" \
-d '{"features": ["token-exchange", "cimd"], "apply_now": false}'
The response lists the features after the change and sets restarts_keycloak. Its change.state says whether the restart is pending for the window or applying now, and impact describes how disruptive the restart is for the cluster’s size. Set apply_now to true to skip the window. See the API reference for every field.
The Skycloak MCP server has one tool to read the flags and one to replace them:
skycloak_get_cluster_featuresreads the enabled flags and any pending or applying change.skycloak_set_cluster_featuresreplaces the whole set. Passcluster_idandfeatures. To restart at once, passapply_nowtogether withconfirm, set totrue.
The result of the set tool states whether Keycloak restarts, whether the change is pending or applying, and which of the enabled flags are experimental. skycloak_list_cluster_features lists the flags you can enable.
Terraform
Section titled “Terraform”The skycloak_cluster_features resource of the Skycloak Terraform provider owns the cluster’s whole flag set:
resource "skycloak_cluster_features" "cimd" {
cluster_id = skycloak_cluster.example.id
features = ["cimd"]
# By default the change waits for the maintenance window.
# apply_now = true restarts at once and waits for Keycloak to finish.
}
- Changes update the resource in place, and a plan that changes flags warns that Keycloak restarts.
- Removing a flag from
featuresturns it off. Destroying the resource turns off every flag you set and leaves the ones only Skycloak sets. - Import an existing cluster’s flags with
terraform import skycloak_cluster_features.cimd $CLUSTER_ID. - Use one resource per cluster.
Add the realm client policy
Section titled “Add the realm client policy”The flag only makes Keycloak able to read metadata documents. Until a realm has a client policy, nothing uses it. Create one profile and one policy in each realm that should accept metadata URLs:
- In the realm’s admin console, go to Realm Settings, then Client Policies, then Profiles.
- Create a client profile, for example
cimd-profile, and add theclient-id-metadata-documentexecutor. - Set Trusted domains on the executor to the domains whose metadata documents you accept. An empty list denies every domain.
- Go to the Policies tab and create a client policy, for example
cimd-policy. - Add the
client-id-uricondition with URI schemehttpsand the same trusted domains. With no trusted domains the condition never matches, so the profile is never applied. - Under Associated client profiles, attach
cimd-profile.
The domains depend on the client. Claude Code, for example, uses claude.ai. Using claude.ai itself needs Keycloak 26.8.0 or later and the executor option that accepts a public client with a confidential-client-only grant. The blog post on CIMD for MCP authorization in Keycloak walks through every executor option and the profiles for Claude Code and VS Code.
Check that it works
Section titled “Check that it works”Send an authorization request to the realm with an https metadata URL as the client_id. Keycloak accepts it and creates one client for that URL. Sending the same request again reuses that client and creates no new one.
To go back, remove cimd from the cluster’s flags with any of the surfaces above. The change restarts Keycloak in the same way.