keycloak-mcp

HaithamOumerzoug/keycloak-mcp

3.3

If you are the rightful owner of keycloak-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

Keycloak MCP is a Model Context Protocol server implementation for Keycloak, providing a standardized interface for managing Keycloak users and realms.

Keycloak MCP is a robust server implementation designed to integrate seamlessly with Keycloak, a popular open-source identity and access management solution. By leveraging the Model Context Protocol (MCP), this server offers a standardized interface for managing users and realms within Keycloak. It utilizes the official Keycloak Admin Client to interact with Keycloak's API, ensuring reliable and efficient operations. This project is particularly beneficial for developers and administrators who require a consistent and streamlined method to manage identity and access control across various applications. With Keycloak MCP, users can perform a range of operations such as creating and deleting users, listing realms, and managing client roles, all through a unified protocol. The server is available as an NPM package, making it easy to install and configure within different development environments. Additionally, it supports integration with platforms like Claude Desktop and Cursor IDE, further enhancing its versatility and usability.

Features

  • Standardized interface for managing Keycloak users and realms
  • Integration with Keycloak's API using the official Admin Client
  • Support for various operations such as user creation, deletion, and role management
  • Available as an NPM package for easy installation
  • Compatible with platforms like Claude Desktop and Cursor IDE

Usages

usage with Claude Desktop

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

usage with Cursor IDE

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

usage with Cline

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

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"
      }
    }
  }
}

Tools

  1. create-user

    Creates a new user in a specified realm.

  2. delete-user

    Deletes a user from a specified realm.

  3. list-realms

    Lists all available realms.

  4. list-users

    Lists all users in a specified realm.

  5. list-clients

    Lists all clients in a specified realm.

  6. list-groups

    Lists all groups in a specified realm.

  7. list-client-roles

    Lists all roles for a specific client in a realm.

  8. assign-client-role-to-user

    Assigns a client role to a specific user.

  9. add-user-to-group

    Adds a user to a specific group.