mcp-keycloak is a Model Context Protocol (MCP) server for managing Keycloak. It allows MCP-capable clients (such as Claude Desktop, Claude Code, etc.) to inspect and manage Keycloak realms, users, clients, roles, and groups, with all security behavior controlled by flags.
Purpose: To provide MCP clients with Keycloak management capabilities, covering daily operations and maintenance scenarios across multiple realms.
Main capabilities:
- Multi-realm support: every tool accepts a realm parameter and can be scoped via an allowlist.
- Access modes: read-only → read-write → admin, designed in layers, where a given mode does not expose tools above its level.
- Security flags: realm allowlist, protected realms, delete gating, dry-run, and JSON audit logging.
- Two authentication strategies: confidential client service account (recommended) or admin username/password.
- Extremely lightweight dependencies: a streamlined fetch-based Admin REST client, plus the MCP SDK and zod.
Tool layering:
- 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. Each security layer is independent; for example, in admin mode, setting KEYCLOAK_ALLOW_DELETE=false still allows creating and updating users, but not deleting users.
Usage: Published to npm as @dockndevai/mcp-keycloak, no cloning or building required; MCP clients run it on demand via npx. It starts in read-only mode by default; refer to .env.example for all variables, and refer to docs/CLIENTS.md for complete configuration guides for each client.
Integration example (Claude Code CLI):
npx -y @dockndevai/mcp-keycloak
Claude Desktop, Cursor, and Windsurf use the same configuration block, located in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.json respectively. OpenAI Codex CLI uses ~/.codex/config.toml; VS Code (GitHub Copilot, Agent mode) uses .vscode/mcp.json.
Can be run from source (for development purposes): Prefer the published package above. If you need to run from a clone, refer separately to the repository instructions.
This server includes server.json for the official MCP registry, and provides mcpName for npm ownership verification. PUBLISHING.md contains instructions for publishing to npm and listing on the MCP registry, Smithery, Glama, Cursor, and PulseMCP.
Use cases: Development and operations scenarios that require secure multi-realm management of Keycloak through MCP clients.
Limitations: Official materials do not provide specific limitations, fees, or pricing information, and none are available at this time.