Skip to content
MCP server

Keycloak Model Context Protocol

Manage Keycloak users, groups and roles with confirm-first guardrails

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
CLI, self-hosted
Runs
Locally
Version
1.1.0
Listing updated
today

Similar MCP servers

About Keycloak Model Context Protocol

Keycloak Model Context Protocol is an open-source MCP server for ai models and llm tooling. It runs locally on your machine and is started by your AI client.

This server administers Keycloak through the Admin REST API and is built around limiting what an AI assistant can change. The README recommends a dedicated service-account client with only needed realm-management roles, never the bootstrap admin, and the server acts with whatever rights that account holds.

It registers 24 tools in seven toolsets (core, groups, roles, clients, sessions, events, security), with core, groups and roles on by default. Guardrails include a read-only mode, a realm allowlist, write protection for the master realm, and a preview step: sensitive or destructive tools return a preview until called with confirm true. Grants of administrative rights are detected through composite roles and parent groups.

There are four guided prompts (onboarding, offboarding, security audit, failed-login investigation) and resources for realms and users. It runs locally over stdio on Node.js 22 or newer and was tested with Keycloak 24.0 to 26.8.

Install

Run in a terminal

claude mcp add keycloak-model-context-protocol --env KEYCLOAK_URL='<KEYCLOAK_URL>' --env KEYCLOAK_CLIENT_SECRET='<KEYCLOAK_CLIENT_SECRET>' --env KEYCLOAK_PASSWORD='<KEYCLOAK_PASSWORD>' -- npx -y keycloak-model-context-protocol

Add to claude_desktop_config.json

{
  "mcpServers": {
    "keycloak-model-context-protocol": {
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<KEYCLOAK_URL>",
        "KEYCLOAK_CLIENT_SECRET": "<KEYCLOAK_CLIENT_SECRET>",
        "KEYCLOAK_PASSWORD": "<KEYCLOAK_PASSWORD>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "keycloak-model-context-protocol": {
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<KEYCLOAK_URL>",
        "KEYCLOAK_CLIENT_SECRET": "<KEYCLOAK_CLIENT_SECRET>",
        "KEYCLOAK_PASSWORD": "<KEYCLOAK_PASSWORD>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "keycloak-model-context-protocol": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<KEYCLOAK_URL>",
        "KEYCLOAK_CLIENT_SECRET": "<KEYCLOAK_CLIENT_SECRET>",
        "KEYCLOAK_PASSWORD": "<KEYCLOAK_PASSWORD>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "keycloak-model-context-protocol": {
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<KEYCLOAK_URL>",
        "KEYCLOAK_CLIENT_SECRET": "<KEYCLOAK_CLIENT_SECRET>",
        "KEYCLOAK_PASSWORD": "<KEYCLOAK_PASSWORD>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "keycloak-model-context-protocol": {
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<KEYCLOAK_URL>",
        "KEYCLOAK_CLIENT_SECRET": "<KEYCLOAK_CLIENT_SECRET>",
        "KEYCLOAK_PASSWORD": "<KEYCLOAK_PASSWORD>"
      }
    }
  }
}

Using several servers? Build one config file with the MCP config generator.

Configuration

  • KEYCLOAK_URLBase URL of the Keycloak server, e.g. https://keycloak.example.comRequired
  • KEYCLOAK_AUTH_REALMRealm used to obtain the admin token
  • KEYCLOAK_CLIENT_IDClient ID used for login (default admin-cli for the password grant, required for client_credentials)
  • KEYCLOAK_CLIENT_SECRETClient secret for the client_credentials grant (recommended: a dedicated service account)
  • KEYCLOAK_USERNAMEUsername for the password grant (alternative to client credentials)
  • KEYCLOAK_PASSWORDPassword for the password grant
  • KEYCLOAK_GRANT_TYPEGrant type; auto-detected if unset (client_credentials when a secret is set, else password)
  • KEYCLOAK_MCP_READ_ONLYIf true, only read-only tools are registered
  • KEYCLOAK_MCP_REALMSComma-separated allowlist of target realms; empty means all realms
  • KEYCLOAK_MCP_ALLOW_MASTER_WRITEIf true, write tools may modify the master realm
  • KEYCLOAK_MCP_TOOLSETSComma-separated enabled toolsets (core, groups, roles, clients, sessions, events, security) or all
  • KEYCLOAK_MCP_REQUIRE_CONFIRMATIONIf true, destructive tools require confirm=true
  • KEYCLOAK_MCP_TIMEOUT_MSHTTP timeout for Keycloak requests in milliseconds
  • KEYCLOAK_MCP_LOG_LEVELLog level written to stderr

Tools this server provides (16)

Taken from the project documentation; the running server may differ.

realm_list
List accessible realms.
realm_get
Get a realm.
user_search
Search users.
user_get
Get a user.
user_create
Create a user (sensitive).
user_update
Update a user (sensitive).
user_delete
Delete a user (destructive).
user_send_actions_email
Send an actions email (sensitive).
group_list
List groups.
group_members_list
List group members.
user_group_add
Add a user to a group (sensitive).
user_group_remove
Remove a user from a group (destructive).
role_list
List roles.
user_roles_list
List a user's roles.
user_role_assign
Assign a role (sensitive).
user_role_revoke
Revoke a role (destructive).

What it does

Seven toolsets
Enable only the toolsets needed: core, groups, roles, clients, sessions, events, security.
Preview then confirm
Changing tools return a preview until confirm true is passed.
Read-only mode
KEYCLOAK_MCP_READ_ONLY registers only read tools.
Realm allowlist
Limit targets with KEYCLOAK_MCP_REALMS and block master-realm writes by default.
Guided prompts
Prompts for onboarding, offboarding, security audit and failed-login investigation.
Secrets kept out
Secrets and credentials are never returned or logged.

Good for

  • Search users and show group membership
  • Onboard or offboard an employee in a realm
  • Audit a realm's security posture
  • Investigate failed logins
  • Assign or revoke roles with a preview first

Pricing

Open source

Open-source npm package

Keycloak Model Context Protocol FAQ

Which auth methods does it support?

client_credentials with a service account (recommended) or the password grant.

Can it delete users without asking?

By default destructive tools need confirm true, though the README notes the model can set it itself, so client approval is the real check.

What Keycloak versions were tested?

24.0 to 26.8.

What does it need to run?

Node.js 22 or newer, a reachable Keycloak server and an MCP client.

Is Keycloak Model Context Protocol free?

Yes. Keycloak Model Context Protocol is open source, so you can use and self-host it for free.

How do I add Keycloak Model Context Protocol to Claude Code?

Run this command in your terminal: claude mcp add keycloak-model-context-protocol --env KEYCLOAK_URL='<KEYCLOAK_URL>' --env KEYCLOAK_CLIENT_SECRET='<KEYCLOAK_CLIENT_SECRET>' --env KEYCLOAK_PASSWORD='<KEYCLOAK_PASSWORD>' -- npx -y keycloak-model-context-protocol

What are the best alternatives to Keycloak Model Context Protocol?

The closest alternatives to Keycloak Model Context Protocol are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

Where this comes from

  • Description: written from the project's README.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers