SuperAPIAI Directory

mcp-keycloak-admin

github.com · AI developer platforms

Administer Keycloak via its Admin REST API: users, roles, clients, groups, identity providers, federation and events, with a read-only mode.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux · API

About this tool

Purpose

mcp-keycloak-admin is a Model Context Protocol (MCP) server for managing Keycloak instances through Keycloak's Admin REST API. It enables MCP clients (such as AI assistants, IDEs, or custom agents) to perform routine administrative operations as MCP tools—searching users, managing roles, reading events, and more—without directly exposing the raw admin console. The server has built-in strong guardrails to ensure destructive operations are not executed silently.

Main Capabilities

  • Manage Keycloak's users, roles, clients, groups, identity providers, federation, and events through MCP tools.
  • Two authentication modes, selectable via configuration:
    • service_account: Use a confidential client with a service account (recommended; does not store an admin password).
    • password: Use the admin-cli client with an admin username/password.
  • Default security mechanisms:
    • READ_ONLY mode hides all write/destructive tools.
    • ALLOWED_REALMS restricts the realms the server can operate on.
    • Destructive operations require explicit confirmation (native MCP elicitation, with a fallback to the confirm: true parameter for clients that do not support elicitation).
  • Tools are labeled by level: [R] read-only, [W] write, [D] destructive (requires confirmation), and each tool carries matching MCP annotations (readOnlyHint / destructiveHint / idempotentHint).
  • Supports multiple Keycloak instances: each server entry targets one Keycloak (one base URL + realm + authentication). Multiple entries can be added to manage multiple environments, with each instance fully isolated and having its own credentials and guardrails. Clients namespace tools per server (for example kc-prod:keycloak_user_delete) to avoid operating on the wrong environment. Recommended pattern: for example, keep production READ_ONLY while staging can be writable.
  • Uses clean architecture: a framework-free domain layer, an application use-case layer, and infrastructure adapters. No business concept is passed as a raw string or number—each is a validated value object.
  • Compatible with Keycloak 26.x (verified 26.0.5).

Usage

No installation required—run directly from npm via npx:

npx mcp-keycloak-admin

The server uses the MCP protocol over stdio, so it usually needs to be connected to an MCP client rather than run manually. Add the server to the MCP client configuration.

To create the mcp-admin client and grant it the minimum required permission roles, see docs/setup-keycloak.md.

A complete example is located in .env.example.

Applicable Scenarios

  • Managing Keycloak's routine operational tasks through an AI assistant or IDE.
  • Needing to perform Keycloak administrative operations securely and audibly, avoiding misoperations.
  • Keycloak management across multiple environments (such as production and staging), with different security levels configurable for each.
  • Wanting to grant administrative capabilities under the principle of least privilege, rather than using the admin console directly.

Limitations

  • Requires an accessible Keycloak 26.x server.
  • Currently implemented features include realm management for users, roles, clients, groups, events, and more; the remaining candidate features (such as CRUD and evaluation of authorization policies/permissions, authentication flow changes, advanced federation and identity provider configuration) are not yet implemented.
  • For the specific tool list and parameters, see docs/users.md, docs/roles.md, docs/clients.md, docs/groups.md, and docs/events-realm.md; for the security model, see docs/security.md.
  • The table tracks the main branch and may be ahead of the latest npm release; you can confirm the installed version via npm view mcp-keycloak-admin version, and pin to mcp-keycloak-admin@latest.
  • Release automation; for contributions, please read CONTRIBUTING.md.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools