K

Keycloak Model Context Protocol

by ChristophEnglisch · io.github.ChristophEnglisch/keycloak-model-context-protocol

A Model Context Protocol server that provides tools to manage Keycloak users and realms, allowing you to create and delete users, list available realms, and view users in specific realms.

npm Local · stdio GlamaOfficial MCP Registry High confidence

Install

Add to ~/Library/Application Support/Claude/claude_desktop_config.json

Windows / Linux path
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "io-github-christophenglisch-keycloak-model-context-protocol": {
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<VALUE>",
        "KEYCLOAK_AUTH_REALM": "master",
        "KEYCLOAK_CLIENT_ID": "<VALUE>",
        "KEYCLOAK_CLIENT_SECRET": "<YOUR_VALUE>",
        "KEYCLOAK_USERNAME": "<VALUE>",
        "KEYCLOAK_PASSWORD": "<YOUR_VALUE>",
        "KEYCLOAK_GRANT_TYPE": "auto",
        "KEYCLOAK_MCP_READ_ONLY": "false",
        "KEYCLOAK_MCP_REALMS": "all",
        "KEYCLOAK_MCP_ALLOW_MASTER_WRITE": "false",
        "KEYCLOAK_MCP_TOOLSETS": "core,groups,roles",
        "KEYCLOAK_MCP_REQUIRE_CONFIRMATION": "true",
        "KEYCLOAK_MCP_TIMEOUT_MS": "30000",
        "KEYCLOAK_MCP_LOG_LEVEL": "info",
        "KEYCLOAK_ADMIN": "<VALUE>",
        "KEYCLOAK_ADMIN_PASSWORD": "<VALUE>"
      }
    }
  }
}

Restart Claude Desktop to activate the new server.

Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)

Windows / Linux path
Windows: .cursor\mcp.json (project) or %USERPROFILE%\.cursor\mcp.json (global)
Linux: .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
{
  "mcpServers": {
    "io-github-christophenglisch-keycloak-model-context-protocol": {
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<VALUE>",
        "KEYCLOAK_AUTH_REALM": "master",
        "KEYCLOAK_CLIENT_ID": "<VALUE>",
        "KEYCLOAK_CLIENT_SECRET": "<YOUR_VALUE>",
        "KEYCLOAK_USERNAME": "<VALUE>",
        "KEYCLOAK_PASSWORD": "<YOUR_VALUE>",
        "KEYCLOAK_GRANT_TYPE": "auto",
        "KEYCLOAK_MCP_READ_ONLY": "false",
        "KEYCLOAK_MCP_REALMS": "all",
        "KEYCLOAK_MCP_ALLOW_MASTER_WRITE": "false",
        "KEYCLOAK_MCP_TOOLSETS": "core,groups,roles",
        "KEYCLOAK_MCP_REQUIRE_CONFIRMATION": "true",
        "KEYCLOAK_MCP_TIMEOUT_MS": "30000",
        "KEYCLOAK_MCP_LOG_LEVEL": "info",
        "KEYCLOAK_ADMIN": "<VALUE>",
        "KEYCLOAK_ADMIN_PASSWORD": "<VALUE>"
      }
    }
  }
}

Cursor usually picks up config changes automatically; if the server does not appear, reload the window.

Add to .mcp.json (project) or ~/.claude.json (global)

Windows / Linux path
Windows: .mcp.json (project) or %USERPROFILE%\.claude.json (global)
Linux: .mcp.json (project) or ~/.claude.json (global)
{
  "mcpServers": {
    "io-github-christophenglisch-keycloak-model-context-protocol": {
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<VALUE>",
        "KEYCLOAK_AUTH_REALM": "master",
        "KEYCLOAK_CLIENT_ID": "<VALUE>",
        "KEYCLOAK_CLIENT_SECRET": "<YOUR_VALUE>",
        "KEYCLOAK_USERNAME": "<VALUE>",
        "KEYCLOAK_PASSWORD": "<YOUR_VALUE>",
        "KEYCLOAK_GRANT_TYPE": "auto",
        "KEYCLOAK_MCP_READ_ONLY": "false",
        "KEYCLOAK_MCP_REALMS": "all",
        "KEYCLOAK_MCP_ALLOW_MASTER_WRITE": "false",
        "KEYCLOAK_MCP_TOOLSETS": "core,groups,roles",
        "KEYCLOAK_MCP_REQUIRE_CONFIRMATION": "true",
        "KEYCLOAK_MCP_TIMEOUT_MS": "30000",
        "KEYCLOAK_MCP_LOG_LEVEL": "info",
        "KEYCLOAK_ADMIN": "<VALUE>",
        "KEYCLOAK_ADMIN_PASSWORD": "<VALUE>"
      }
    }
  }
}

The server will be available in the next Claude Code session.

Add to .vscode/mcp.json

Windows / Linux path
Windows: .vscode\mcp.json
Linux: .vscode/mcp.json
{
  "servers": {
    "io-github-christophenglisch-keycloak-model-context-protocol": {
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<VALUE>",
        "KEYCLOAK_AUTH_REALM": "master",
        "KEYCLOAK_CLIENT_ID": "<VALUE>",
        "KEYCLOAK_CLIENT_SECRET": "<YOUR_VALUE>",
        "KEYCLOAK_USERNAME": "<VALUE>",
        "KEYCLOAK_PASSWORD": "<YOUR_VALUE>",
        "KEYCLOAK_GRANT_TYPE": "auto",
        "KEYCLOAK_MCP_READ_ONLY": "false",
        "KEYCLOAK_MCP_REALMS": "all",
        "KEYCLOAK_MCP_ALLOW_MASTER_WRITE": "false",
        "KEYCLOAK_MCP_TOOLSETS": "core,groups,roles",
        "KEYCLOAK_MCP_REQUIRE_CONFIRMATION": "true",
        "KEYCLOAK_MCP_TIMEOUT_MS": "30000",
        "KEYCLOAK_MCP_LOG_LEVEL": "info",
        "KEYCLOAK_ADMIN": "<VALUE>",
        "KEYCLOAK_ADMIN_PASSWORD": "<VALUE>"
      }
    }
  }
}

Reload the VS Code window to activate.

Add to ~/.codeium/windsurf/mcp_config.json

Windows / Linux path
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Linux: ~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "io-github-christophenglisch-keycloak-model-context-protocol": {
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<VALUE>",
        "KEYCLOAK_AUTH_REALM": "master",
        "KEYCLOAK_CLIENT_ID": "<VALUE>",
        "KEYCLOAK_CLIENT_SECRET": "<YOUR_VALUE>",
        "KEYCLOAK_USERNAME": "<VALUE>",
        "KEYCLOAK_PASSWORD": "<YOUR_VALUE>",
        "KEYCLOAK_GRANT_TYPE": "auto",
        "KEYCLOAK_MCP_READ_ONLY": "false",
        "KEYCLOAK_MCP_REALMS": "all",
        "KEYCLOAK_MCP_ALLOW_MASTER_WRITE": "false",
        "KEYCLOAK_MCP_TOOLSETS": "core,groups,roles",
        "KEYCLOAK_MCP_REQUIRE_CONFIRMATION": "true",
        "KEYCLOAK_MCP_TIMEOUT_MS": "30000",
        "KEYCLOAK_MCP_LOG_LEVEL": "info",
        "KEYCLOAK_ADMIN": "<VALUE>",
        "KEYCLOAK_ADMIN_PASSWORD": "<VALUE>"
      }
    }
  }
}

Restart Windsurf (or refresh its MCP servers panel) to activate the new server.

Windsurf Next uses ~/.codeium/windsurf-next/mcp_config.json. Devin Desktop (the Windsurf rebrand) uses ~/.config/devin/mcp_config.json and imports the Windsurf file.

Add to ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Windows / Linux path
Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
  "mcpServers": {
    "io-github-christophenglisch-keycloak-model-context-protocol": {
      "command": "npx",
      "args": [
        "-y",
        "keycloak-model-context-protocol"
      ],
      "env": {
        "KEYCLOAK_URL": "<VALUE>",
        "KEYCLOAK_AUTH_REALM": "master",
        "KEYCLOAK_CLIENT_ID": "<VALUE>",
        "KEYCLOAK_CLIENT_SECRET": "<YOUR_VALUE>",
        "KEYCLOAK_USERNAME": "<VALUE>",
        "KEYCLOAK_PASSWORD": "<YOUR_VALUE>",
        "KEYCLOAK_GRANT_TYPE": "auto",
        "KEYCLOAK_MCP_READ_ONLY": "false",
        "KEYCLOAK_MCP_REALMS": "all",
        "KEYCLOAK_MCP_ALLOW_MASTER_WRITE": "false",
        "KEYCLOAK_MCP_TOOLSETS": "core,groups,roles",
        "KEYCLOAK_MCP_REQUIRE_CONFIRMATION": "true",
        "KEYCLOAK_MCP_TIMEOUT_MS": "30000",
        "KEYCLOAK_MCP_LOG_LEVEL": "info",
        "KEYCLOAK_ADMIN": "<VALUE>",
        "KEYCLOAK_ADMIN_PASSWORD": "<VALUE>"
      }
    }
  }
}

Cline reloads cline_mcp_settings.json automatically; if the server does not appear, reload the VS Code window.

Open it from Cline's MCP Servers panel → Configure. Roo Code uses a different file and format.

Configuration

Environment variables this server reads. Secrets stay on your machine.

NameRequiredDescription
KEYCLOAK_URL Yes Base URL of the Keycloak server
KEYCLOAK_AUTH_REALM No Realm where the login account or client lives Default: master
KEYCLOAK_CLIENT_ID No Client ID for client_credentials login (recommended)
KEYCLOAK_CLIENT_SECRET secret No Client secret for client_credentials login (recommended)
KEYCLOAK_USERNAME No Username for password grant login
KEYCLOAK_PASSWORD secret No Password for password grant login
KEYCLOAK_GRANT_TYPE No Either client_credentials or password; detected from what you set Default: auto
KEYCLOAK_MCP_READ_ONLY No Register read-only tools only Default: false
KEYCLOAK_MCP_REALMS No Comma-separated allowlist of target realms Default: all
KEYCLOAK_MCP_ALLOW_MASTER_WRITE No Allow write tools in the master realm Default: false
KEYCLOAK_MCP_TOOLSETS No Enabled toolsets, or all Default: core,groups,roles
KEYCLOAK_MCP_REQUIRE_CONFIRMATION No Destructive and sensitive tools need confirm: true Default: true
KEYCLOAK_MCP_TIMEOUT_MS No HTTP timeout for Keycloak requests Default: 30000
KEYCLOAK_MCP_LOG_LEVEL No debug, info, warn or error (stderr) Default: info
KEYCLOAK_ADMIN No Deprecated alias still supported for password grant login
KEYCLOAK_ADMIN_PASSWORD No Deprecated alias still supported for password grant login

Similar servers