Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

keycloak-model-context-protocol

MCP.Pizza Chef: ChristophEnglisch

The keycloak-model-context-protocol is an MCP server implementation designed to facilitate AI-powered administration of Keycloak users and realms. It provides structured tools to create, delete, and list users within specific realms, as well as to enumerate available realms. This server integrates seamlessly with MCP clients such as Claude Desktop, enabling automated and intelligent user management workflows. Installation is straightforward via Smithery or NPM, supporting both direct usage and local development. This server empowers developers and administrators to leverage LLMs for efficient Keycloak user and realm operations within the MCP ecosystem.

Use This MCP server To

Automate Keycloak user creation and deletion List and manage Keycloak realms programmatically Integrate Keycloak user management with AI workflows Enable AI-driven administration via MCP clients Streamline user operations in Keycloak with LLMs

README

Keycloak MCP Server

smithery badge

A Model Context Protocol server for Keycloak administration, providing tools to manage users and realms.

Features

  • Create new users in specific realms
  • Delete users from realms
  • List available realms
  • List users in specific realms

Installation

Installing via Smithery

To install Keycloak for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install keycloak-model-context-protocol --client claude

Via NPM (Recommended)

The server is available as an NPM package:

# Direct usage with npx
npx -y keycloak-model-context-protocol

# Or global installation
npm install -g keycloak-model-context-protocol

Local Development Setup

If you want to develop or modify the server:

git clone <repository-url>
cd keycloak-model-context-protocol
npm install
npm run build

Configuration

Using NPM Package (Recommended)

Configure the server in your Claude Desktop configuration file:

{
  "mcpServers": {
    "keycloak": {
      "command": "npx",
      "args": ["-y", "keycloak-model-context-protocol"],
      "env": {
        "KEYCLOAK_URL": "http://localhost:8080",
        "KEYCLOAK_ADMIN": "admin",
        "KEYCLOAK_ADMIN_PASSWORD": "admin"
      }
    }
  }
}

For Local Development

{
  "mcpServers": {
    "keycloak": {
      "command": "node",
      "args": ["path/to/dist/index.js"],
      "env": {
        "KEYCLOAK_URL": "http://localhost:8080",
        "KEYCLOAK_ADMIN": "admin",
        "KEYCLOAK_ADMIN_PASSWORD": "admin"
      }
    }
  }
}

Available Tools

create-user

Creates a new user in a specified realm.

Inputs:

  • realm: The realm name
  • username: Username for the new user
  • email: Email address for the user
  • firstName: User's first name
  • lastName: User's last name

delete-user

Deletes a user from a specified realm.

Inputs:

  • realm: The realm name
  • userId: The ID of the user to delete

list-realms

Lists all available realms.

list-users

Lists all users in a specified realm.

Inputs:

  • realm: The realm name

Development

npm run watch

Testing

To test the server using MCP Inspector:

npx -y @modelcontextprotocol/inspector npx -y keycloak-model-context-protocol

Deployment

NPM Package

This project is automatically published to NPM via GitHub Actions when a new release is published on GitHub.

Setup Requirements for Deployment
  1. Create NPM account and get access token
  2. Add NPM_TOKEN secret to GitHub repository
    • Go to repository Settings > Secrets
    • Add new secret named NPM_TOKEN
    • Paste your NPM access token as the value

Prerequisites

  • Node.js 18 or higher
  • Running Keycloak instance

keycloak-model-context-protocol FAQ

How do I install the keycloak-model-context-protocol server?
You can install it via Smithery using 'npx -y @smithery/cli install keycloak-model-context-protocol --client claude' or via NPM with 'npm install -g keycloak-model-context-protocol'.
Can I use this MCP server with clients other than Claude Desktop?
Yes, the server is designed to integrate with any MCP-compliant client, enabling flexible AI-powered Keycloak management.
What Keycloak operations does this MCP server support?
It supports creating and deleting users, listing users in realms, and listing available realms.
Is local development supported for this MCP server?
Yes, you can clone the repository and set up a local development environment to modify or extend the server.
Does this server support secure and scoped access to Keycloak data?
Yes, it follows MCP principles to ensure secure, scoped, and observable interactions with Keycloak.
Can this MCP server work with multiple LLM providers?
Yes, it is provider-agnostic and works with LLMs like OpenAI, Claude, and Gemini through MCP clients.
How does this server enhance Keycloak administration?
By enabling AI-driven automation and real-time interaction with Keycloak user and realm data, simplifying complex management tasks.