Back to catalog

Keycloak MCP Server

MCP server for Keycloak administration, providing tools for managing users and realms through natural language interaction.

MCP server for Keycloak administration, providing tools for managing users and realms through natural language interaction.

Installation

Smithery

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

NPX

npx -y keycloak-model-context-protocol

NPM Global

npm install -g keycloak-model-context-protocol

From Source

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

Configuration

Claude Desktop (NPM Package)

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

Claude Desktop (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

Tool Description
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

Features

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

Environment Variables

Required

  • KEYCLOAK_URL - URL of the Keycloak instance
  • KEYCLOAK_ADMIN - Administrator username for Keycloak authentication
  • KEYCLOAK_ADMIN_PASSWORD - Administrator password for Keycloak authentication

Notes

Requires Node.js 18 or higher and a running Keycloak instance. The project is automatically published to NPM via GitHub Actions. For testing, use MCP Inspector with the command: npx -y @modelcontextprotocol/inspector npx -y keycloak-model-context-protocol

Comments (0)

Sign In Sign in to leave a comment.