keycloak-cli
CLI tool for managing multiple Keycloak configurations and generating tokens.
Install
poetry install
Usage
kc --help
Quick Start
# Initialize your first Keycloak configuration
kc init
# Check server status
kc status
# Generate a token for a client
kc token get
Commands
kc init
Interactive setup wizard to create a Keycloak configuration. Prompts for organization, environment, server URL, realm, and admin credentials. Tests the connection before saving.
kc config — Configuration Management
Manage stored Keycloak server configurations (org/env pairs).
| Command | Description |
|---|---|
kc config list |
List all configurations |
kc config add |
Add a new configuration |
kc config show |
Show details of a specific config |
kc config use |
Switch the default configuration |
kc config update |
Update config properties |
kc config remove |
Delete a configuration |
# List configs as table or JSON
kc config list --output json
# Switch default config
kc config use myorg/production
kc token — Token Management
Generate, cache, decode, and verify JWT access tokens.
| Command | Description |
|---|---|
kc token get |
Get token (from cache or generate new) |
kc token generate |
Always generate a fresh token |
kc token decode |
Decode and inspect a JWT token |
kc token verify |
Check if a token is still valid |
# Get a token (uses cache if valid)
kc token get my-client
# Generate fresh token and copy to clipboard
kc token generate my-client --copy
# Output as Authorization header
kc token get my-client --as-header
# Decode a token from stdin
echo $TOKEN | kc token decode -
kc client — Client Management
Manage Keycloak clients via the Admin API.
| Command | Description |
|---|---|
kc client list |
List all clients in the realm |
kc client show |
Show detailed client configuration |
kc client create |
Create a new client |
kc client update |
Update client properties |
kc client secret |
Get or regenerate client secret |
# List clients (excludes internal clients by default)
kc client list
# Include internal clients
kc client list --all
# Search clients
kc client list --search my-app
# Create a client with service account
kc client create my-app --service-account --description "My application"
# Update client interactively
kc client update my-app
# Update client with flags
kc client update my-app --ttl 3600 --description "Updated"
# Regenerate client secret
kc client secret my-app --regenerate
kc status
Dashboard overview showing all configured servers, their health status, and which config is active.
kc health
Run health checks against a Keycloak server: connectivity, realm existence, token endpoint, and admin authentication.
# Check current config
kc health
# Check all configs
kc health --all
kc history
View recent CLI command history.
kc history
kc history --limit 50
kc history --clear
Global Options
| Option | Description |
|---|---|
--version/-V |
Show version and exit |
--config/-c |
Specify config key (org/env) for most commands |
Configuration
Configurations are stored at ~/.keycloak-cli/config.yaml. Each configuration is identified by an org/env pair (e.g., myorg/staging).
Token cache is stored at ~/.keycloak-cli/cache/tokens/.
License
GPL-3.0-or-later
Metadata
Release files for keycloak-util 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| keycloak_util-0.1.1.tar.gz | 19.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| keycloak_util-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.1 kB
Release files / keycloak_util-0.1.1.tar.gz
| Download URL | keycloak_util-0.1.1.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b42cfd73821b254df3736d33416af73d03debd02b05e9104fbdceefe100e919
|
|
BLAKE2b-256 checksum How to use checksums |
adbd5fd631431508c85d14d6adedf959d4a23372577c0921669757cdba5166db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.13 Darwin/25.4.0
|
Release files / keycloak_util-0.1.1-py3-none-any.whl
| Download URL | keycloak_util-0.1.1-py3-none-any.whl |
|---|---|
| Size | 29.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6816242980440d9f11d5efdbff486908a912c69e01b69be95fd59bb50fc716a8
|
|
BLAKE2b-256 checksum How to use checksums |
e9625f24eb7e680100ff309ab53324dd34e453dc9b0d0bad2122e6fc6f9437e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.13 Darwin/25.4.0
|