keycloak-mcp: Instructions file for Claude Code

CLAUDE.md

keycloak-mcp CLAUDE.md is an instructions file for Claude Code from shigechika/keycloak-mcp. It costs 1,078 tokens per session, scanned A, original, MIT.

A set of Claude Code instructions for developing a Keycloak administration server. It documents the project structure, commands, authentication, tests, and coding conventions.

In plain words
What is it for?
Guiding development and review of Keycloak API access, authentication, retries, pagination, user and group tools, security checks, events, sessions, and the daily report.
Why use it?
It gives an assistant the repository's expected workflow and security boundaries before it changes code. The documented connection uses service-account authentication rather than a human password or one-time code.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md.

This is shigechika/keycloak-mcp's own configuration. It tells Claude Code how to work on keycloak-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything keycloak-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to shigechika/keycloak-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/shigechika/keycloak-mcp/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/shigechika/keycloak-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for keycloak-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/shigechika/keycloak-mcp/claude-md/github.svg)](https://agentmods.dev/instructions/shigechika/keycloak-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/shigechika/keycloak-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/shigechika/keycloak-mcp/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for keycloak-mcp CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/shigechika/keycloak-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/shigechika/keycloak-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,078 This file is loaded in full into every session.
When invoked 1,078 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01078 $0.01078
Opus 5 $0.00539 $0.00539
Sonnet 5 $0.00216 $0.00216
Haiku 4.5 $0.00108 $0.00108

Measured 8d ago against content hash 88997e8e618b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

keycloak-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 77 lines

How it starts

The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

Overview

MCP server for the KeyCloak Admin REST API. Authenticates as a Service Account (OIDC Client Credentials Grant — no human password or TOTP); never calls the userinfo endpoint and never creates user sessions (the project describes this as "Infinispan-safe" — see README.md). Exposes 29 tools (users, MFA/credentials, groups, brute-force/security, events, admin events, sessions/clients, and a daily_brief morning report) over stdio transport.

Commands

uv sync --dev
uv run pytest -v                  # all tests
uv run ruff check .               # lint
uv run ruff format --check .      # format check

This mirrors .github/workflows/ci.yml (matrix: Python 3.10–3.14 on Ubuntu, plus one Windows 3.12 job to catch stdio newline regressions). Plain-pip equivalents are documented in README.md's Development section.

Architecture

  • keycloak_mcp/auth.pyTokenManager: Client Credentials Grant token fetch/cache, refreshed 30s before expiry.
  • keycloak_mcp/client.pyKeyCloakClient: thin httpx wrapper over the Admin REST API; retries 429/502/503/504 and transport errors with exponential backoff; _paginate pages list endpoints.
  • keycloak_mcp/sites.pySiteClassifier: labels IPs with a site name from an optional KEYCLOAK_SITES_INI file.
  • keycloak_mcp/server.pyFastMCP server; all @mcp.tool() functions.
  • keycloak_mcp/__main__.py — CLI entry point (--check, --version) plus a Windows-only stdout wrapper that strips CRLF back to LF.

Required env vars: KEYCLOAK_URL, KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET. Optional: KEYCLOAK_REALM (default master), KEYCLOAK_SITES_INI, KEYCLOAK_DEFAULT_DATE_FROM_HOURS (default 24), and the heavy-tool bounds KEYCLOAK_DEADLINE (default 45s), KEYCLOAK_MAX_EVENTS (default 200000), KEYCLOAK_MAX_USERS (default 5000) — a wall-clock deadline + caps so a wide event window or a whole-realm get_totp_users returns a disclosed partial (⚠️) instead of blowing the ~60s gateway and hammering KeyCloak (see _paginate's deadline/max_total and server.py's _deadline_seconds/_max_events/_max_users). Each 0/negative disables. KEYCLOAK_USER_ATTRIBUTE_WHITELIST (default unset, comma-separated attribute keys) opts specific custom user attributes into get_user's output — unset, get_user never fetches or surfaces attributes at all (see _user_attribute_whitelist/get_user_by_id), so no custom attribute reaches tool output, hence LLM context, unless an operator explicitly names it. A whitelisted key that matches _looks_like_credential_key's substring list (password, secret, token, …) is reported as blocked rather than shown — a safety net on top of the whitelist, not a guarantee for arbitrarily-named credential attributes.

Read the full file on GitHub · 77 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 77 lines · 1,078 tokens per session scan A 88997e8e618b

Subscribe to this mod's changes

keycloak-mcp CLAUDE.md is an instructions file published in the GitHub repository shigechika/keycloak-mcp (0 stars, last pushed 6d ago), licensed MIT. It adds 1,078 tokens to every session, about $0.0054 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens