
mcp-keycloak
Managing Keycloak identity and access management
README
Keycloak MCP Server
A Model Context Protocol (MCP) server that provides a natural language interface for managing Keycloak identity and access management through its REST API. This server enables AI agents to perform user management, client configuration, realm administration, and role-based access control operations seamlessly.
Overview
The Keycloak MCP Server bridges the gap between AI applications and Keycloak's powerful identity management capabilities. Whether you're building an AI assistant that needs to manage users, configure clients, or handle complex authorization scenarios, this server provides the tools you need through simple, natural language commands.
Features
🔐 Comprehensive User Management
Manage users lifecycle from creation to deletion, including password resets, session management, and user attribute updates.
🏢 Client Configuration
Create and configure OAuth2/OIDC clients, manage client secrets, and handle service accounts programmatically.
👥 Role-Based Access Control
Define and assign realm and client-specific roles, manage user permissions, and implement fine-grained access control.
🏛️ Realm Administration
Configure realm settings, manage default groups, handle event configurations, and control realm-wide policies.
🔄 Group Management
Organize users into groups, manage group hierarchies, and handle group-based permissions efficiently.
Installation
Installing via Smithery
To install mcp-keycloak for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install mcp-keycloak --client claude
Quick Start
Install using pip:
pip install mcp-keycloak
Development Installation
Clone the repository and install dependencies:
git clone https://github.com/idoyudha/mcp-keycloak.git
cd mcp-keycloak
pip install -e .
Configuration
The server can be configured using environment variables or a .env
file:
# Required configuration
SERVER_URL=https://your-keycloak-server.com
USERNAME=admin-username
PASSWORD=admin-password
REALM_NAME=your-realm
# Optional OAuth2 client configuration
CLIENT_ID=optional-client-id
CLIENT_SECRET=optional-client-secret
Tools
The Keycloak MCP Server provides a comprehensive set of tools organized by functionality:
User Management
Complete user lifecycle management including:
list_users
- List users with pagination and filteringcreate_user
/update_user
/delete_user
- Full CRUD operationsreset_user_password
- Password managementget_user_sessions
/logout_user
- Session controlcount_users
- User statistics
Client Management
OAuth2/OIDC client configuration:
list_clients
/get_client
/create_client
- Client operationsget_client_secret
/regenerate_client_secret
- Secret managementget_client_service_account
- Service account accessupdate_client
/delete_client
- Client modifications
Role Management
Fine-grained permission control:
list_realm_roles
/create_realm_role
- Realm role operationslist_client_roles
/create_client_role
- Client-specific rolesassign_realm_role_to_user
/remove_realm_role_from_user
- Role assignmentsget_user_realm_roles
/assign_client_role_to_user
- User role queries
Group Management
Hierarchical user organization:
list_groups
/create_group
/update_group
- Group operationsget_group_members
/add_user_to_group
- Membership managementget_user_groups
/remove_user_from_group
- User group associations
Realm Administration
System-wide configuration:
get_realm_info
/update_realm_settings
- Realm configurationget_realm_events_config
/update_realm_events_config
- Event managementadd_realm_default_group
/remove_realm_default_group
- Default settings
Usage
Running the Server
Start the MCP server directly:
python -m src.main
Integration Examples
Claude Desktop
- Clone the server:
git clone https://github.com/idoyudha/mcp-keycloak.git
- Configure in
claude_desktop_config.json
:
{
"mcpServers": {
"keycloak": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-keycloak",
"run",
"src/main.py"
],
"env": {
"SERVER_URL": "https://your-keycloak.com",
"USERNAME": "admin",
"PASSWORD": "admin-password",
"REALM_NAME": "your-realm"
}
}
}
}
Using uvx
{
"mcpServers": {
"keycloak": {
"command": "uvx",
"args": [
"mcp-keycloak"
],
"env": {
"SERVER_URL": "https://your-keycloak.com",
"USERNAME": "admin",
"PASSWORD": "admin-password",
"REALM_NAME": "your-realm"
}
}
}
}
Example Use Cases
🤖 AI-Powered Identity Management
Build AI assistants that can handle user onboarding, permission management, and access control through natural language commands.
🔄 Automated User Provisioning
Create workflows that automatically provision users, assign roles, and configure client applications based on business rules.
📊 Identity Analytics
Query and analyze user data, session information, and access patterns to gain insights into your identity infrastructure.
🚀 DevOps Integration
Integrate Keycloak management into your CI/CD pipelines, allowing automated configuration of identity services.
Requirements
- Python 3.8 or higher
- Keycloak server (tested with Keycloak 18+)
- Admin access to Keycloak realm
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues, questions, or contributions, please visit the GitHub repository.
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。