Skip to main content
Glama
mgcrea

@mgcrea/mcp-keycloak

by mgcrea

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
KEYCLOAK_URLYesBase URL, e.g. https://keycloak.example.com. No /auth prefix on Keycloak ≥ 17.
KEYCLOAK_DEBUGNoSet to1 to log debug output to stderr.false
KEYCLOAK_REALMNoRealm the tools operate on. Defaults to master. Every tool can override it per call.master
KEYCLOAK_PASSWORDNoAdmin password for the password grant.
KEYCLOAK_USERNAMENoAdmin username for the password grant.
KEYCLOAK_CLIENT_IDNoClient ID used for authentication. Defaults to admin-cli.admin-cli
KEYCLOAK_AUTH_REALMNoRealm to authenticate against. Defaults to KEYCLOAK_REALM; set to master for cross-realm.master
KEYCLOAK_GRANT_TYPENoForce client_credentials or password. Otherwise inferred from the above.
KEYCLOAK_MAX_RETRIESNoRetry budget for 401 / 429 /5xx. Defaults to 3.3
KEYCLOAK_ALLOW_WRITESNoSet to 1 to register the write tools. Off by default.false
KEYCLOAK_CLIENT_SECRETNoService-account secret. Its presence selects the client_credentials grant.
KEYCLOCK_REFRESH_SKEW_SECONDSNoRefesh this long before expiry. Defaults to 30, clamped to half the token's lifetime.30

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
keycloak_auth_statusA

Report whether this server has working Keycloak credentials, which realm and account it acts as, whether writes are enabled, and — when something is missing — exactly what to set. Call this first when a tool you expected is not listed: an absent tool here means missing configuration rather than a bug.

keycloak_whoamiA

Show who the server is authenticated as and what it is actually allowed to do: the issuing realm, the client, the acting user, token expiry, and the realm + 'realm-management' roles that govern admin access. The roles are read from the account's role mappings on the server, not from the token — Keycloak issues tokens with no role claims to some clients, so the token alone proves nothing. Call this FIRST when another tool returns 403.

keycloak_get_server_infoA

Keycloak server version, uptime, JVM/memory info and enabled feature flags. The raw endpoint also dumps every SPI provider and theme (~1MB); this returns only the useful head of it.

keycloak_list_realmsA

List the realms this token can see.

keycloak_get_realmA

Get a realm's full configuration: token lifespans, login/registration settings, password policy, SSO session timeouts, and the flow bindings.

keycloak_list_usersA

Search users in a realm. Use search for a loose match across name/username/email, username/email + exact for a precise lookup, or q to match custom attributes.

keycloak_count_usersA

Count users matching a filter, without fetching them.

keycloak_get_userA

Get one user's full representation, including custom attributes.

keycloak_get_user_groupsA

List the groups a user belongs to.

keycloak_get_user_role_mappingsA

Get a user's role mappings. By default returns only roles assigned DIRECTLY to the user; set effective to also include roles inherited from groups and from composite roles — that is the set that actually lands in their token.

keycloak_get_user_sessionsA

List a user's active SSO sessions (where and when they are logged in).

keycloak_list_groupsA

List the realm's groups. Groups are a tree — top-level groups are returned with their subGroups nested inside.

keycloak_get_groupA

Get one group with its attributes and subgroups.

keycloak_get_group_membersA

List the users in a group.

keycloak_get_group_role_mappingsA

Get the roles mapped to a group. Every member of the group inherits these roles.

keycloak_list_realm_rolesA

List the realm-level roles defined in a realm.

keycloak_get_realm_roleA

Get one realm role by name, with its attributes and composite flag.

keycloak_get_realm_role_membersA

List the users who have a given realm role — i.e. 'who has this role?'.

keycloak_get_role_compositesA

List the roles contained in a composite role. Takes the role's UUID (not its name) — get it from keycloak_get_realm_role.

keycloak_list_client_rolesA

List the roles defined by a client. Note these are distinct from realm roles — realm-management's roles (view-users, manage-users, ...) are client roles.

keycloak_list_clientsA

List the realm's clients (applications). Returns both id (the UUID every other client tool needs) and clientId (the name shown in the console).

keycloak_get_clientA

Get a client's full configuration: flows, redirect URIs, web origins, and its attributes (including token lifespans). Its secret, if any, is redacted — use keycloak_get_client_secret to read it.

keycloak_get_client_secretA

Get a confidential client's CURRENT SECRET IN PLAIN TEXT. This is a live credential — it will appear in the conversation. Requires manage-clients. (To keep it out of reach entirely, move this tool's registration behind KEYCLOAK_ALLOW_WRITES.)

keycloak_get_client_service_account_userA

Get the service-account user backing a client. That user is where the client's admin roles are assigned, so this is the way to check what a client can actually do.

keycloak_get_client_installation_configA

Get the ready-to-use adapter config (keycloak.json) for a client — issuer URL, realm, credentials. Handy for wiring an app up to this client.

keycloak_get_realm_session_statsA

Count active sessions per client across the realm — who is logged in, and where.

keycloak_get_client_sessionsA

List the active user sessions for one client.

keycloak_get_client_session_countA

Count the active sessions for one client.

keycloak_get_events_configA

Show whether event logging is enabled for the realm, which event types are recorded, and how long they are kept. Check this first if the event tools come back empty.

keycloak_list_eventsA

Search user events — logins, logouts, failed logins, registrations. The way to answer 'why can't this user log in?'. Requires user event logging to be enabled on the realm.

keycloak_list_admin_eventsA

Search admin events — the audit trail of changes made to the realm itself (who created this user, who changed that client). Requires admin event logging to be enabled.

keycloak_list_client_scopesB

List the realm's client scopes. A client scope is a reusable bundle of protocol mappers and role scope — it's what decides which claims end up in a token.

keycloak_get_client_scopeA

Get one client scope with its protocol mappers.

keycloak_get_client_assigned_scopesA

Show which client scopes are assigned to a client, split into default (always applied) and optional (applied only when the request asks for them).

keycloak_list_protocol_mappersA

List the protocol mappers on a client or on a client scope. Mappers are what put claims into a token (a user attribute, group membership, an audience, a hardcoded value).

keycloak_evaluate_client_scopesA

Generate the access token a client would actually issue, without logging anyone in. The direct way to answer 'why is this claim missing from my JWT?'.

keycloak_list_identity_providersA

List the realm's identity providers (external login sources: Google, GitHub, a corporate SAML or OIDC IdP). Their client secrets are redacted.

keycloak_get_identity_providerA

Get one identity provider's full config — endpoints, trust settings, sync mode. Its client secret is redacted.

keycloak_list_identity_provider_mappersA

List an identity provider's mappers — the rules translating claims from the external IdP into Keycloak users, roles and groups.

keycloak_list_authentication_flowsA

List the realm's authentication flows — the step-by-step login pipelines (browser, direct grant, registration, reset credentials).

keycloak_get_authentication_flow_executionsA

Get the ordered steps inside a flow and whether each is REQUIRED, ALTERNATIVE, CONDITIONAL or DISABLED. This is what determines what a user is actually asked for when logging in (password, OTP, ...).

keycloak_list_required_actionsA

List the realm's required actions (Update Password, Verify Email, Configure OTP) and whether each is enabled or applied to new users by default.

keycloak_get_realm_flow_bindingsA

Show which flow is bound to each authentication entry point of the realm — i.e. which flow actually runs on a browser login, a direct grant, a registration, a password reset.

keycloak_requestA

Escape hatch: call any Keycloak Admin REST endpoint directly. Use it when no curated tool fits — user federation components, authorization policies, organizations, partial import/export, credentials. path is relative to the realm (users/123/credentials resolves under /admin/realms/{realm}/), or pass an absolute admin path starting with /admin/ (e.g. /admin/serverinfo). Writes are DISABLED: only GET is permitted. Set KEYCLOAK_ALLOW_WRITES=1 to allow mutations.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mgcrea/mcp-keycloak'

If you have feedback or need assistance with the MCP directory API, please join our Discord server