Skip to main content
Glama

Keycloak MCP Server

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

Related MCP server: User Management MCP Server

Installation

Installing via Smithery

To install Keycloak for Claude Desktop automatically via Smithery:

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

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

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

Available Tools

4 tools
create-userC

Create a new user in a specific realm

ParametersJSON Schema
NameRequiredDescriptionDefault
realmYes
usernameYes
emailYes
firstNameYes
lastNameYes

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Create' which implies a write/mutation operation, but doesn't mention permissions required, whether the operation is idempotent, what happens on duplicate entries, or any rate limits. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's appropriately sized and front-loaded with the core purpose, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 5 parameters, 0% schema coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain what happens after creation (e.g., returns user ID), error conditions, or behavioral nuances, leaving too many unknowns for effective tool use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 5 parameters with 0% description coverage, so the description must compensate. However, it only mentions 'realm' implicitly ('in a specific realm') and doesn't explain any parameters like email format requirements, username constraints, or the relationship between fields. This fails to add meaningful semantic context beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('new user in a specific realm'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'add-user-to-group' or 'list-users', which would require explicit comparison to achieve a score of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'add-user-to-group' or 'delete-user'. It mentions 'in a specific realm' which implies a context but doesn't specify prerequisites, exclusions, or when-not-to-use scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

delete-userC

Delete a user from a specific realm

ParametersJSON Schema
NameRequiredDescriptionDefault
realmYes
userIdYes

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool performs a 'delete' operation, implying it's destructive and non-read-only, which is helpful. However, it lacks critical details: whether deletion is permanent or reversible, what permissions are required, if there are rate limits, what happens to associated data, or what the response looks like. For a destructive tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the core action without unnecessary words. It's front-loaded with the verb 'Delete' and avoids redundancy. Every word earns its place, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a destructive operation with 2 parameters), lack of annotations, 0% schema description coverage, and no output schema, the description is incomplete. It doesn't address critical aspects like error conditions, return values, side effects, or security implications. The agent is left with significant gaps in understanding how to use this tool safely and effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so parameters 'realm' and 'userId' are undocumented in the schema. The description adds minimal value by implying 'realm' specifies where the user exists and 'userId' identifies the user, but doesn't explain what these parameters represent (e.g., realm as an organizational boundary, userId as a unique identifier), their formats, or examples. It fails to compensate for the schema's lack of documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete') and target resource ('a user from a specific realm'), making the purpose immediately understandable. It distinguishes this tool from sibling tools like 'create-user' or 'list-users' by specifying a destructive operation. However, it doesn't explicitly mention what 'delete' entails (e.g., permanent removal vs. deactivation), which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., user must exist), consequences of deletion, or relationships with sibling tools like 'create-user' or 'list-users'. The agent receives no help in deciding when this tool is appropriate versus other user management operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list-realmsB

List all available realms

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description should provide behavioral details. It only mentions listing all realms but lacks info on read-only behavior, pagination, authentication, or response format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single sentence front-loading the purpose. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with no parameters or output schema, the description is minimally adequate but lacks details on return structure or any potential filters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no parameters and schema description coverage is 100%, so the description adds no param semantics. Baseline of 3 is appropriate for a no-parameter tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List all available realms' clearly states the action (list) and resource (realms), with 'available' implying no filtering. It is distinct from sibling tools like create-user or list-users.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool or when alternatives might be better. The description gives no context for exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list-usersC

List users in a specific realm

ParametersJSON Schema
NameRequiredDescriptionDefault
realmYes

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states 'list users' which implies a read-only operation, but does not disclose behavioral traits such as pagination, sorting, filtering beyond realm, authentication requirements, rate limits, or what the output format looks like. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero waste. It is appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, 0% schema coverage, no output schema, and a simple parameter structure, the description is incomplete. It lacks details on behavior, output, parameter meaning, and usage context, making it inadequate for an agent to reliably invoke the tool without additional assumptions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It mentions 'in a specific realm', which hints at the 'realm' parameter's purpose, but does not explain what a realm is, its format, valid values, or how it affects the listing. With 1 undocumented parameter, the description adds minimal semantic value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'list' and the resource 'users in a specific realm', which is specific and unambiguous. However, it does not distinguish this tool from potential siblings like 'list-groups' or 'list-clients' beyond the resource name, as all share the same 'list' pattern without explicit differentiation in the description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'in a specific realm' but does not specify prerequisites, exclusions, or compare it to other user-related tools like 'create-user' or 'list-client-roles', leaving usage context implied at best.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv1.0.0
    • Addedcreate-user
    • Addeddelete-user
    • Addedlist-realms
    • Addedlist-users

TDQS

B3.2/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: create-user and delete-user handle user lifecycle actions, list-realms lists realms, and list-users lists users within a realm. The descriptions make it unambiguous which tool to use for each operation.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with hyphen separation (e.g., create-user, delete-user, list-realms, list-users). This uniformity makes the tool set predictable and easy to understand.

Tool Count3/5

With only 4 tools, the set feels thin for a Keycloak server, which typically manages realms, users, roles, clients, and groups. While the tools cover basic user and realm operations, the scope is limited compared to the domain's complexity.

Completeness2/5

There are significant gaps in the tool surface for Keycloak management. Missing operations include updating users, managing roles, handling clients, and performing authentication flows. This incomplete coverage will likely cause agent failures when trying to perform common administrative tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that enables management of Keycloak users and realms through a standardized interface, providing tools for user creation, deletion, role assignment, and group management.
    9
    65 npm
    13
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    An MCP server for Keycloak Admin REST API, enabling user, group, event, and security management through service account authentication.
    32
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server that provides a natural language interface for managing Keycloak identity and access management through its REST API.
    MIT

Appeared in Searches