MCP Keycloak
MCP server by mgcrea Verified · npm:@mgcrea
MCP Keycloak is a Model Context Protocol server for the Keycloak Admin REST API. It lets an agent explore and administer realms, users, clients, roles and identity providers. It is for people who manage Keycloak instances.
Install MCP Keycloak
Built from the published package, never by AI.
claude mcp add mcp-keycloak -- npx -y @mgcrea/mcp-keycloakRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"mcp-keycloak": {
"args": [
"-y",
"@mgcrea/mcp-keycloak"
],
"command": "npx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"mcp-keycloak": {
"args": [
"-y",
"@mgcrea/mcp-keycloak"
],
"command": "npx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"mcp-keycloak": {
"args": [
"-y",
"@mgcrea/mcp-keycloak"
],
"command": "npx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add mcp-keycloak -- npx -y @mgcrea/mcp-keycloak{
"mcpServers": {
"mcp-keycloak": {
"args": [
"-y",
"@mgcrea/mcp-keycloak"
],
"command": "npx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
gemini mcp add mcp-keycloak npx -y @mgcrea/mcp-keycloakGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
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 mcp-keycloak block.
About
MCP Keycloak is a Model Context Protocol server for the Keycloak Admin REST API. It lets an agent explore and administer a Keycloak instance, including realms, users, groups, roles, clients, sessions, events, client scopes, protocol mappers, identity providers and authentication flows. It is read-only by default. Setting KEYCLOAK_ALLOW_WRITES=1 registers the write tools, and destructive tools also require confirm: true on each call.
It authenticates with either a service account using the client credentials grant (recommended) or the password grant through admin-cli. Tokens are cached and refreshed ahead of expiry. List results are summarized so large user lists do not flood the context, while get tools return the full representation. It runs over stdio and is aimed at people who administer Keycloak and want an assistant to inspect or change its configuration.
Written from the project's README and checked against it.
Tools it gives your assistant
keycloak_whoamiReports the realm authenticated against, the identity used, and the realm-management roles the token carries.keycloak_list_usersLists users in a realm with summarized results. Search is loose, while exact and q narrow the match.keycloak_get_userReturns the full representation of a single user.keycloak_list_clientsLists clients in a realm, returning both the UUID and the clientId string.keycloak_get_client_secretReturns a client's secret in plain text. It is registered as a read tool.keycloak_list_realm_rolesLists realm roles in the configured or specified realm.keycloak_list_groupsLists groups in a realm.keycloak_list_eventsLists realm events and reports when event logging is disabled.keycloak_list_identity_providersLists identity providers configured in a realm.keycloak_requestCalls any admin endpoint without a curated tool. GET-only unless writes are enabled.
What you need
- Node.js to run via npx, or Docker to run the published image
- A reachable Keycloak instance set in KEYCLOAK_URL
- A service account client with realm-management roles, or an admin username and password for the password grant
Try asking
- Use keycloak_whoami to check which realm and roles my token has
- List users in the staging realm whose email matches example.com
- Show the clients and identity providers configured in my realm
Good to know
- Read-only by default. Write tools are registered only when KEYCLOAK_ALLOW_WRITES=1 is set.
- Destructive tools also require confirm: true on every call.
- keycloak_get_client_secret returns secrets in plain text.
- The password grant runs with everything the human admin account can do.
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 MCP Keycloak
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
MCP Keycloak: common questions
Can this server change my Keycloak settings?
Not by default. Write tools are only registered when KEYCLOAK_ALLOW_WRITES=1 is set, and destructive ones also need confirm: true on each call.
Which authentication method should I use?
The source recommends a service account with the client credentials grant. The password grant through admin-cli is described as handy for local testing.
Why does list_events return an empty list?
Events are off by default in Keycloak. A realm with logging disabled returns an empty list rather than an error, and list_events tells you when that is the cause.
How do I install MCP Keycloak?
In Claude Code run claude mcp add mcp-keycloak -- npx -y @mgcrea/mcp-keycloak. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is MCP Keycloak the official server?
MCP Keycloak is published by npm:@mgcrea from its verified domain in the official MCP Registry.
Is MCP Keycloak free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is MCP Keycloak safe to use?
It scores 57 of 100. Grades: maintenance A, 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 MCP Keycloak?
Similar MCP servers: Agentmesh MCP Proxy, Bla, Bla Agents, MCP Auth.
Does MCP Keycloak 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.
