Advanced Keycloak Mcp Server

by Octodet

379 downloads
Not rated
GitHub

About

Administer Keycloak by managing users, realms, roles, and other resources through an LLM interface.

Details

Author
Octodet
Downloads
379
Categories
Cloud Service, Security, AI, Infrastructure, Other

- Create users in specified realms with credentials and attributes.
- Delete users permanently from a realm.
- List all users in a realm with basic information.
- Display all available realms in the Keycloak instance.
- List all roles for a specific client within a realm.
- Add or remove client roles for a user in a single operation.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Advanced Keycloak Mcp Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

The README does not describe installation, configuration, or invocation steps. Once set up, the server exposes tools such as create-user, delete-user, list-users, list-realms, list-roles, and update-user-roles, which accept JSON parameters as shown in the documentation.

create-user

Create a new user in a specific realm

delete-user

Delete a user from a specific realm

list-realms

List all available realms

list-users

List users in a specific realm

list-roles

List all roles of a specific client in a specific realm

update-user-roles

Add and/or remove client roles for a user in a specific realm and client

reset-user-password

Reset or set a new password for a user in a specific realm

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "advanced keycloak mcp server": {
            "keycloak": {
                "command": "npx",
                "args": [
                    "-y",
                    "@octodet/keycloak-mcp"
                ],
                "env": {
                    "KEYCLOAK_URL": "http://localhost:8080",
                    "KEYCLOAK_ADMIN": "admin",
                    "KEYCLOAK_ADMIN_PASSWORD": "admin"
                }
            }
        }
    }
}

McpServers

{
    "keycloak": {
        "command": "npx",
        "args": [
            "-y",
            "@octodet/keycloak-mcp"
        ],
        "env": {
            "KEYCLOAK_URL": "http://localhost:8080",
            "KEYCLOAK_ADMIN": "admin",
            "KEYCLOAK_ADMIN_PASSWORD": "admin"
        }
    }
}

A powerful Model Context Protocol server for Keycloak administration, providing a comprehensive set of tools to manage users, realms, roles, and other Keycloak resources through LLM interfaces.

- User Management: Create, delete, and list users across realms
- Realm Administration: Comprehensive realm management capabilities
- Secure Integration: Authentication with admin credentials
- Easy Configuration: Simple setup with environment variables
- LLM Integration: Seamless use with Claude, ChatGPT, and other MCP-compatible AI assistants

The server is available as an NPM package:

# Direct usage with npx npx -y @octodet/keycloak-mcp # Or global installation npm install -g @octodet/keycloak-mcp
{ "mcp.servers": { "keycloak": { "command": "npx", "args": ["-y", "@octodet/keycloak-mcp"], "env": { "KEYCLOAK_URL": "http://localhost:8080", "KEYCLOAK_ADMIN": "admin", "KEYCLOAK_ADMIN_PASSWORD": "admin" } } } }

Configure in your Claude Desktop configuration file:

{ "mcpServers": { "keycloak": { "command": "npx", "args": ["-y", "@octodet/keycloak-mcp"], "env": { "KEYCLOAK_URL": "http://localhost:8080", "KEYCLOAK_ADMIN": "admin", "KEYCLOAK_ADMIN_PASSWORD": "admin" } } } }
{ "mcpServers": { "keycloak": { "command": "node", "args": ["path/to/build/index.js"], "env": { "KEYCLOAK_URL": "http://localhost:8080", "KEYCLOAK_ADMIN": "admin", "KEYCLOAK_ADMIN_PASSWORD": "admin" } } } }

The server provides a comprehensive set of MCP tools for Keycloak administration. Each tool is designed to perform specific administrative tasks across realms, users, and roles.

Creates a new user in a specified realm with comprehensive user attributes and optional credentials.

- realm(string): Target realm name
- username(string): Unique username for the new user
- email(string): Valid email address
- firstName(string): User's first name
- lastName(string): User's last name

- enabled(boolean): Enable/disable user account (default:true)
- emailVerified(boolean): Mark email as verified
- credentials(array): Array of credential objects for setting passwords

- type(string): Credential type (e.g., "password")
- value(string): The credential value
- temporary(boolean): Whether password must be changed on first login

{ "realm": "my-app-realm", "username": "john.doe", "email": "john.doe@company.com", "firstName": "John", "lastName": "Doe", "enabled": true, "emailVerified": true, "credentials": [ { "type": "password", "value": "TempPassword123!", "temporary": true } ] }

Response:Returns the created user ID and confirmation message.

Permanently removes a user from the specified realm. This action cannot be undone.

- realm(string): Target realm name
- userId(string): Unique identifier of the user to delete

{ "realm": "my-app-realm", "userId": "8f5c21e3-7c9d-4b5a-9f3e-8d4f6a2e7b1c" }

Response:Confirmation message of successful deletion.

⚠️ Warning:This operation is irreversible. Ensure you have the correct user ID before execution.

Retrieves a list of all users in the specified realm with their basic information.

{ "realm": "my-app-realm" }

Response:Returns a formatted list showing usernames and user IDs for all users in the realm.

Retrieves all available realms in the Keycloak instance.

Response:Returns a list of all realm names available in the Keycloak installation.

- Discovering available realms
- Validating realm names before other operations
- Administrative overview of the Keycloak setup

Lists all roles defined for a specific client within a realm. Useful for understanding available permissions and roles before assignment.

- realm(string): Target realm name
- clientId(string): Client ID or UUID of the target client

{ "realm": "my-app-realm", "clientId": "my-application" }
{ "realm": "my-app-realm", "clientId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }

Response:Returns a formatted list of all role names available for the specified client.

💡 Tip:You can use either the client's human-readable ID or its UUID identifier.

Manages client role assignments for a user. Allows both adding and removing roles in a single operation.

- realm(string): Target realm name
- userId(string): User's unique identifier
- clientId(string): Client ID or UUID

- rolesToAdd(array): List of role names to assign to the user
- rolesToRemove(array): List of role names to remove from the user

{ "realm": "my-app-realm", "userId": "8f5c21e3-7c9d-4b5a-9f3e-8d4f6a2e7b1c", "clientId": "my-application", "rolesToAdd": ["admin", "user-manager", "report-viewer"] }
{ "realm": "my-app-realm", "userId": "8f5c21e3-7c9d-4b5a-9f3e-8d4f6a2e7b1c", "clientId": "my-application", "rolesToRemove": ["temporary-access", "beta-tester"] }
{ "realm": "my-app-realm", "userId": "8f5c21e3-7c9d-4b5a-9f3e-8d4f6a2e7b1c", "clientId": "my-application", "rolesToAdd": ["senior-user"], "rolesToRemove": ["junior-user", "trainee"] }

Response:Detailed summary of roles added, removed, and any errors encountered.

- At least one ofrolesToAddorrolesToRemovemust be provided
- Non-existent roles are skipped with warnings
- The operation is atomic per role list (all or none for each operation type)
-

User IDs vs Usernames: Most operations require user IDs (UUIDs), not usernames. Uselist-usersto find the correct user ID.

Client Identification: TheclientIdparameter accepts both human-readable client IDs and UUID identifiers.

Realm Validation: Always verify realm names usinglist-realmsbefore performing operations.

Role Discovery: Uselist-rolesto discover available roles before attempting role assignments.

Error Handling: All tools provide detailed error messages for troubleshooting authentication, permission, or parameter issues.

# Clone the repository git clone <repository-url> # Install dependencies npm install # Start the development server with watch mode npm run watch

- Define the tool schema insrc/index.tsusing Zod
- Add the tool definition to theListToolsRequestSchemahandler
- Implement the tool handler in theCallToolRequestSchemaswitch statement
- Update this README to document the new tool

The MCP Inspector is a great tool for testing your MCP server:

npx -y @modelcontextprotocol/inspector npx -y @octodet/keycloak-mcp

For testing with a local Keycloak instance:

# Start Keycloak with Docker docker run -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:latest start-dev # In another terminal, run the MCP server npm run build node build/index.js

This project is published to NPM under@octodet/keycloak-mcp.

This project uses GitHub Actions for CI/CD to automatically test and publish to NPM when a new release is created.

- Node.js 18 or higher
- Running Keycloak instance

This project is licensed under the MIT License - see theLICENSEfile for details.

Octodet - Building intelligent tools for developers

AI traffic control plane (chaos governor): Redis prompt replay, compliant web ingest, SSO org ledger, Agent Shell. BYOK OpenAI-compatible ingress. Cursor optional; MCP is a compatibility client.

Growth marketing, SEO and GEO as agent tools: 41 tools for ranked growth moves, drafted deliverables, ship actions, and AI answer visibility across ChatGPT, Gemini, Perplexity and Google AI Overviews, hosted remote at https://afterlaunch.io/api/mcp with anonymous discovery and OAuth.

DuckDuckGo MCP Server — a lightweight, no-auth web search tool for AI agents.Provides structured search results (title, URL, snippet) via a simple MCP-compatible API, optimized for fast integration into LLM workflows.

Provides Google Web Search functionality using the Gemini API. Requires a Google API Key or OAuth credentials.

13-tool MCP server for AI agent authorization. Manage agents, grants, tokens, and audit logs from Claude Desktop, Cursor, or Windsurf. Plus @grantex/mcp-auth for adding OAuth

Humanizer PRO is an MCP server that transforms AI-generated text into natural, human-sounding content. It provides 4 tools: - humanize_text: Rewrite AI text to bypass detectors like GPTZero, Turnitin, Originality.ai, Copyleaks, and ZeroGPT. Three modes: Stealth (highest bypass rate), Academic (Turnitin-optimized), SEO (marketing content). - scan_ai_detection: Analyze text for AI patterns. Returns AI probability score, human-likeness percentage, and verdict. - check_word_balance: Check remaining word credits and subscription plan details. - get_subscription_plans: Browse plans - Free (500 words), Starter ($9.99/mo, 30K words), Creator ($14.99/mo, 100K words), Pro Annual ($119.88/yr, 100K words/mo). Authentication: OAuth 2.0. Works with ChatGPT, Claude, Cursor, and all MCP-compatible clients.

Self-hosted MCP gateway that connects Claude, ChatGPT, and other AI agents to 20+ enterprise tools (GitLab, Jira, Notion, Google Workspace, Slack, Grafana, …) with OAuth, audit logs, and zero data leaving your infrastructure.

Ask Claude if any AI provider is down — a hosted MCP server with real-time status, incident history, and 30-day uptime for 75+ AI services, no auth.

Task/project MCP server with OAuth for Claude, Cursor bridge, semantic search, staged write approval

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.