Skip to main content
Glama
Keycloak MCP Server (TypeScript)

Keycloak MCP Server (TypeScript)

by ravthiru

Keycloak MCP Server (TypeScript)

A Model Context Protocol (MCP) server that enables AI assistants to interact with and manage a Keycloak instance using natural language.

Built on the official @modelcontextprotocol/server SDK and @keycloak/keycloak-admin-client.

✨ Features

  • User Management: Search, list, and create users in your target realm.

  • Least-Privilege Security: Authenticates via OAuth2 client_credentials using a dedicated Keycloak service account rather than master admin credentials.

  • Type-Safe Validation: Strict input validation powered by zod.

Related MCP server: PingOne Advanced Identity Cloud MCP Server

πŸ“‹ Prerequisites

  • Node.js v20 or higher

  • A running Keycloak server

  • A dedicated Keycloak Service Account Client with realm-management roles (e.g., view-users, manage-users)

πŸš€ Installation

  1. Clone the repository:

    git clone https://github.com
    cd keycloak-mcp
  2. Install dependencies and build:

    npm install
    npm run build

βš™οΈ Configuration

1. Keycloak Client Setup

  1. Open the Keycloak Admin Console and select your target realm.

  2. Navigate to Clients > Create client (e.g., mcp-admin-bot).

  3. Enable Client authentication and Service accounts roles, then save.

  4. Copy the secret from the Credentials tab.

  5. Assign the required roles under the Service accounts roles tab (Filter by clients -> realm-management).

2. MCP Client Configuration

Add the server to your MCP client configuration (e.g., claude_desktop_config.json or .cursor/mcp.json):

{
  "mcpServers": {
    "keycloak": {
      "command": "node",
      "args": ["/absolute/path/to/keycloak-mcp/build/index.js"],
      "env": {
        "KEYCLOAK_URL": "http://localhost:8080",
        "KEYCLOAK_REALM": "your-realm",
        "KEYCLOAK_CLIENT_ID": "mcp-admin-bot",
        "KEYCLOAK_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

πŸ› οΈ Available Tools

Tool Name

Description

list-users

Search and list users by username, email, or name.

create-user

Create a new user in the configured Keycloak realm.

πŸ“„ License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Scalekit is the MCP gateway for AI agents. It connects agents to 500+ connectors and 20,000+ actions through one endpoint, works with any agent framework, and makes every call as the user, with OAuth, credentials, and permissions handled. Cloud or self-hosted
      35
      5
      Apache 2.0
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI assistants to interact with PingOne Advanced Identity Cloud environments through natural language, supporting user management, authentication theme customization, log analysis, and identity data queries with secure OAuth 2.0 authentication.
      57
      45 npm
      2
      Apache 2.0
    • A
      license
      C
      quality
      D
      maintenance
      Enables management of Keycloak identity and access management through the Keycloak Admin REST API, providing 299 tools for operations like user management, client configuration, and realm administration via natural language.
      100
      3
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Exposes Keycloak admin operations as tools via the Model Context Protocol, allowing management of users, clients, groups, roles, and more through natural language.
      ISC