Skip to content
v1.0.2Apache-2.0

Comprehensive Keycloak identity and access management — manage realms, clients, users, roles, identity providers, organizations, authentication flows, protocol mappers, and debug JWT tokens via Admin REST API. Includes multi-tenant SaaS authorization patterns.

Keycloak Power

Keycloak Kiro Power License

The first comprehensive Keycloak Power for Kiro IDE. Manage Keycloak through its Admin REST API and give Kiro grounded workflows for identity architecture, SSO federation, JWT claims, Organizations, and SaaS authorization.

Features

  • Administer realms, clients, users, roles, groups, sessions, events, and client scopes.
  • Configure OIDC, SAML, Google, Microsoft Entra ID, Okta, generic external IdPs, and LDAP/AD guidance.
  • Create and operate Keycloak Organizations for Keycloak 26+ multi-tenant B2B/B2B2C deployments; manage isolated Organization Groups on Keycloak 26.6+.
  • Provision secure BFF clients, fixed SaaS client roles, version-gated LDAP federation inspection, sanitized configuration baselines, and minimal token contracts.
  • Inspect JWT structure and claims locally without sending tokens to any service.
  • Design authentication flows, MFA, protocol mappers, and authorization middleware contracts.
  • Use focused skills that distinguish Keycloak authentication from SaaS-domain authorization.

Requirements

  • Kiro IDE with custom Powers enabled.
  • Keycloak 21+ for core Admin REST API operations; Keycloak 26+ and Organizations enabled for organization tools; Keycloak 26.6+ for Organization Groups. The power returns unsupported_feature with the minimum upgrade for older servers.
  • A confidential client with Service Accounts Enabled and a client secret.
  • A service account granted the least-privilege realm-management roles required by the operations you intend to perform. The server uses only Client Credentials Grant; it never uses Resource Owner Password Credentials.
  • Node.js 22+ to run the bundled MCP server.

Quick start

  1. Build the server:
    Set-Location .\mcp-server
    npm ci
    npm run build
    
  2. In Kiro, open Powers, select Add Custom Power, select Import from folder, and choose the keycloak-power directory.
  3. Make these values available to the MCP process:
    KEYCLOAK_URL=https://keycloak.example.com
    KEYCLOAK_REALM=master
    KEYCLOAK_CLIENT_ID=kiro-keycloak-admin
    KEYCLOAK_CLIENT_SECRET=<service-account-secret>
    
  4. Start a new Kiro chat and ask, for example, “Liste os realms do Keycloak” or “Configure Organizations para um SaaS B2B”.

KEYCLOAK_URL may include a reverse-proxy context path, for example https://sso.example.com/auth; trailing slashes are normalized. KEYCLOAK_REALM is the realm where the admin client exists (commonly master), not necessarily the realm being managed.

Configure the Keycloak service account

  1. In the admin console, create a confidential OpenID Connect client, such as kiro-keycloak-admin, in the administration realm.
  2. Turn on Client authentication and Service accounts roles; do not enable Direct Access Grants for this Power.
  3. On Credentials, generate and save the client secret in a secret manager. Do not commit it to the repository or mcp.json.
  4. On Service account roles, select client realm-management and assign only necessary permissions. Typical read-only discovery needs query-realms, query-clients, query-users, and view-realm; realm mutation also needs roles such as manage-realm, manage-clients, manage-users, or manage-identity-providers.
  5. Verify connectivity by asking Kiro to call get_server_info.

Environment configuration

VariableRequiredMeaning
KEYCLOAK_URLYesBase URL of the Keycloak server.
KEYCLOAK_REALMYesRealm that authenticates the service account.
KEYCLOAK_CLIENT_IDYesConfidential client ID for the service account.
KEYCLOAK_CLIENT_SECRETYesSecret for Client Credentials Grant.
KEYCLOAK_SECRET_SINK_COMMANDFor BFF create/rotationExecutable that receives a JSON secret record on stdin and stores it in the operator's vault. The secret is never written to MCP output.
KEYCLOAK_SECRET_SINK_ARGSNoJSON array of arguments passed to the secret sink executable.
KEYCLOAK_USER_FEDERATION_TESTED_VERSIONFor user-federation toolsExact Keycloak version covered by an operator-run integration test.
KEYCLOAK_USER_FEDERATION_TEST_PATHFor connection testExact, version-tested realm-relative Admin REST suffix for the LDAP connection test. No default is assumed.

The Power manifest contains no secret. Use Kiro's environment/secrets configuration or your operating system's environment to provide the values at runtime.

Secret delivery and version gates

create_bff_client requires KEYCLOAK_SECRET_SINK_COMMAND whenever it creates, reconciles, or rotates a BFF client. It sends a JSON record containing type, secretRef, realm, clientId, and the secret through the sink process's stdin, ignores sink stdout/stderr, and returns only { deliveredToVault: true, secretRef }. If Keycloak succeeds and the sink fails, rerun the same target without rotateSecret; the tool reads the current secret again and retries delivery without returning it to chat. Configure the command as a trusted local vault adapter; the MCP server does not implement a vendor-specific vault client or persist secrets.

list_user_federation_providers, get_user_federation_provider, and list_user_federation_mappers require KEYCLOAK_USER_FEDERATION_TESTED_VERSION to exactly match the connected server. test_user_federation_connection additionally requires KEYCLOAK_USER_FEDERATION_TEST_PATH, set only after testing that realm-relative path against that exact Keycloak version. It never accepts a bind password in input.

SkillUse it for
admin-apiSafe, ordered Keycloak Admin REST API administration.
setup-realmRealm bootstrap and security baseline.
setup-clientOIDC/SAML client design and redirect safety.
identity-providersGoogle, Entra ID, OIDC, SAML, and Okta federation.
organizationsKeycloak 26+ Organizations and B2B multi-tenancy.
authentication-flowsBrowser flows, required actions, OTP, and WebAuthn.
token-debugLocal JWT decoding and claim diagnosis.
user-federationLDAP and Active Directory federation planning.
protocol-mappersClaims, audiences, group membership, tenant, and organization mappings.
saas-authorizationMulti-tenant API authorization architecture.
troubleshootingEvents, sessions, client, token, and IdP diagnosis.

MCP tools

DomainTools
Realmslist_realms, get_realm, create_realm, update_realm, delete_realm (requires confirmation: "DELETE <realm>"; master is blocked)
Clientslist_clients, get_client, create_client, get_client_secret, update_client
BFF clientsplan_bff_client, create_bff_client, validate_bff_client (confidential Authorization Code + PKCE S256; secrets go only to the configured vault sink)
Userslist_users, get_user, create_user, update_user, assign_role_to_user, get_user_roles
Roleslist_roles, create_role, get_role
SaaS rolesplan_saas_default_roles, provision_saas_default_roles, assign_saas_client_role, remove_saas_client_role (five fixed client roles only)
Groupslist_groups, create_group, add_user_to_group, get_group_members
Organization Groupsget_organization_groups_capability, list_organization_groups, create_organization_group, move_organization_group, delete_organization_group, assign_organization_group_member (Keycloak 26.6+ only; no realm-group fallback)
Identity providerslist_identity_providers, get_identity_provider, create_identity_provider, update_identity_provider, delete_identity_provider, get_identity_provider_mapper_types, list_identity_provider_mappers, get_identity_provider_mapper, create_identity_provider_mapper, update_identity_provider_mapper, delete_identity_provider_mapper
User federationlist_user_federation_providers, get_user_federation_provider, list_user_federation_mappers, test_user_federation_connection (version-matched integration gate; redacted output; no bind password input)
Organizationslist_organizations, get_organization, create_organization, add_member_to_organization, list_organization_members, add_idp_to_organization
Authenticationlist_auth_flows, get_auth_flow, get_required_actions
Sessions and eventsget_user_sessions, get_server_info, get_realm_events
Tokensdecode_token, get_token_endpoint_info
Protocol mapperslist_protocol_mappers, create_protocol_mapper, get_default_client_scopes
Baseline and token contractexport_sanitized_baseline, diff_sanitized_baseline, validate_token_contract

Tool inputs are validated for required strings and JSON-shaped configuration values. Every REST request surfaces Keycloak's HTTP status and message to make permissions, malformed request bodies, and unsupported server features diagnosable.

Example Kiro conversations

List the clients in the saas realm and show the redirect URIs for portal-web.
Create the acme organization with alias acme, domain acme.example, and add alice as a member.
Decode this JWT and explain why the API isn't receiving the tenant_id claim.
I need a client for an SPA. Use Authorization Code with PKCE, safe origins, and a groups mapper.

Development

Set-Location .\mcp-server
npm ci
npm run build

The server speaks MCP over standard input/output. Do not write log messages to stdout; diagnostics belong on stderr. See CONTRIBUTING.md for development, security, and pull-request rules.

Privacy and support

Documentation sources

The implementation follows the Keycloak documentation and Admin API reference. Organization guidance follows Keycloak's Organizations announcement. Content was rephrased for compliance with licensing restrictions.

License

Copyright 2026 Lucas Magalhães. Licensed under Apache-2.0.