mcp-keycloak
Provides tools for inspecting and managing Keycloak realms, users, clients, roles, and groups, with configurable access modes and security controls.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-keycloaklist all users in the customers realm"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-keycloak
A Model Context Protocol server for Keycloak. It lets an MCP-capable client (Claude Desktop, Claude Code, etc.) inspect and manage Keycloak realms, users, clients, roles, and groups — with security controlled entirely by flags.
The design goal is safe by default: it starts read-only, scopes to an allowlist of realms, protects sensitive realms from mutation, and gates destructive operations behind an explicit opt-in.
Features
Multi-realm — every tool takes a
realmargument; scope it with an allowlist.Access modes —
read-only→read-write→admin, layered so a mode never exposes tools above its level.Security flags — realm allowlist, protected realms, delete gating, dry-run, and JSON audit logging (see below).
Two auth strategies — confidential-client service account (recommended) or admin username/password.
Zero heavy dependencies — a thin fetch-based Admin REST client, plus the MCP SDK and zod.
Related MCP server: mcp-keycloak-admin
Security model
Concern | Flag | Default | Effect |
What can the server do at all? |
|
|
|
Which realms are in scope? |
| (all) | Comma-separated. When set, any operation on a realm outside the list is refused. |
Which realms are read-only forever? |
|
| Protected realms can be read but never mutated or deleted, regardless of mode. |
Can it delete? |
|
|
|
Preview without touching Keycloak |
|
| Write/admin tools validate + log intent, then return without calling Keycloak. |
Audit trail |
|
| Emits a JSON line to stderr per guarded operation ( |
These layers are independent — for example admin mode with KEYCLOAK_ALLOW_DELETE=false can create and update users but cannot delete them.
Tools
Read (read-only+): list_realms, get_realm, list_users, get_user, count_users, list_clients, list_realm_roles, list_groups
Write (read-write+): create_user, update_user, reset_password, logout_user
Admin (admin): delete_user
Use with your MCP client
Works with Claude Code, Claude Desktop, Cursor, OpenAI Codex CLI, Windsurf, VS Code (Copilot), and any other MCP client — see docs/CLIENTS.md for per-client setup.
Install
npm install
npm run buildConfigure
Copy .env.example and fill it in, or set the variables directly in your MCP client config. A confidential client with the realm-management roles you need is the recommended credential.
Run with Claude Desktop / Claude Code
Add to your MCP client configuration (claude_desktop_config.json or via claude mcp add):
{
"mcpServers": {
"keycloak": {
"command": "node",
"args": ["/absolute/path/to/mcp-keycloak/dist/index.js"],
"env": {
"KEYCLOAK_URL": "https://keycloak.example.com",
"KEYCLOAK_CLIENT_ID": "admin-cli",
"KEYCLOAK_CLIENT_SECRET": "your-secret",
"KEYCLOAK_MODE": "read-only",
"KEYCLOAK_REALM_ALLOWLIST": "app,customers"
}
}
}
}Bump KEYCLOAK_MODE to read-write (and, for deletes, admin + KEYCLOAK_ALLOW_DELETE=true) only when you intend to let the model make changes.
Develop
npm run dev # watch mode
npm test # unit tests for the security policy
npm run typecheckPublishing
This server ships a server.json for the official MCP registry and an mcpName for npm ownership validation. See PUBLISHING.md for publishing to npm and listing on the MCP registry, Smithery, Glama, Cursor, and PulseMCP.
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceAn MCP server for Keycloak Admin REST API, enabling user, group, event, and security management through service account authentication.30MIT
- AlicenseAqualityAmaintenanceEnables administrators to manage Keycloak realms, users, roles, clients, groups, and more through its Admin REST API, with safe-by-default configuration and destructive operation confirmation.56421MIT
- AlicenseAqualityCmaintenanceAn MCP server that lets an AI assistant inspect and modify Keycloak realm, client, and protocol-mapper configuration across multiple Keycloak hosts.787MIT
- AlicenseNot gradedqualityBmaintenanceEnables administration of Keycloak identity and access management through MCP, allowing management of realms, clients, users, roles, groups, identity providers, and sessions from any MCP client.41Apache 2.0
Related MCP Connectors
Managed Keycloak from any MCP client: clusters, realms, apps, SSO, users, domains, audit events.
Remote MCP for A2A caller identity, scope policy, verdict receipts, and audit history.
The official MCP Server from Mia-Platform to interact with Mia-Platform Console
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/dockndevai/mcp-keycloak'
If you have feedback or need assistance with the MCP directory API, please join our Discord server