io.github.dockndevai/mcp-keycloak

Registre officiel IA et agents

Keycloak admin for AI agents — realms, users, clients, roles; safe-by-default governance.

Que pouvez-vous faire avec io.github.dockndevai/mcp-keycloak ?

  • Multi-realm — every tool takes a realm argument; scope it with an allowlist.
  • Access modes — read-only → read-write → admin, layered so a mode never exposes tools above its level.
  • Security flags — realm allowlist, protected realms, delete gating, dry-run, and JSON audit logging (see below).
  • Two auth strategies — confidential-client service account (recommended) or admin username/password.
  • Zero heavy dependencies — a thin fetch-based Admin REST client, plus the MCP SDK and zod.

Installation

Ajoutez ceci à la configuration MCP de votre client (Claude Desktop : claude_desktop_config.json ; Cursor : .cursor/mcp.json ; VS Code et les autres utilisent la même forme « mcpServers »).

NPM package @dockndevai/mcp-keycloak
Claude Code
claude mcp add mcp-keycloak -e 'KEYCLOAK_URL=<KEYCLOAK_URL>' -e 'KEYCLOAK_CLIENT_ID=<KEYCLOAK_CLIENT_ID>' -e 'KEYCLOAK_CLIENT_SECRET=<your keycloak_client_secret>' -e 'KEYCLOAK_MODE=<KEYCLOAK_MODE>' -- npx -y @dockndevai/mcp-keycloak@0.3.3
Configuration JSON (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "mcp-keycloak": {
            "command": "npx",
            "args": [
                "-y",
                "@dockndevai/mcp-keycloak@0.3.3"
            ],
            "env": {
                "KEYCLOAK_URL": "<KEYCLOAK_URL>",
                "KEYCLOAK_CLIENT_ID": "<KEYCLOAK_CLIENT_ID>",
                "KEYCLOAK_CLIENT_SECRET": "<your keycloak_client_secret>",
                "KEYCLOAK_MODE": "<KEYCLOAK_MODE>"
            }
        }
    }
}

Variables d'environnement

  • KEYCLOAK_URL obligatoire Base URL of the Keycloak server (no trailing slash).
  • KEYCLOAK_CLIENT_ID Client id used to authenticate (default admin-cli).
  • KEYCLOAK_CLIENT_SECRET secret Service-account client secret (or use KEYCLOAK_USERNAME/PASSWORD).
  • KEYCLOAK_MODE Access mode: read-only | read-write | admin.

Documentation

Tirée du README du projet sur GitHub, actualisée chaque semaine. Les liens ouvrent GitHub.

Sommaire
  1. mcp-keycloak
  2. Features
  3. Security model
  4. Tools
  5. Quickstart — add to your agent
  6. Configure
  7. Run from source (development)
  8. Develop
  9. Publishing
  10. License

mcp-keycloak

A Model Context Protocol server for Keycloak. It lets an MCP-capable client (Claude Desktop, Claude Code, etc.) inspect and manage Keycloak realms, users, clients, roles, and groups — with security controlled entirely by flags.

The design goal is safe by default: it starts read-only, scopes to an allowlist of realms, protects sensitive realms from mutation, and gates destructive operations behind an explicit opt-in.

Features

  • Multi-realm — every tool takes a realm argument; scope it with an allowlist.
  • Access modes — read-only → read-write → admin, layered so a mode never exposes tools above its level.
  • Security flags — realm allowlist, protected realms, delete gating, dry-run, and JSON audit logging (see below).
  • Two auth strategies — confidential-client service account (recommended) or admin username/password.
  • Zero heavy dependencies — a thin fetch-based Admin REST client, plus the MCP SDK and zod.

Security model

ConcernFlagDefaultEffect
What can the server do at all?KEYCLOAK_MODEread-onlyread-only exposes only read tools; read-write adds mutations; admin adds destructive tools. Tools above the mode are never registered.
Which realms are in scope?KEYCLOAK_REALM_ALLOWLIST(all)Comma-separated. When set, any operation on a realm outside the list is refused.
Which realms are read-only forever?KEYCLOAK_PROTECTED_REALMSmasterProtected realms can be read but never mutated or deleted, regardless of mode.
Can it delete?KEYCLOAK_ALLOW_DELETEfalsedelete_* tools require this and admin mode.
Preview without touching KeycloakKEYCLOAK_DRY_RUNfalseWrite/admin tools validate + log intent, then return without calling Keycloak.
Audit trailKEYCLOAK_AUDIT_LOGtrueEmits a JSON line to stderr per guarded operation (ALLOW / DENY / DRY_RUN).
Interactive confirmation(automatic)—Destructive & high-impact actions prompt the human to approve via MCP elicitation before running; clients without elicitation fall back to the *_ALLOW_* gate.

These layers are independent — for example admin mode with KEYCLOAK_ALLOW_DELETE=false can create and update users but cannot delete them.

Tools

Read (read-only+): list_realms, get_realm, list_users, get_user, count_users, list_clients, list_realm_roles, list_groups

Write (read-write+): create_user, update_user, reset_password, logout_user

Admin (admin): delete_user

Quickstart — add to your agent

Published on npm as @dockndevai/mcp-keycloak. No clone or build needed — your MCP client runs it on demand with npx. Start in read-only mode; see .env.example for every variable and docs/CLIENTS.md for the full per-client guide.

Claude Code (CLI)

claude mcp add keycloak -e KEYCLOAK_URL="https://keycloak.example.com" -e KEYCLOAK_CLIENT_ID="admin-cli" -e KEYCLOAK_CLIENT_SECRET="your-secret" -e KEYCLOAK_MODE="read-only" -- npx -y @dockndevai/mcp-keycloak

Claude Desktop · Cursor · Windsurf — same block in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "keycloak": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-keycloak"
      ],
      "env": {
        "KEYCLOAK_URL": "https://keycloak.example.com",
        "KEYCLOAK_CLIENT_ID": "admin-cli",
        "KEYCLOAK_CLIENT_SECRET": "your-secret",
        "KEYCLOAK_MODE": "read-only"
      }
    }
  }
}

OpenAI Codex CLI — in ~/.codex/config.toml:

[mcp_servers.keycloak]
command = "npx"
args = ["-y", "@dockndevai/mcp-keycloak"]
env = { KEYCLOAK_URL = "https://keycloak.example.com", KEYCLOAK_CLIENT_ID = "admin-cli", KEYCLOAK_CLIENT_SECRET = "your-secret", KEYCLOAK_MODE = "read-only" }

VS Code (GitHub Copilot, Agent mode) — in .vscode/mcp.json:

{
  "servers": {
    "keycloak": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-keycloak"
      ],
      "env": {
        "KEYCLOAK_URL": "https://keycloak.example.com",
        "KEYCLOAK_CLIENT_ID": "admin-cli",
        "KEYCLOAK_CLIENT_SECRET": "your-secret",
        "KEYCLOAK_MODE": "read-only"
      }
    }
  }
}

Configure

Copy .env.example and fill it in, or set the variables directly in your MCP client config. A confidential client with the realm-management roles you need is the recommended credential.

Run from source (development)

Prefer the published package above. To run from a clone:

npm install
npm run build
node dist/index.js   # with the environment variables set

Develop

npm run dev        # watch mode
npm test           # unit tests for the security policy
npm run typecheck

Publishing

This server ships a server.json for the official MCP registry and an mcpName for npm ownership validation. See PUBLISHING.md for publishing to npm and listing on the MCP registry, Smithery, Glama, Cursor, and PulseMCP.

License

MIT

Questions fréquentes

Qu'est-ce que io.github.dockndevai/mcp-keycloak ?

Keycloak admin for AI agents — realms, users, clients, roles; safe-by-default governance.

Comment installer io.github.dockndevai/mcp-keycloak ?

Il s'exécute sur votre machine. Dans Claude Code : claude mcp add mcp-keycloak -e 'KEYCLOAK_URL=<KEYCLOAK_URL>' -e 'KEYCLOAK_CLIENT_ID=<KEYCLOAK_CLIENT_ID>' -e 'KEYCLOAK_CLIENT_SECRET=<your keycloak_client_secret>' -e 'KEYCLOAK_MODE=<KEYCLOAK_MODE>' -- npx -y @dockndevai/mcp-keycloak@0.3.3. Pour les autres clients, collez la configuration JSON de cette page dans leurs réglages MCP.

Faut-il une clé API pour io.github.dockndevai/mcp-keycloak ?

Oui. Il attend KEYCLOAK_URL, KEYCLOAK_CLIENT_SECRET, à renseigner dans sa configuration.

io.github.dockndevai/mcp-keycloak est-il open source ?

Oui. Son code est sur GitHub sous licence MIT.

Qui maintient io.github.dockndevai/mcp-keycloak ?

Il est publié par dockndevai. AI.tn le référence sans le maintenir ni le recommander.

Issu du registre MCP officiel. Être listé n'est pas une recommandation : vérifiez le code et les permissions d'un serveur avant de lui donner accès à vos données.