MCP Keycloak

MCP安全风控

提供方 idoyudha

安全风控 HTTP · 远程 无需鉴权 社区 / 第三方
查看接入方式

Managing Keycloak identity and access management

一句话选型结论

按资料字段整理

MCP Keycloak 属于安全风控类 MCP 服务器,HTTP · 远程,无需鉴权,有可直接复制的远程端点配置。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类安全风控 传输方式HTTP · 远程 鉴权无需鉴权 部署方式支持远程部署
GitHub 星标 未标注 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

安全风控
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

安装与配置

HTTP · 远程 无需鉴权
连远程 HTTPS 端点,通常为 Streamable HTTP
pip install mcp-keycloak

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    确认你的客户端支持远程端点,并拿到服务地址。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
资产与漏洞排查

盘点资产、扫漏洞、看暴露面。

日志与审计

汇总日志、查异常行为。

合规检查

按规则检查配置与权限是否合规。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 资料标注无需鉴权,装好就能连。

先想清楚的地方

  • 远程端点依赖网络与服务方可用性,注意密钥与调用额度。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在安全风控场景里让模型直接调用外部能力的人。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
MCP Keycloak当前 未标注 HTTP · 远程 支持远程部署 有 2026-05-17
Cyber Strike AI 75 未标注 未标注 无 2026-05-17
mcp-for-beginners 未标注 stdio · 本地进程 本地部署 有 2026-04-13
casdoor 未标注 stdio · 本地进程 本地部署 有 2026-04-12
kubeshark 未标注 stdio · 本地进程 本地部署 有 2026-04-11
Modelcontextprotocol C22988b0 未标注 stdio · 本地进程 本地部署 有 2026-05-17

服务器档案

安全风控
字段来自项目仓库与公开索引,中文说明由本站标注
提供方idoyudha上游标注的维护方 idoyudha
分类安全风控本站按上游分类展示
连接方式HTTP · 远程连远程 HTTPS 端点,通常为 Streamable HTTP
鉴权方式无需鉴权远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · Python本地安装时用到的包标识与运行时
部署类型支持远程部署上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

10.7 KB
来自项目仓库与上游目录的原文,未做删改

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.

🔐 Authentication Management

Comprehensive authentication flow management including creating, updating, and deleting flows, managing executions, and configuring authenticators.

🔄 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:```bash
npx -y @smithery/cli install mcp-keycloak --client claude


### Quick Start

Install using pip:```bash
pip install mcp-keycloak

Development Installation

Clone the repository and install dependencies:```bash
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:```bash
# 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 filtering
- create_user / update_user / delete_user - Full CRUD operations
- reset_user_password - Password management
- get_user_sessions / logout_user - Session control
- count_users - User statistics

Client Management

OAuth2/OIDC client configuration:
- list_clients / get_client / create_client - Client operations
- get_client_secret / regenerate_client_secret - Secret management
- get_client_service_account - Service account access
- update_client / delete_client - Client modifications

Role Management

Fine-grained permission control:
- list_realm_roles / create_realm_role - Realm role operations
- list_client_roles / create_client_role - Client-specific roles
- assign_realm_role_to_user / remove_realm_role_from_user - Role assignments
- get_user_realm_roles / assign_client_role_to_user - User role queries

Group Management

Hierarchical user organization:
- list_groups / create_group / update_group - Group operations
- get_group_members / add_user_to_group - Membership management
- get_user_groups / remove_user_from_group - User group associations

Realm Administration

System-wide configuration:
- get_accessible_realms - List of accessible realms
- get_realm_info / update_realm_settings - Realm configuration
- get_realm_events_config / update_realm_events_config - Event management
- add_realm_default_group / remove_realm_default_group - Default settings

Authentication Management

Complete authentication flow control:
- list_authentication_flows / get_authentication_flow - Flow management
- create_authentication_flow / update_authentication_flow - Flow CRUD operations
- delete_authentication_flow / copy_authentication_flow - Flow modifications
- get_flow_executions / update_flow_executions - Execution management
- create_execution / delete_execution - Execution lifecycle
- get_authenticator_config / create_authenticator_config - Configuration management
- get_required_actions / update_required_action - Required actions control

Usage

Running the Server

The server supports both stdio (default) and HTTP transports. The smithery.yaml configuration file enables deployment on the Smithery platform and automatic installation via Smithery CLI:```bash

Run in stdio mode (default, for local CLI tools)

python -m src.main

Run in HTTP mode with streamable HTTP transport

TRANSPORT=http python -m src.main

Run HTTP mode on a custom port

TRANSPORT=http PORT=8080 python -m src.main

Or use the convenience script:

./scripts/run_server.sh # stdio mode (default)
./scripts/run_server.sh http # HTTP mode
PORT=8080 ./scripts/run_server.sh http # HTTP mode on custom port


When using HTTP transport, the server will be accessible at `http://127.0.0.1:8000/mcp/` (or your custom PORT).

### HTTP Transport

The Keycloak MCP Server supports HTTP transport mode, which offers several advantages:

- **Network Accessibility**: Access the server from any machine on your network
- **Multiple Clients**: Support concurrent connections from multiple AI clients
- **Integration Flexibility**: Easy integration with web applications and APIs
- **Load Balancing**: Deploy behind a reverse proxy for scalability

#### HTTP Protocol Details

The HTTP transport follows the MCP specification for Streamable HTTP. FastMCP automatically handles all protocol requirements:

- **Endpoint**: All communication happens through `/mcp/` endpoint
- **Request Method**: POST requests with JSON-RPC 2.0 messages
- **Content Types**:
  - Server returns `Content-Type: application/json` for single responses
  - Server returns `Content-Type: text/event-stream` for streaming responses
- **Accept Headers**: Clients must include `Accept: application/json, text/event-stream`
- **Message Format**: All messages use JSON-RPC 2.0 format, UTF-8 encoded

FastMCP automatically determines whether to return a single JSON response or an SSE stream based on the request type and whether the response needs streaming capabilities.

#### Connecting to HTTP Server

When running in HTTP mode, clients can connect to:```
http://127.0.0.1:8000/mcp/

Example client request:```bash
curl -X POST http://localhost:8000/mcp/ \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "method": "list_tools", "id": 1}'


#### Security Implementation

The HTTP transport implements all MCP specification security requirements:

**✅ Origin Header Validation (REQUIRED)**
- Automatically validates Origin headers to prevent DNS rebinding attacks
- Only allows connections from `localhost` and `127.0.0.1` origins
- Blocks unauthorized cross-origin requests

**✅ Localhost Binding (RECOMMENDED)**
- Binds to `127.0.0.1` only to prevent network-based attacks
- Follows MCP specification security recommendations

**✅ No Authentication Required**
- The server runs without authentication requirements for simplified local development
- Suitable for localhost usage and trusted environments

For production deployments, additional considerations:
- Use HTTPS with proper certificates
- Deploy behind a reverse proxy (nginx, Apache)
- Set appropriate firewall rules
- Implement authentication at the reverse proxy level if needed

### Integration Examples

#### Prerequisites

Before integrating the Keycloak MCP Server, ensure you have one of the following installed:

- **uvx** (recommended): Install via `pip install uvx` or `pipx install uvx`
- **uv**: Follow installation instructions
- **npm/npx**: For Smithery installation (comes with Node.js)

#### Option 1: Using Smithery CLI (Recommended)

The easiest way - automatically configures everything for Claude Desktop:```bash
npx @smithery/cli install @idoyudha/mcp-keycloak --client claude

This command will prompt you for the required configuration values and set up the server automatically.

Option 2: Using uvx (Manual Setup)

No cloning required! Add to your claude_desktop_config.json:```json
{
"mcpServers": {
"keycloak": {
"command": "uvx",
"args": ["mcp-keycloak"],
"env": {
"SERVER_URL": "https://your-keycloak.com",
"USERNAME": "admin",
"PASSWORD": "admin-password",
"REALM_NAME": "your-realm"
}
}
}
}


#### Option 3: Local Development Setup

For development or customization:

1. Clone the repository:```bash
git clone https://github.com/idoyudha/mcp-keycloak.git
cd mcp-keycloak
  1. Add to your claude_desktop_config.json:json { "mcpServers": { "keycloak": { "command": "uv", "args": [ "--directory", "/path/to/mcp-keycloak", "run", "python", "-m", "src" ], "env": { "SERVER_URL": "https://your-keycloak.com", "USERNAME": "admin", "PASSWORD": "admin-password", "REALM_NAME": "your-realm" } } } }

💡 Quick Tips:
- Replace /path/to/mcp-keycloak with the actual path where you cloned the repository
- Ensure your Keycloak server URL includes the protocol (https:// or http://)
- The REALM_NAME should match an existing realm in your Keycloak instance

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.

常见问题

7 问
答案由本站依据条目字段整理,不引用上游原文
MCP Keycloak 怎么安装?

在客户端按下面的安装命令接入:pip install mcp-keycloak。装完在客户端配置里引用同一个包或端点。

MCP Keycloak 怎么在客户端里配置?

它的传输方式未标注,在客户端 MCP 配置里按官方文档填写启动命令和参数,保存后重启客户端生效。

MCP Keycloak 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

MCP Keycloak 需要 API Key 吗?

资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

MCP Keycloak 能提供哪些能力?

资料显示能力标签包括 访问控制、Python、用户管理。具体工具清单以官方文档为准。

MCP Keycloak 需要什么运行环境?

运行时为 Python;属于远程端点,不需要在本地装运行时。

MCP Keycloak 是本地还是远程?

它是远程端点,连服务地址即可。传输方式为HTTP · 远程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。