Skip to main content
Glama
shigechika

keycloak-mcp

by shigechika

daily_brief

Run a morning Keycloak health check.

Instructions

Run a morning Keycloak health check.

Checks (all scoped to the last since_hours hours):

  • Login statistics (success / failure totals, top failing IPs)

  • Active sessions by client

  • Password update events

  • Admin events (CREATE/UPDATE/DELETE on USER/CLIENT resources)

  • Configuration: admin events that change roles, role mappings, flows, client scopes, protocol mappers, components or the realm, and (when KEYCLOAK_STATE_DIR is set) what changed since the last daily snapshot. The first run of each day records that day's snapshot; get_config_changes lists every change.

A single IP with login failures >= ip_failure_threshold is flagged as WARNING (possible brute-force). Independently, the same login events are run through the spray_check rule (external IP, >= 10 distinct users, success rate < 20%); a match is a [SPRAY] WARNING and the "Spray check" section lists the breached accounts with their evidence tuples (time / ip / username / client). Only accounts in that list may be called breached — see spray_check for the full row shape and to widen the window or tune the thresholds.

since_hours defaults to 18 (≈ previous 15:00 for a 09:00 morning run).

Output tiers:

  • CRITICAL — API connection failure

  • WARNING — anomalies detected

  • OK — clean

Args: since_hours: Look-back window in hours (default 18). ip_failure_threshold: Login failures from a single IP that triggers a WARNING (default 50).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
since_hoursNo
ip_failure_thresholdNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.14.1
  2. Removedv0.13.1
  3. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so richly: it defines the WARNING trigger (single IP failures >= ip_failure_threshold), the independent SPRAY rule (external IP, >=10 distinct users, success rate <20%), that breached accounts must be in the returned list, the output tiers (CRITICAL/WARNING/OK), and the snapshot side effect and its dependency on KEYCLOAK_STATE_DIR.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It is long, but front-loaded with the purpose and organized into checks, warning rules, and output tiers so an agent can scan it. The Args block duplicates the schema slightly, but nearly every sentence conveys actionable behavior rather than filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a two-parameter tool with an output schema, the description supplies everything needed to invoke it correctly: defaults, the meaning of both parameters, the detection semantics, the tiering of results, and the configuration-snapshot side effect. Return-value formatting is left to the output schema, as appropriate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate, and the Args section explains both parameters: since_hours as the look-back window with default 18 and a concrete wall-clock interpretation, and ip_failure_threshold as the single-IP failure count that triggers a WARNING with default 50. It adds real meaning beyond the bare typed schema, though it does not state valid ranges.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource ('Run a morning Keycloak health check') and enumerates the exact checks performed, so an agent knows precisely what the tool aggregates. It further distinguishes itself from siblings by naming 'spray_check' and 'get_config_changes' as separate tools for deeper/tuned analysis.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear operational context: a morning run window of 18 hours (≈15:00 previous day for a 09:00 run) and routing to 'spray_check' to widen the window or tune thresholds, and to 'get_config_changes' to list snapshot deltas. It stops short of an explicit 'use this instead of X when...' statement, but the intended usage is unambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.