keycloak-model-context-protocol
MCP server by ChristophEnglisch Community
Manages Keycloak users, groups, roles and realms through the Keycloak Admin REST API. It lets an AI assistant such as Claude administer a Keycloak server, with guardrails around every write. Built for administrators who want least-privilege access.
Install keycloak-model-context-protocol
Built from the published package, never by AI.
claude mcp add keycloak-model-context-protocol -e KEYCLOAK_URL=YOUR_KEYCLOAK_URL -- npx -y keycloak-model-context-protocolRun in your terminal. Add --scope user to use it in every project.
Step-by-step: install keycloak-model-context-protocol in Claude Code
{
"mcpServers": {
"keycloak-model-context-protocol": {
"env": {
"KEYCLOAK_URL": "YOUR_KEYCLOAK_URL"
},
"args": [
"-y",
"keycloak-model-context-protocol"
],
"command": "npx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
Step-by-step: install keycloak-model-context-protocol in Claude Desktop
{
"mcpServers": {
"keycloak-model-context-protocol": {
"env": {
"KEYCLOAK_URL": "YOUR_KEYCLOAK_URL"
},
"args": [
"-y",
"keycloak-model-context-protocol"
],
"command": "npx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
Step-by-step: install keycloak-model-context-protocol in Cursor
{
"servers": {
"keycloak-model-context-protocol": {
"env": {
"KEYCLOAK_URL": "YOUR_KEYCLOAK_URL"
},
"args": [
"-y",
"keycloak-model-context-protocol"
],
"command": "npx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
Step-by-step: install keycloak-model-context-protocol in VS Code
codex mcp add keycloak-model-context-protocol --env KEYCLOAK_URL=YOUR_KEYCLOAK_URL -- npx -y keycloak-model-context-protocolStep-by-step: install keycloak-model-context-protocol in Codex
{
"mcpServers": {
"keycloak-model-context-protocol": {
"env": {
"KEYCLOAK_URL": "YOUR_KEYCLOAK_URL"
},
"args": [
"-y",
"keycloak-model-context-protocol"
],
"command": "npx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
Step-by-step: install keycloak-model-context-protocol in Antigravity CLI
gemini mcp add keycloak-model-context-protocol npx -y keycloak-model-context-protocolGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
Step-by-step: install keycloak-model-context-protocol in Gemini CLI
MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the keycloak-model-context-protocol block.
About
Keycloak MCP Server is a Model Context Protocol server for Keycloak administration. It lets an AI assistant such as Claude manage users, groups, roles and sessions, and inspect clients, events and realm security, through the Keycloak Admin REST API. The server runs as a local child process of your MCP client and talks to it over stdio. It works with Claude Desktop, Claude Code, VS Code, Cursor and other stdio clients.
Authentication uses a client_credentials service account, with the password grant also available. Read-only mode, a realm allowlist, write protection for the master realm and a preview-then-confirm flow for changes act as guardrails. It suits administrators who want an assistant to handle Keycloak tasks with scoped permissions. Node.js 22 or newer is required.
Written from the project's README and checked against it.
Tools it gives your assistant
realm_listLists the realms the configured account can access.user_searchSearches users in a realm.user_getReturns the details of a single user.user_createCreates a user. Sensitive, so it asks for confirmation.user_updateUpdates a user's fields. Sensitive, so it asks for confirmation.user_deleteDeletes a user. Destructive, so it asks for confirmation.user_group_addAdds a user to a group. Sensitive, so it asks for confirmation.user_role_assignAssigns a role to a user. Sensitive, so it asks for confirmation.user_logoutEnds a user's sessions. Destructive, so it asks for confirmation.user_brute_force_unlockUnlocks a user locked by brute-force protection. Sensitive.
What you need
- Node.js 22 or newer
- A Keycloak server the machine can reach (tested with Keycloak 24.0 to 26.8)
- An MCP client such as Claude Desktop, Claude Code, VS Code or Cursor
- A Keycloak client with service account roles from realm-management
| Setting | Needed | What it is |
|---|---|---|
KEYCLOAK_Environment variable | Required | Base URL of the Keycloak server, e.g. https://keycloak.example.com |
KEYCLOAK_Environment variable | Optional | Realm used to obtain the admin token Default: master |
KEYCLOAK_Environment variable | Optional | Client ID used for login (default admin-cli for the password grant, required for client_credentials) |
KEYCLOAK_Environment variable, secret | Optional | Client secret for the client_credentials grant (recommended: a dedicated service account) |
KEYCLOAK_Environment variable | Optional | Username for the password grant (alternative to client credentials) |
KEYCLOAK_Environment variable, secret | Optional | Password for the password grant |
KEYCLOAK_Environment variable | Optional | Grant type; auto-detected if unset (client_credentials when a secret is set, else password) |
KEYCLOAK_Environment variable | Optional | If true, only read-only tools are registered Default: false |
KEYCLOAK_Environment variable | Optional | Comma-separated allowlist of target realms; empty means all realms |
KEYCLOAK_Environment variable | Optional | If true, write tools may modify the master realm Default: false |
KEYCLOAK_Environment variable | Optional | Comma-separated enabled toolsets (core, groups, roles, clients, sessions, events, security) or all Default: core,groups,roles |
KEYCLOAK_Environment variable | Optional | If true, destructive tools require confirm=true Default: true |
KEYCLOAK_Environment variable | Optional | HTTP timeout for Keycloak requests in milliseconds Default: 30000 |
KEYCLOAK_Environment variable | Optional | Log level written to stderr Default: info |
From the publisher's entry in the official MCP Registry. Required settings are already in the install config below as placeholders.
Try asking
- List the realms I can access, then show the first 10 users of realm demo.
- Show the groups and roles assigned to user jdoe in realm demo.
- Run a read-only security audit of realm demo with prioritized findings.
Good to know
- Acts with the permissions of the Keycloak account it is given.
- Only the core, groups and roles toolsets are enabled by default.
- Role and group grants and profile changes for the server's own account are refused.
- Changes to users with administrative rights need confirmation that cannot be turned off.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: README.md, package.json. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to keycloak-model-context-protocol
All alternatives →Agentmesh MCP Proxy is a security proxy for MCP servers, described by its publisher as a firewall for the Model Context Protocol. It is aimed at teams that run AI agents which call tools and other agents.
Hardens client-side artifacts such as binaries, Electron apps, JS bundles, Python and WebAssembly against AI reverse-engineering agents. Built for developers who ship proprietary logic to user-controlled devices.
Bla Agents is an MCP server and CLI that adds seeded, format-specific decoys to shipped binaries, JavaScript, WebAssembly and other artifacts. It is for developers who ship proprietary logic to user-controlled devices and want to make AI reverse-engineering slower.
A shared OAuth server for the MCP route of an app, built on better-auth, with passkey sign-in for the owner
Agent Governance Toolkit adds policy enforcement, identity, sandboxing and audit logging to autonomous AI agents. It is aimed at teams shipping agents to production. The source does not confirm the Claude Desktop MCP server named in the listing.
Convex MCP Gateway is a Convex component that exposes selected Convex functions as MCP tools. It checks each call with your own authorize callback and writes an audit log. It is for developers who run Convex apps and want AI assistants to call parts of them.
Compare with Agentmesh MCP Proxy, Bla or Bla Agents
keycloak-model-context-protocol: common questions
Does it change Keycloak data without asking?
Tools that change data are destructive or sensitive. Called without confirm: true, they only return a preview and change nothing.
Can it run in read-only mode?
Yes. With KEYCLOAK_MCP_READ_ONLY enabled, only read tools are registered.
Should I use the Keycloak bootstrap admin account?
No. The source recommends a dedicated service-account client with only the roles you need, never the bootstrap admin.
How do I install keycloak-model-context-protocol?
In Claude Code run claude mcp add keycloak-model-context-protocol -e KEYCLOAK_URL=YOUR_KEYCLOAK_URL -- npx -y keycloak-model-context-protocol. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is keycloak-model-context-protocol the official server?
keycloak-model-context-protocol is a community project by ChristophEnglisch, not verified by a company domain.
Is keycloak-model-context-protocol free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is keycloak-model-context-protocol safe to use?
It scores 70 of 100. Grades: maintenance B, licence A, quality C. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to keycloak-model-context-protocol?
Similar MCP servers: Agentmesh MCP Proxy, Bla, Bla Agents, MCP Auth.
Does keycloak-model-context-protocol work with ChatGPT?
Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.
