keycloak
MCP server that integrates with Keycloak, allowing you to manage Keycloak users and realms through a standardized protocol. It uses the official Keycloak Admin Client to interact with Keycloak's API.
claude mcp add --transport stdio haithamoumerzoug-keycloak-mcp npx -y keycloak-mcp \ --env KEYCLOAK_URL="http://localhost:8080" \ --env KEYCLOAK_ADMIN="admin" \ --env KEYCLOAK_ADMIN_PASSWORD="admin"
How to use
This MCP server provides a standardized interface to manage Keycloak. It exposes a set of MCP tools that map to common Keycloak administrative actions, such as creating and deleting users, listing realms, clients, groups, and roles, and assigning client roles or adding users to groups. By running the server via the included MCP package, you can invoke these tools through the MCP protocol in your workspace, allowing you to orchestrate Keycloak administration from other MCP-enabled components or automation pipelines. The available tools are documented in the README and include create-user, delete-user, list-realms, list-users, list-clients, list-groups, list-client-roles, assign-client-role-to-user, and add-user-to-group. Each tool expects inputs like realm, userId, clientUniqueId, roleName, and other identifiers to perform the corresponding action against your Keycloak instance.
How to install
Prerequisites:
- Node.js (LTS version recommended)
- npm
- A running Keycloak instance
Install and run the MCP server using npm/npx:
- Install or run via npx (no local install required):
npx -y keycloak-mcp --keycloak-url <Keycloak Instance URL> --keycloak-admin <Admin Username> --keycloak-admin-password <Admin Password>
- Optional: install globally and run the CLI directly:
npm install -g keycloak-mcp@latest
keycloak-mcp --keycloak-url <Keycloak Instance URL> --keycloak-admin <Admin Username> --keycloak-admin-password <Admin Password>
- Alternatively, if you prefer to run from a local project (as shown in this repo's development flow):
npm install
npm run dev
Configure environment variables as needed for your environment, or pass them as command-line arguments if supported by your setup.
Additional notes
Environment variables:
- KEYCLOAK_URL: Base URL of your Keycloak instance
- KEYCLOAK_ADMIN: Admin username
- KEYCLOAK_ADMIN_PASSWORD: Admin password Common issues:
- Ensure Keycloak Admin API access is enabled and the admin user has sufficient privileges
- If using a self-signed certificate, you may need to configure TLS/SSL verifier settings in your environment
- When running via npx, ensure network access to npm registry to fetch keycloak-mcp
- If the MCP server cannot reach Keycloak, verify network connectivity and Keycloak URL/port Configuration tips:
- Keep KEYCLOAK_URL in sync with your Keycloak deployment (including http/https and port)
- Store credentials securely; consider using a secret manager instead of hardcoding in env files
- Use the provided mcpServers configuration to standardize how this server is launched within your MCP ecosystem
Related MCP Servers
jadx-ai
Plugin for JADX to integrate MCP server
mcp
🤖 Taskade MCP · Official MCP server and OpenAPI to MCP codegen. Build AI agent tools from any OpenAPI API and connect to Claude, Cursor, and more.
sandbox
A Model Context Protocol (MCP) server that enables LLMs to run ANY code safely in isolated Docker containers.
awesome s
A curated list of excellent Model Context Protocol (MCP) servers.
Convert-Markdown-PDF
Markdown To PDF Conversion MCP
vector_mcp
A server implementation for the Model Context Protocol (MCP) in Ruby.