Keycloak Mcp Server
MCP server implementation for Keycloak user management. Enables AI-powered administration of Keycloak users and realms through the Model Context Protocol (MCP). Seamlessly integrates with Claude Desktop and other MCP clients for automated user operations.
Overview
What is Keycloak Model Context Protocol?
Keycloak Model Context Protocol (MCP) is an innovative server implementation designed for managing Keycloak users effectively. It leverages AI-powered administration to streamline user and realm management, making it easier for organizations to handle their identity and access management needs. The MCP facilitates seamless integration with various clients, including Claude Desktop, allowing for automated user operations and enhanced administrative capabilities.
Features of Keycloak Model Context Protocol
- AI-Powered Administration: Utilizes artificial intelligence to automate user management tasks, reducing manual effort and increasing efficiency.
- Seamless Integration: Works effortlessly with Claude Desktop and other MCP clients, enabling automated operations for user management.
- User and Realm Management: Simplifies the administration of users and realms within Keycloak, providing a user-friendly interface for administrators.
- Public Repository: The project is open-source and publicly available, allowing developers to contribute and enhance its functionality.
- Active Community: With a growing number of stars and forks, the MCP has an active community that supports its development and usage.
How to Use Keycloak Model Context Protocol
- Installation: Begin by cloning the repository from GitHub. You can use the command:
git clone https://github.com/ChristophEnglisch/keycloak-model-context-protocol.git
- Setup: Follow the installation instructions provided in the repository's README file to set up the server.
- Configuration: Configure the MCP to connect with your Keycloak instance. This may involve setting up API keys and adjusting settings to suit your environment.
- Integration: Integrate with clients like Claude Desktop to start automating user management tasks.
- Usage: Utilize the features of MCP to manage users and realms efficiently. Explore the documentation for detailed usage instructions and examples.
Frequently Asked Questions
Q1: What is the main purpose of Keycloak Model Context Protocol?
A1: The primary purpose of MCP is to enhance user management and realm administration in Keycloak through AI-powered automation.
Q2: Is Keycloak Model Context Protocol free to use?
A2: Yes, MCP is an open-source project available for free. You can contribute to its development or use it in your projects without any cost.
Q3: How can I contribute to the Keycloak Model Context Protocol?
A3: You can contribute by forking the repository, making improvements, and submitting a pull request. The community welcomes contributions that enhance the functionality and usability of MCP.
Q4: Can I integrate Keycloak Model Context Protocol with other applications?
A4: Yes, MCP is designed to integrate with various applications and clients, making it versatile for different use cases in user management.
Q5: Where can I find more information about Keycloak Model Context Protocol?
A5: Additional information, including documentation and usage examples, can be found in the project's GitHub repository.
Details
Keycloak MCP Server
A Model Context Protocol server for Keycloak administration, providing tools to manage users and realms.
Features
- Create new users in specific realms
- Delete users from realms
- List available realms
- List users in specific realms
Installation
Installing via Smithery
To install Keycloak for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install keycloak-model-context-protocol --client claude
Via NPM (Recommended)
The server is available as an NPM package:
### 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:
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:
{
"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
{
"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
create-user
Creates a new user in a specified realm.
Inputs:
realm
: The realm nameusername
: Username for the new useremail
: Email address for the userfirstName
: User's first namelastName
: User's last name
delete-user
Deletes a user from a specified realm.
Inputs:
realm
: The realm nameuserId
: The ID of the user to delete
list-realms
Lists all available realms.
list-users
Lists all users in a specified realm.
Inputs:
realm
: The realm name
Development
npm run watch
Testing
To test the server using MCP Inspector:
npx -y @modelcontextprotocol/inspector npx -y keycloak-model-context-protocol
Deployment
NPM Package
This project is automatically published to NPM via GitHub Actions when a new release is published on GitHub.
Setup Requirements for Deployment
- Create NPM account and get access token
- Add NPM_TOKEN secret to GitHub repository
- Go to repository Settings > Secrets
- Add new secret named
NPM_TOKEN
- Paste your NPM access token as the value
Prerequisites
- Node.js 18 or higher
- Running Keycloak instance
Server Config
{
"mcpServers": {
"mcp-server-circleci": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--circleci-public--mcp-server-circleci--mcp-server-circleci",
"node ./dist/index.js"
],
"env": {
"CIRCLECI_TOKEN": "circleci-token",
"CIRCLECI_BASE_URL": "circleci-base-url"
}
}
}
}