
Keycloak Admin
io.github.mrz1880由 GitHub 账号 mrz1880 发布v0.2.3更新于 Oct 24, 2026
Administer Keycloak via its Admin REST API: users, roles, clients, groups, IdP, events.
概览
本地 MCP 服务器,让助手通过 Keycloak Admin REST API 管理 Keycloak 26.x 领域中的用户、角色、客户端、组、身份提供方和事件。
- 可以做什么
- 搜索、读取、创建、更新、启用或禁用、删除领域用户,查看会话、发送操作邮件、重置密码和注销会话
- 列出、分配和撤销用户与组的领域角色及客户端角色
- 列出、创建、更新和删除客户端,读取或重新生成客户端密钥,管理默认作用域和协议映射器
- 列出、创建和删除组,增删成员,为组授予角色
- 列出、创建和删除身份提供方及其映射器,列出用户联合提供方并触发同步
- 读取认证流程、必需操作、授权资源、策略与权限、登录与管理员事件、领域配置和服务器版本
- 适用场景
- 适合让助手或 IDE 代理完成日常 Keycloak 运维——查询用户、管理角色、客户端和组、读取事件——而不必交出原始管理控制台。尤其适合希望在操作外加上只读模式和领域白名单等防护的团队。
- 运行要求
- 需要 Node.js 20 或更高版本,以及可访问的 Keycloak 26.x 服务器。必需环境变量:KEYCLOAK_BASE_URL、KEYCLOAK_REALM 和 AUTH_MODE。service_account 模式需 KC_CLIENT_ID 与 KC_CLIENT_SECRET;password 模式需 KC_ADMIN_USERNAME 与 KC_ADMIN_PASSWORD,可选 KC_ADMIN_REALM。可选 READ_ONLY 和 ALLOWED_REALMS。以 stdio 本地运行,通常通过 npx 启动。
安装
在 SourceWeft 中
- 打开 控制台中的 Keycloak Admin,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
mcp-keycloak-admin
[npm version] [CI] [CodeQL] [License: MIT]
A Model Context Protocol (MCP) server to administer a Keycloak instance through its Admin REST API. Safe by default, configurable, and built with a clean, test-driven architecture.
Compatible with Keycloak 26.x (validated against 26.0.5).
Install
No install needed — run it straight from npm with npx:
The server speaks MCP over stdio, so you normally wire it into an MCP client rather than running it by hand — see Usage with an MCP client. New to it? The Quickstart spins up a local Keycloak and a client config in a couple of minutes.
Why
Administering Keycloak from an MCP client (an assistant, an IDE, a custom agent) means exposing day-to-day operations — searching users, managing roles, reading events — as MCP tools, without handing over a raw admin console. This server does that with strong guardrails so destructive actions never happen silently.
Features
- Two authentication modes, selectable by configuration:
service_account— a confidential client with a service account (recommended; no admin password stored).password— theadmin-cliclient with an admin username/password.
- Safe by default:
READ_ONLYmode hides every write/destructive tool.ALLOWED_REALMSrestricts which realms the server may operate on.- Destructive operations require explicit confirmation (native MCP
elicitation, with a
confirm: trueparameter fallback for clients that do not support elicitation).
- Clean Architecture: a framework-free domain, application use cases, and infrastructure adapters. No business concept travels as a raw string or number — every one is a validated value object.
Requirements
- Node.js >= 20
- A reachable Keycloak 26.x server
Usage with an MCP client
Add the server to your MCP client configuration:
See docs/setup-keycloak.md to create the mcp-admin
client and grant it the least-privilege roles it needs.
Multiple Keycloak instances
Each server entry targets one Keycloak (one base URL + realm + auth). To manage several environments, add one entry per instance — each fully isolated, with its own credentials and guardrails:
The client namespaces the tools per server (e.g. kc-prod:keycloak_user_delete),
so there's no risk of running an operation against the wrong environment. This
is the recommended pattern: you can, for example, keep production READ_ONLY
while preprod stays writable.
Configuration
A full example lives in .env.example.
Tools
Levels: [R] read-only · [W] write · [D] destructive (requires
confirmation). Every tool carries the matching MCP annotations
(readOnlyHint / destructiveHint / idempotentHint).
Currently implemented:
Note: this table tracks the
mainbranch, which can run ahead of the latest npm release shown by the version badge above. To confirm what's available in your install, checknpm view mcp-keycloak-admin versionand pinmcp-keycloak-admin@latest.
See docs/users.md, docs/roles.md, docs/clients.md, docs/groups.md and docs/events-realm.md for parameters and examples, and docs/security.md for the safety model.
Roadmap
The architecture is designed to keep growing as thin use cases + tools. Remaining candidates: authorization policy/permission CRUD and evaluation, authentication flow mutation (copy/add executions), and advanced federation and identity-provider configuration. See docs/development.md for how to add one.
Development
Releases are automated — see docs/releasing.md.
Contributing
Contributions are welcome — please read CONTRIBUTING.md.
License
来源:README.md,提交 8f97751
工具
0版本历史
1- v0.2.3最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分