MCP server for KeyCloak Admin REST API via Service Account
keycloak-mcp has 23 tools with mostly complete naming and parameter schemas, but critical gaps in descriptions and error handling. Tool names follow verb_noun conventions well (get_*, list_*, search_*, set_*, reset_*). Parameters are typed (string, integer, boolean) with descriptions in most cases. However, descriptions are inconsistently detailed, some tools have brief 1-2 sentence descriptions (20-50 chars), and output schemas are not documented in the source. Error handling and recovery guidance are absent. The server focuses on read operations (21/23 READ_ONLY) with sensitive write operations (logout_user, set_user_enabled, reset_password) but no confirmation or dry-run patterns. Tool definitions are visible in keycloak_mcp/server.py via FastMCP decorator registration, so we can score directly rather than inferring.
Get total user count in the realm
Generate a daily summary of authentication events, anomalies, and security status
Get brute force protection status for a user account
Get detailed information about a specific client
Get detailed activity for a specific source IP address
Analyze login failures grouped by source IP address
Output schemas not documented. Tool descriptions specify what inputs are expected but do NOT describe what fields are returned. LLMs cannot plan downstream tool composition or know which IDs to extract for chaining calls.
Three write operations (logout_user, set_user_enabled, reset_password) lack confirmation/dry-run patterns and descriptive output. Agents cannot preview changes or get success confirmation, risking unintended modifications to user accounts.
No error handling or recovery guidance. Descriptions do not indicate what can fail, when to retry, or how to recover. Tools that call external APIs (KeyCloak) may timeout or receive 4xx/5xx responses, but the source shows no try-catch, error wrapping, or actionable error messages.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | C | 61 | 2025-06-18+ | v2 |
List all realm roles
Get security defenses configured for the realm (password policy, brute force protection, etc.)
Get active session statistics for the realm
Scan users and report TOTP/OTP configuration status
Get user details by username including credentials and custom attributes
Get audit history of attribute changes for a user
Get configured credentials for a user (password, OTP, WebAuthn, etc.)
Get active sessions for a specific user
Check KeyCloak service health and authentication status
List all clients in the realm
List all groups a user is a member of
List all members of a specific group
Force logout all sessions for a user
Reset a user's password to a new value
Search users by username, email, or name
Enable or disable a user account
Detect password spray attack patterns from recent login failures
Tool descriptions vary from minimal (e.g. 'List all realm roles', 24 chars) to adequate. Baselines show avg 194 chars. Short descriptions do not explain WHEN to use the tool vs alternatives (e.g., when to call list_clients vs get_client), forcing LLMs to guess.
Password reset (reset_password) accepts password as a parameter. If the server logs tool calls (as per pattern:audit-trail), plaintext passwords appear in logs. Should use a 'generate_temporary_password' flag or server-side generation instead.
Tools accessing user credentials (get_user_credentials) and session info (get_user_sessions) return detailed authentication data. Descriptions do not clarify what sensitive fields are included (tokens? session IDs?) or warn against echoing to users.
No parameter validation constraints visible in schema. date_from parameters in several tools accept 'YYYY-MM-DD format' per description, but schema does not declare format or pattern. max_results and top parameters lack min/max bounds. LLMs may pass invalid dates or unbounded limits.
Pagination and result limits are not enforced uniformly. Some tools (daily_brief, spray_check) mention internal deadline/cap logic in source code (_PARTIAL_WARNING), but tool descriptions do NOT communicate to LLMs that results may be truncated or that the agent should handle partial responses.
Tools that scan/enumerate users (search_users, get_totp_users) operate on potentially large datasets. No pagination parameters (limit, offset, cursor) visible in schema. Descriptions do not clarify whether results are capped, sorted, or complete.