
Keycloak Model Context Protocol
io.github.ChristophEnglisch由 GitHub 帳號 ChristophEnglisch 發布v1.1.0更新於 Oct 29, 2026
Manage Keycloak users, groups, roles and realms through the Keycloak Admin REST API.
概覽
讓助理透過 Keycloak Admin REST API 管理 Keycloak 的領域、使用者、群組、角色、工作階段、用戶端與事件,並對寫入操作設有防護。
- 可以做什麼
- 列出並檢視領域,包括領域設定的安全子集與安全摘要
- 搜尋、讀取、建立、更新與刪除使用者,並寄送操作郵件
- 列出群組及成員,將使用者加入或移出群組
- 列出角色與使用者角色,指派或撤銷角色
- 檢視用戶端,列出使用者工作階段並登出使用者
- 讀取登入事件與管理員事件,檢查暴力破解鎖定狀態並解鎖帳號
- 適用情境
- 適合讓助理協助日常 Keycloak 身分管理工作:查詢使用者及其角色、辦理員工到職或離職、稽核領域安全設定,或調查登入失敗與帳號鎖定。
- 執行需求
- 以 npm 套件形式透過 stdio 在本機執行,需要 Node.js 22 或更新版本,以及可連線的 Keycloak 伺服器。需要 KEYCLOAK_URL 和一組憑證:KEYCLOAK_CLIENT_ID 搭配 KEYCLOAK_CLIENT_SECRET(建議的服務帳號方式),或 KEYCLOAK_USERNAME 搭配 KEYCLOAK_PASSWORD。選用設定可控制工具集、唯讀模式、領域允許清單與逾時。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Keycloak Model Context Protocol,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Keycloak MCP Server
[npm version] [CI] [License: MIT]
A Model Context Protocol (MCP) server for Keycloak administration. It lets an AI assistant such as Claude manage users, groups, roles and sessions, and inspect clients, events and the security posture of your realms, through the Keycloak Admin REST API, with least-privilege authentication and guardrails around every write.
[!WARNING] This server acts with the permissions of the Keycloak account you give it. Use a dedicated service-account client with only the roles you need, never the bootstrap admin. Every tool that changes data asks for confirmation by default, and a read-only mode is available. See Security.
Highlights
- 24 tools in 7 toolsets, enabled per toolset. The default set (
core,groups,roles) is small; everything else is opt-in. - Least-privilege auth.
client_credentialswith a service account is the recommended grant; the password grant stays available. No credential defaults, so a missing setting fails fast. - Guardrails. Read-only mode, realm allowlist, write protection for the
masterrealm, and a preview-then-confirm: trueflow for every change. Grants of administrative rights are detected through composite roles and parent groups. - 4 guided prompts (onboarding, offboarding, security audit, failed-login investigation) and MCP resources for realms and users, with realm-name completion.
- Structured, paginated output with output schemas; secrets and credentials are never returned or logged.
- Works with Claude Desktop, Claude Code, VS Code, Cursor and any stdio MCP client. Requires Node.js 22 or newer.
How it works
Your MCP client starts the server as a local child process and talks to it over stdio. Every tool call passes the guards, then goes through a single gateway that owns the Keycloak login and caches the access token.
What a confirmed call looks like
Every tool that changes data is destructive (it deletes or revokes) or sensitive (it changes identity, credentials, rights or protection mechanisms, for example user_update or user_role_assign). Called without confirm: true, such a tool only returns a preview of what would happen and changes nothing. After you approve, the assistant repeats the call with confirm: true.
The model can set confirm: true itself, even on its first call. The server then still computes the preview and returns it with the result, but only your client's approval prompt proves that a human agreed. All these tools carry destructiveHint, so clients that ask before destructive calls ask here too.
Quick start
Requirements: Node.js 22 or newer, a Keycloak server your machine can reach (tested with Keycloak 24.0 to 26.8), and an MCP client.
1. Prepare Keycloak (3 steps)
In the realm you want to administer (here demo):
- Create a client
mcp-adminwith Client authentication on and only Service accounts roles enabled (turn off Standard flow and Direct access grants). - Assign roles. On the client's Service accounts roles tab, assign client roles of
realm-management. For a first read-only trial:view-users,query-users,query-groups,view-realm. - Copy the secret from the client's Credentials tab.
Step-by-step instructions with Admin Console click paths, kcadm.sh commands and a local Docker Keycloak: docs/getting-started.md.
2. Configure your MCP client
Example for Claude Code (other clients: docs/clients.md):
Or as JSON (Claude Desktop, claude_desktop_config.json):
3. Ask your first question
List the realms you can access, then show me the first 10 users of realm demo.
If you get an answer, you are done. If not, see docs/troubleshooting.md.
Configuration
All settings are environment variables. Only KEYCLOAK_URL and one set of credentials are required.
Full reference with examples, validation rules and the tool-to-role matrix: docs/configuration.md.
Toolsets and tools
Tools are named <domain>_<verb>. Only the default toolsets are enabled unless you set KEYCLOAK_MCP_TOOLSETS. In read-only mode only tools of kind read are registered.
Details for every tool (parameters, outputs, required roles): docs/tools-reference.md.
Prompts and resources
Prompts are guided workflows built on the tools. They appear in your client's prompt picker (in Claude Code as slash commands). The realm argument autocompletes.
Resources are read-only JSON documents, filtered by the same realm allowlist:
Security
- Least privilege first. Use a service-account client scoped to one realm with only the
realm-managementroles you need. A role matrix is in docs/configuration.md. - Every change needs confirmation (
KEYCLOAK_MCP_REQUIRE_CONFIRMATION=true): destructive and sensitive tools show a preview first. Grants of administrative rights, also through composite roles and parent groups, profile changes and action e-mails for accounts with administrative rights, and changes to the server's own account need a confirmation thatKEYCLOAK_MCP_REQUIRE_CONFIRMATION=falsedoes not turn off. Role and group grants, profile changes and action e-mails for the server's own account are refused. - Account takeover protection: a changed e-mail address is marked as unverified unless stated otherwise, action e-mail links are valid for at most 24 hours, and previews name the recipient address and whether the target account has administrative rights.
- Blast-radius limits:
KEYCLOAK_MCP_READ_ONLY,KEYCLOAK_MCP_REALMS, and write protection formaster(off by default). - No secrets in output or logs. Credentials are masked on stderr; tools never return client secrets, user credentials or attributes.
- Prompt injection: treat names and descriptions coming from Keycloak as data. The shipped prompts say so explicitly; keep write tools disabled when you do not need them.
Threat model, hardening checklist and how to report a vulnerability: docs/security.md and SECURITY.md.
Example prompts
- "Which realms can you see? Show me the settings of realm
demo." - "Find all users in
demowhose e-mail ends with@example.comand who are disabled." - "Create user
jdoe(Jane Doe, [email protected]) indemo, add her to groupengineeringand send her an e-mail to set a password." - "Who is in the group
ops, and which roles doesalicehave, including composite roles?" - "Run the
audit_realm_securityprompt fordemo." (needsclientsandeventstoolsets for the full audit) - "There were many failed logins last night. Investigate realm
demo." - "Offboard
bobindemo: end his sessions and disable the account."
Documentation
Upgrade from 0.x
Version 1.0 changes the defaults: credentials are required (no admin/admin fallback), destructive tools ask for confirmation, and the tools were renamed to <domain>_<verb> (for example create-user became user_create, delete-user became user_delete). The old KEYCLOAK_ADMIN and KEYCLOAK_ADMIN_PASSWORD variables still work but are deprecated. See the migration guide.
Contributing and license
Contributions are welcome. See CONTRIBUTING.md and the Code of Conduct. Released under the MIT License.
來源:README.md,提交 b2c37f7
工具
0版本歷史
3- v1.1.0最新Oct 29, 2026
- v1.0.3Oct 26, 2026
- v1.0.2Oct 25, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Model 整合

model.tools — Zero-Auth Agent Utilities
tools.model官方發布者
零認證遠端工具伺服器,讓代理程式讀取一次性信箱驗證碼、保存檢查點、接收 Webhook、排定喚醒、取得任務回執,並把網頁轉成 Markdown。
NLP.COM.AI Open Model Catalog
ai.com.nlp官方發布者
搜尋精選的開放權重AI模型發布、授權條款、架構和原始來源。AI 翻譯

Hologram Model Hub
foundation.uor.hub官方發布者
一個遠端 MCP 伺服器,讓助理搜尋開放模型索引,並取得附有 SHA-256 校驗值的下載連結。

ModelLens
由 GitHub 帳號 Greatbeing 發布
探測相容於 OpenAI 的模型閘道,依實測延遲與成功率為模型排名,並推薦該用哪個模型。

Bedrock Multi-Model
由 GitHub 帳號 Sagargupta16 發布
本機 MCP 伺服器,把 AWS Bedrock 的文字、影像、影片與嵌入模型包裝成九個工具,讓助理可以提問、比較與評審模型。