# Connect Keycloak to Your AI Agent (Universal MCP)

> Use your AI to audit security, manage employees, and monitor systems in Keycloak — and much more.

## Quick Connect (CLI / MCP)
- Claude Code: `claude mcp add --transport http keycloak https://api.universalmcp.app/mcp/keycloak`
- Remote MCP URL (ChatGPT, Claude, Cursor, VS Code): `https://api.universalmcp.app/mcp/keycloak` (unified: `https://api.universalmcp.app/mcp`)
- Actions & Discovery: `POST https://universalmcp.app/mcp/directory` (`get_software_actions({ slug: "keycloak", query })` & `search_software`); configs: https://universalmcp.app/install.md

## Key Facts
- Software: Keycloak | Category: DevOps & IT/Security (Keycloak) | Auth: Encrypted API credentials or guided self-hosted setup | Deployment: self-hosted
- Pricing: 100% Free (unlimited users, unlimited software, zero task metering)
- Permissions & Security: Per-person, per-area Off/Read/Write across Realm configuration, Audit event logs, Credentials; 1-click View Only lock; stateless pass-through; zero stored business records
- Connect: https://app.universalmcp.app/connect?system=keycloak | Guide: https://universalmcp.app/mcp/keycloak
- Built by: Alex Myers (Legal entity: Lancaster Agentic LLC; support@lancasteragentic.com)

## Supported Actions (75 actions: 30 Read, 45 Write)
Perform over 70 actions across identity brokering & federation, clients & client scopes, roles & permissions, sessions & security events, realms & config backup, groups & defaults, and users & profiles. Save hours of work each week by utilizing AI rather than using a traditional app interface.
- **Identity Brokering & Federation (11):** Check LDAP Connection (read), Get Identity Provider (read), List Identity Providers (read), List User Storage Providers (read), Create Identity Provider (write), Create Linked Account (write), Create Social Login Provider (write), Delete Imported Federated Users (write), Schedule User Federation Sync (write), Update Identity Provider (write), Upload Identity Provider Config (write)
- **Clients & Client Scopes (10):** Get Client Details (read), List Client Scopes (read), List Clients (read), Assign Default Client Scope (write), Create Client Application (write), Create Client Scope (write), Create Initial Access Token (write), Delete Client Application (write), Update Client Application (write), Update Client Scope (write)
- **Roles & Permissions (9):** Get Role Details (read), List Composite Role Children (read), List Roles (read), Assign Composite Child Roles (write), Assign Role To User (write), Create Authorization Policy (write), Create Role (write), Delete Role (write), Update Role (write)
- **Sessions & Security Events (9):** Get Event Configuration (read), List Active User Sessions (read), Search Admin Events (read), Search Login Events (read), View Account Login History (read), Delete All User Sessions (write), Delete Event Logs (write), Delete User Session (write), Update Event Configuration (write)
- **Realms & Config Backup (8):** Check SMTP Connection (read), Export Partial Realm Config (read), Get Realm Settings (read), Get Server Capabilities (read), Create New Realm (write), Delete Realm (write), Update Realm Settings (write), Upload Partial Realm Config (write)
- **Groups & Defaults (8):** Get Group By Path (read), List Default Groups (read), List Groups (read), Assign Default Group (write), Create Group (write), Delete Default Group (write), Delete Group (write), Update Group (write)
- **Users & Profiles (7):** Count Users (read), Get User Profile (read), Search Users (read), Create User Account (write), Delete User Account (write), Reset User Password (write), Update User Profile (write)
- **Authentication & MFA (7):** Get Brute Force Status (read), List Authentication Flows (read), List Required Actions (read), Create Two Factor Credential (write), Delete Brute Force Lockouts (write), Update Account Password (write), Update Password Policy (write)
- **Keys & Components (6):** List Realm Components (read), List Realm Keys (read), Create Realm Component (write), Delete Realm Component (write), Send Revocation Policy (write), Update Realm Component (write)

## Example Prompts for Keycloak
- **Role change audit:** "List every Keycloak admin role grant and revocation this week with the acting admin and realm name."
- **MFA gap report:** "Show Keycloak accounts without MFA enabled, grouped by realm, with last login date for each user."
- **Client secret check:** "Find Keycloak clients with secrets older than 90 days and list which services depend on each one."
- **Draft access notice:** "Draft a Keycloak MFA reminder for the Northwind Supply admins, save as a draft, and wait for my go-ahead."
