# keycloak-model-context-protocol

> MCP Server

This repository provides a Model Context Protocol server for Keycloak, enabling user and realm management. It offers tools to create, delete, and list users, along with listing available realms for Keycloak administration.

## Overview

- **Category:** System Tools
- **Language:** TypeScript
- **Stars:** 46
- **Forks:** 4
- **Owner:** ChristophEnglisch
- **GitHub:** https://github.com/ChristophEnglisch/keycloak-model-context-protocol
- **Created:** 2025-01-06T13:24:02+00:00
- **Updated:** 2025-03-23T14:45:15+00:00
- **Source:** https://model-context-protocol.com/servers/keycloak-user-realm-management-mcp-server

## Setup

## Setup

### Installing via Smithery

To install Keycloak for Claude Desktop automatically via [Smithery](https://smithery.ai/server/keycloak-model-context-protocol):

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

### Via NPM (Recommended)

The server is available as an NPM package:
```bash
# Direct usage with npx
npx -y keycloak-model-context-protocol

# Or global installation
npm install -g keycloak-model-context-protocol
```

### Local Development Setup

If you want to develop or modify the server:

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

## Configuration

### Using NPM Package (Recommended)
Configure the server in your Claude Desktop configuration file:

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

### For Local Development
```json
{
  "mcpServers": {
    "keycloak": {
      "command": "node",
      "args": ["path/to/dist/index.js"],
      "env": {
        "KEYCLOAK_URL": "http://localhost:8080",
        "KEYCLOAK_ADMIN": "admin",
        "KEYCLOAK_ADMIN_PASSWORD": "admin"
      }
    }
  }
}
```

## Tools

## Available 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.)
