MCP Connector Featured

Manage Keycloak Users and Realms via Natural Language

Keycloak MCP Server lets AI assistants create and delete users and list realms and users via Keycloak's admin API.

Works with keycloak

91
Spark score
out of 100
Status Verified Official
Updated Feb 2025
Version 0.0.2
Models
universal

Add to Favorites

Why it matters

Streamline Keycloak administration by enabling natural language commands for user and realm management. Automate tasks like user creation, deletion, and listing, simplifying access control and user lifecycle management.

Outcomes

What it gets done

01

Create new users with specified details.

02

Delete users by their unique identifier.

03

List all available realms.

04

View users within a specific realm.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-keycloak-mcp | bash

Capabilities

Tools your agent gets

create-user

Creates a new user in the specified realm with username, email, first name, and last name

delete-user

Deletes a user from the specified realm by their ID

list-realms

Displays a list of all available realms in the Keycloak instance

list-users

Displays a list of all users in the specified realm

Overview

Keycloak MCP Server

Keycloak MCP Server gives an AI assistant tools to create and delete users and list realms and users, using Keycloak admin credentials. Use it when an AI assistant needs to create, delete, or list Keycloak users and realms without the admin console.

What it does

Keycloak MCP Server is an MCP server for Keycloak administration, giving an AI assistant tools to manage users and realms directly: creating and deleting users, and listing realms and the users within them.

When to use - and when NOT to

Use it when you want an AI assistant to handle basic Keycloak user administration conversationally: creating a new user in a realm, removing one, or listing realms and their users. It requires a running Keycloak instance and admin credentials, KEYCLOAK_URL, KEYCLOAK_ADMIN, and KEYCLOAK_ADMIN_PASSWORD, configured as environment variables, so it is not usable without an existing Keycloak deployment. Its tool set is limited to user and realm listing, creation, and deletion; it is not a full Keycloak admin console replacement, so more advanced realm configuration still needs the Keycloak admin UI or API directly.

Capabilities

  • create-user: create a new user in a specified realm, with realm, username, email, firstName, and lastName inputs
  • delete-user: delete a user from a specified realm, given realm and userId
  • list-realms: list all available realms
  • list-users: list all users in a specified realm

How to install

Via Smithery, for Claude Desktop:

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

Or via npm directly:

npx -y keycloak-model-context-protocol

Configure it in Claude Desktop with your Keycloak admin credentials:

{
  "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, clone the repository, run npm install and npm run build, then point the command at the built dist/index.js instead of npx. Requires Node.js 18+ and a running Keycloak instance.

To test the server directly, run it through the MCP Inspector:

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

Who it's for

Administrators and developers who want an AI assistant to handle routine Keycloak user management, creating, deleting, and listing users across realms, without opening the Keycloak admin console. The package is published to npm automatically via GitHub Actions whenever a new release goes out on GitHub, so the npx and npm install paths always track the latest tagged release.

Source 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

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.