keycloak-model-context-protocol
v1.1.0Manage Keycloak users, groups, roles and realms through the Keycloak Admin REST API.
Values you need
| Variable | What it is | |
|---|---|---|
KEYCLOAK_URL | required | Base URL of the Keycloak server, e.g. https://keycloak.example.com |
KEYCLOAK_AUTH_REALM | optional | Realm used to obtain the admin token Default: master |
KEYCLOAK_CLIENT_ID | optional | Client ID used for login (default admin-cli for the password grant, required for client_credentials) |
KEYCLOAK_CLIENT_SECRET | optional secret | Client secret for the client_credentials grant (recommended: a dedicated service account) |
KEYCLOAK_USERNAME | optional | Username for the password grant (alternative to client credentials) |
KEYCLOAK_PASSWORD | optional secret | Password for the password grant |
KEYCLOAK_GRANT_TYPE | optional | Grant type; auto-detected if unset (client_credentials when a secret is set, else password) |
KEYCLOAK_MCP_READ_ONLY | optional | If true, only read-only tools are registered Default: false |
KEYCLOAK_MCP_REALMS | optional | Comma-separated allowlist of target realms; empty means all realms |
KEYCLOAK_MCP_ALLOW_MASTER_WRITE | optional | If true, write tools may modify the master realm Default: false |
KEYCLOAK_MCP_TOOLSETS | optional | Comma-separated enabled toolsets (core, groups, roles, clients, sessions, events, security) or all Default: core,groups,roles |
KEYCLOAK_MCP_REQUIRE_CONFIRMATION | optional | If true, destructive tools require confirm=true Default: true |
KEYCLOAK_MCP_TIMEOUT_MS | optional | HTTP timeout for Keycloak requests in milliseconds Default: 30000 |
KEYCLOAK_MCP_LOG_LEVEL | optional | Log level written to stderr Default: info |
npm (npx)
Requires Node.js 18+
Run in a terminal
claude mcp add keycloak-model-context-protocol -e 'KEYCLOAK_URL=<KEYCLOAK_URL>' -- npx -y keycloak-model-context-protocol@1.1.0Add to
claude_desktop_config.json{
"mcpServers": {
"keycloak-model-context-protocol": {
"args": [
"-y",
"keycloak-model-context-protocol@1.1.0"
],
"command": "npx",
"env": {
"KEYCLOAK_URL": "<KEYCLOAK_URL>"
}
}
}
}Add to
~/.cursor/mcp.json{
"mcpServers": {
"keycloak-model-context-protocol": {
"args": [
"-y",
"keycloak-model-context-protocol@1.1.0"
],
"command": "npx",
"env": {
"KEYCLOAK_URL": "<KEYCLOAK_URL>"
}
}
}
}Add to
.vscode/mcp.json{
"inputs": [
{
"description": "KEYCLOAK_URL",
"id": "keycloak-url",
"password": true,
"type": "promptString"
}
],
"servers": {
"keycloak-model-context-protocol": {
"args": [
"-y",
"keycloak-model-context-protocol@1.1.0"
],
"command": "npx",
"env": {
"KEYCLOAK_URL": "${input:keycloak-url}"
},
"type": "stdio"
}
}
}Add to
~/.codex/config.toml[mcp_servers.keycloak-model-context-protocol]
command = "npx"
args = ["-y", "keycloak-model-context-protocol@1.1.0"]
env = { "KEYCLOAK_URL" = "<KEYCLOAK_URL>" }For AI agents
- Ask the user for: KEYCLOAK_URL. Never invent or guess these values; secrets go into the client config, not into chat logs.
- Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
- Restart or reload the client so it starts the server.
- If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.
Machine-readable: install.md · manifest.json