SkillAgentSearch skills...

keycloak-mcp-server

A complete Model Context Protocol (MCP) server for Keycloak 26.x

Install / Use

claude mcp add paoloamato2 -- npx -y github:paoloamato2/keycloak-mcp-server

If the server publishes to npm under a different name, use that package instead — check the repo README.

About this skill
šŸ”Œ

MCP Server

Model Context Protocol server

Quality Score

74/100

Supported Platforms

Claude Code
Claude Desktop

Tags

Our assessment of keycloak-mcp-server

keycloak-mcp-server scores 74/100 on our quality scale, 3749th of 4,608 Development & Engineering skills we index.

Its MCP Server is 7.2 KB long, well organised into 24 sections with 10 code examples: a thorough specification that gives an agent plenty to work with.

It has 3 GitHub stars, so there is little community track record yet; judge it on its content.

Substance
29/30
Structure
20/20
Description
12/15
Adoption
3/20
Freshness
11/15

Maintenance, license and trust

  • The repository was last updated about 7 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
  • It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
  • Its trust signals score 81/100, with 3 cautions from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

keycloak-mcp-server compared with similar skills

All 4 of these similar skills score higher than keycloak-mcp-server; compare them before choosing.

SkillScoreStarsUpdatedFormat
keycloak-mcp-server (this skill)by paoloamato27437mo agoMCP Server
Agent-Reachby Panniantong100100.1ktodayCLAUDE.md
taste-skillby Leonxlnx10099.7ktodayCLAUDE.md
headroomby headroomlabs-ai10076.5ktodayCLAUDE.md
ai-job-searchby MadsLorentzen10059.2ktodayCLAUDE.md

Frequently asked questions

How do I install keycloak-mcp-server?
Run claude mcp add paoloamato2 -- npx -y github:paoloamato2/keycloak-mcp-server. The install tabs above show the steps for each supported agent.
Which AI agents does keycloak-mcp-server work with?
It is written for Claude Code and Claude Desktop, as a MCP Server file. Other agents that read the same format can often use it too.
Is keycloak-mcp-server safe to use?
It is MIT-licensed and scores 81/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is keycloak-mcp-server still maintained?
The repository was last updated about 7 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.

Keycloak MCP Server

<p align="center"> <img src="https://img.shields.io/badge/Keycloak-REST_API-00B2B2?style=for-the-badge&logo=keycloak&logoColor=white" alt="Keycloak version"> <img src="https://img.shields.io/badge/MCP-Model_Context_Protocol-5A67D8?style=for-the-badge" alt="MCP"> <img src="https://img.shields.io/badge/Python-3.11%2B-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python"> <img src="https://img.shields.io/github/license/paoloamato2/keycloak-mcp-server?style=for-the-badge" alt="License"> <img src="https://img.shields.io/github/stars/paoloamato2/keycloak-mcp-server?style=for-the-badge" alt="Stars"> </p> <p align="center"> <strong>A comprehensive <a href="https://modelcontextprotocol.io">Model Context Protocol (MCP)</a> server that exposes the <a href="https://www.keycloak.org/docs-api/latest/rest-api/index.html">Keycloak Admin REST API</a> as typed MCP tools. 299 tools covering all API categories.</strong> </p>

Features

  • Complete API coverage: All 299 Keycloak Admin REST API endpoints
  • Dual transport: stdio (Claude Code) and SSE (GitHub Copilot, other MCP clients)
  • Auto-authentication: Supports both password and client credentials flows with automatic token refresh
  • Zero configuration tools: Each tool is self-describing with full input schemas

API Categories

| Category | Tools | |---|---| | Attack Detection | 3 | | Authentication Management | 38 | | Client Certificates | 6 | | Client Initial Access | 3 | | Client Registration Policy | 1 | | Client Role Mappings | 10 | | Client Scopes | 10 | | Clients | 33 | | Components | 6 | | Groups | 11 | | Identity Providers | 15 | | Keys | 2 | | Organizations | 13 | | Protocol Mappers | 14 | | Realms Admin | 37 | | Roles | 28 | | Roles by ID | 10 | | Scope Mappings | 29 | | Users | 30 | | Total | 299 |

Demo

(Add a GIF or screenshot here demonstrating 3 real prompts and their executed tools!)

Installation

Option 1: Run directly with uvx (Recommended)

You can run the server directly without manual installation using astral's uv:

uvx keycloak-mcp-server

(When using uvx, you can pass environment variables inline or keep them in your MCP config file.)

Option 2: Install via pip

If you prefer a global or virtual environment installation:

pip install git+https://github.com/paoloamato2/keycloak-mcp-server.git

Option 3: Install from source (For development)

git clone https://github.com/paoloamato2/keycloak-mcp-server.git
cd keycloak-mcp-server
uv pip install -e .

Configuration

Set environment variables (or create a .env file based on .env.example):

# Required
export KEYCLOAK_URL=http://localhost:8080

# Authentication - Option A: Password flow
export KEYCLOAK_ADMIN_USERNAME=admin
export KEYCLOAK_ADMIN_PASSWORD=admin

# Authentication - Option B: Client credentials flow
export KEYCLOAK_CLIENT_ID=my-client
export KEYCLOAK_CLIENT_SECRET=my-secret

# Optional
export KEYCLOAK_ADMIN_REALM=master    # default: master
export KEYCLOAK_VERIFY_SSL=true       # default: true

Usage

Claude Code (stdio)

Add to your Claude Code MCP configuration (~/.claude/claude_desktop_config.json or project-level):

{
  "mcpServers": {
    "keycloak": {
      "command": "python",
      "args": ["-m", "keycloak_mcp_server"],
      "env": {
        "KEYCLOAK_URL": "http://localhost:8080",
        "KEYCLOAK_ADMIN_USERNAME": "admin",
        "KEYCLOAK_ADMIN_PASSWORD": "admin"
      }
    }
  }
}

Or if installed with uv:

{
  "mcpServers": {
    "keycloak": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/keycloak-mcp-server", "python", "-m", "keycloak_mcp_server"],
      "env": {
        "KEYCLOAK_URL": "http://localhost:8080",
        "KEYCLOAK_ADMIN_USERNAME": "admin",
        "KEYCLOAK_ADMIN_PASSWORD": "admin"
      }
    }
  }
}

GitHub Copilot (SSE)

Start the server with SSE transport:

python -m keycloak_mcp_server --transport sse --port 8080

Then configure in your GitHub Copilot MCP settings (VS Code settings.json):

{
  "github.copilot.chat.mcpServers": {
    "keycloak": {
      "type": "sse",
      "url": "http://localhost:8080/sse"
    }
  }
}

Command Line

# stdio mode (default)
python -m keycloak_mcp_server

# SSE mode
python -m keycloak_mcp_server --transport sse --host 0.0.0.0 --port 8080

# Using the entry point
keycloak-mcp-server --transport sse --port 8080

Security & Production Recommendations

āš ļø SECURITY WARNING: This MCP Server registers all Keycloak Admin REST API endpoints (299 tools), including sensitive write operations (like creating/deleting users, resetting passwords, and managing realms). Do not use your master realm super-admin credentials in a production environment.

When attaching this MCP server to your AI Assistants, please strictly follow the Principle of Least Privilege:

  1. Use Service Accounts (Client Credentials Flow): Avoid using the Password flow (KEYCLOAK_ADMIN_USERNAME / KEYCLOAK_ADMIN_PASSWORD). Instead, create a dedicated Keycloak Client with Service Accounts Enabled, and use the KEYCLOAK_CLIENT_ID and KEYCLOAK_CLIENT_SECRET.

  2. Limit Target Realms: Do not attach the server to the master realm unless specifically necessary. Point KEYCLOAK_ADMIN_REALM to the exact realm your AI assistant should manage.

  3. Grant Only Required Roles: Only assign the minimum necessary roles to your MCP Service Account.

    • If your LLM only needs to read data: Assign only view-users, view-clients, or view-realm.
    • If your LLM needs to manage users: Assign only manage-users.
    • Never assign admin or realm-admin roles to the AI unless you are fully aware of the risks.
  4. Always Verify SSL: Keep KEYCLOAK_VERIFY_SSL=true enabled in production to prevent Man-in-the-Middle (MITM) attacks. Setting it to false is only acceptable for local development.

Examples

Once connected, you can use natural language to interact with Keycloak:

  • "List all realms" → calls list_realms
  • "Create a user called john in the master realm" → calls create_user
  • "Show me all clients in the production realm" → calls list_clients
  • "What roles does user X have?" → calls get_user_role_mappings
  • "Add the admin role to the developers group" → calls add_group_realm_role_mappings

Project Structure

src/keycloak_mcp_server/
ā”œā”€ā”€ __init__.py          # Package entry point
ā”œā”€ā”€ __main__.py          # CLI entry point
ā”œā”€ā”€ config.py            # Environment-based configuration
ā”œā”€ā”€ client.py            # Async HTTP client with auto-auth
ā”œā”€ā”€ server.py            # MCP server setup and tool registration
└── endpoints/           # Endpoint definitions by category
    ā”œā”€ā”€ __init__.py      # Base classes (EndpointDef, Param)
    ā”œā”€ā”€ attack_detection.py
    ā”œā”€ā”€ authentication.py
    ā”œā”€ā”€ certificates.py
    ā”œā”€ā”€ client_initial_access.py
    ā”œā”€ā”€ client_registration_policy.py
    ā”œā”€ā”€ client_role_mappings.py
    ā”œā”€ā”€ client_scopes.py
    ā”œā”€ā”€ clients.py
    ā”œā”€ā”€ component.py
    ā”œā”€ā”€ groups.py
    ā”œā”€ā”€ identity_providers.py
    ā”œā”€ā”€ key.py
    ā”œā”€ā”€ organizations.py
    ā”œā”€ā”€ protocol_mappers.py
    ā”œā”€ā”€ realms.py
    ā”œā”€ā”€ roles.py
    ā”œā”€ā”€ roles_by_id.py
    ā”œā”€ā”€ scope_mappings.py
    └── users.py

License

MIT

Related Skills

View on GitHub
GitHub Stars3
CategoryDevelopment
Updated6mo ago
Forks1

Languages

Python

Trust signals

81/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

3 low
keycloak-mcp-server — MCP Server: Install & Safety Check | SkillAgent