CLI for KeePassXC using the browser extension protocol with biometric unlock
Project description
keepassxc-cli
A command-line interface for KeePassXC that communicates via the browser extension protocol, supporting biometric (TouchID/fingerprint) unlock on supported platforms.
What it is
keepassxc-cli talks to a running KeePassXC instance using the same native messaging protocol used by the KeePassXC Browser extension. This means:
- Biometric unlock: On macOS with TouchID (or similar) configured in KeePassXC, you can authenticate via fingerprint rather than typing your master password.
- No master password in shell history: Authentication happens through KeePassXC's GUI, not the terminal.
- Full CRUD: List, search, add, edit, delete entries and groups.
- TOTP: Retrieve time-based one-time passwords.
- Clipboard: Copy credentials directly to the clipboard.
Prerequisites
- KeePassXC ≥ 2.7 with the Browser Integration feature enabled:
- Open KeePassXC → Tools → Settings → Browser Integration
- Enable "Enable browser integration"
- A KeePassXC database must be open (or KeePassXC must be running with auto-open configured).
- Python ≥ 3.10
Installation
pipx install keepassxc-cli
Or with pip:
pip install keepassxc-cli
Setup
Before using keepassxc-cli, associate it with your KeePassXC instance:
keepassxc-cli setup
This performs a key exchange with KeePassXC (you will be prompted to allow the association in the KeePassXC GUI). The association is saved to ~/.keepassxc/browser-api.json.
Usage
Global options
keepassxc-cli [--config PATH] [--browser-api-config PATH] [--format {table,json,tsv}] [-v] COMMAND
| Option | Description |
|---|---|
--config |
Path to CLI config file (default: ~/.keepassxc/cli.json) |
--browser-api-config |
Path to browser API config file (default: ~/.keepassxc/browser-api.json) |
--format |
Output format: table (default), json, or tsv |
-v, --verbose |
Enable verbose/debug logging |
Commands
setup — Associate with KeePassXC
keepassxc-cli setup
status — Connection and association status
keepassxc-cli status
ls — List entries or groups
keepassxc-cli ls # list all entries (includes UUID column)
keepassxc-cli ls --groups # list groups (tree view)
keepassxc-cli ls --format json # output as JSON
UUIDs shown in the output are needed for edit, rm, totp, and clip --field totp.
search — Search entries
keepassxc-cli search github
keepassxc-cli search "my bank" --show-password
Searches case-insensitively across title, username, and URL fields.
show — Show entries for a URL
keepassxc-cli show https://github.com
keepassxc-cli show https://github.com -p # reveal password
add — Add a new entry
keepassxc-cli add --url https://example.com --username user@example.com --title "Example"
# Password will be prompted securely if --password is not given
keepassxc-cli add --url https://example.com --username user --password mypass
edit — Edit an entry
Finding a UUID: Use
keepassxc-cli lsorkeepassxc-cli search <query>to list entries with their UUIDs.
keepassxc-cli edit <uuid> --username newuser
keepassxc-cli edit <uuid> --password newpass --title "New Title"
rm — Delete an entry
keepassxc-cli rm <uuid> # prompts for confirmation
keepassxc-cli rm <uuid> --yes # skip confirmation
totp — Get TOTP code
keepassxc-cli totp <uuid>
clip — Copy to clipboard
keepassxc-cli clip https://github.com # copies password
keepassxc-cli clip https://github.com --field username
keepassxc-cli clip https://github.com --field totp
generate — Generate a password
keepassxc-cli generate
keepassxc-cli generate --length 32 --symbols
keepassxc-cli generate --no-numbers --no-uppercase
keepassxc-cli generate --clip # copy to clipboard instead of printing
lock — Lock the database
keepassxc-cli lock
mkdir — Create a group
keepassxc-cli mkdir "Work"
keepassxc-cli mkdir "Projects" --parent-uuid <parent-group-uuid>
Configuration
CLI config (~/.keepassxc/cli.json)
Only non-default values are stored. Available options:
| Key | Default | Description |
|---|---|---|
browser_api_config_path |
~/.keepassxc/browser-api.json |
Path to the browser API config |
default_format |
table |
Default output format (table, json, tsv) |
Example ~/.keepassxc/cli.json:
{
"default_format": "json"
}
Browser API config (~/.keepassxc/browser-api.json)
Shared with keepassxc-browser-api. Contains the association keys created during keepassxc-cli setup. This file is automatically created and updated by the setup command.
Both config files are stored with 0o600 permissions (owner read/write only).
Development
git clone https://github.com/mietzen/keepassxc-cli
cd keepassxc-cli
python3 -m venv .venv
source .venv/bin/activate
# Install local keepassxc-browser-api dependency first
pip install ../mietzen-keepassxc-browser-api/
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest --tb=short -q
# Run linter
ruff check --ignore=E501 --exclude=__init__.py ./keepassxc_cli
Known Limitations
- Requires KeePassXC to be running and the database to be open (or biometric auto-unlock configured).
- The
clipandgenerate --clipcommands requirepyperclipand a working clipboard (e.g.,xclip/xselon Linux, built-in on macOS/Windows). - The browser integration protocol does not support moving entries between groups directly.
- Entry URLs in the database are stored as
KPH: urlstring fields; entries without a URL field may not appear inshowresults.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file keepassxc_cli-0.1.1.tar.gz.
File metadata
- Download URL: keepassxc_cli-0.1.1.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74d1d47569f04cd055655d884850155276a081acb3e173d568f6142b47d0d086
|
|
| MD5 |
70553e1dde0b63ce3b51cbd7ea108ccd
|
|
| BLAKE2b-256 |
d84a0e81cc5044e66f36205f6f4ce7d3e42ee86666c60c07c02de15fcd2f5b29
|
Provenance
The following attestation bundles were made for keepassxc_cli-0.1.1.tar.gz:
Publisher:
pypi.yml on mietzen/keepassxc-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keepassxc_cli-0.1.1.tar.gz -
Subject digest:
74d1d47569f04cd055655d884850155276a081acb3e173d568f6142b47d0d086 - Sigstore transparency entry: 1280825592
- Sigstore integration time:
-
Permalink:
mietzen/keepassxc-cli@89a2299b47c7d7fd3b536ddb1b901591abe6d272 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mietzen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@89a2299b47c7d7fd3b536ddb1b901591abe6d272 -
Trigger Event:
release
-
Statement type:
File details
Details for the file keepassxc_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: keepassxc_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8de32b3acb0a53ab580d52c73afe461731b3cf1c9bbd963fdd33c47fb8e0c952
|
|
| MD5 |
e430ed4fc331dd69a8978b22debf9792
|
|
| BLAKE2b-256 |
b069a5f40a7a948ba6a212345a0ac6ff6d4a3caf17c7fcabceb32fc588963b1e
|
Provenance
The following attestation bundles were made for keepassxc_cli-0.1.1-py3-none-any.whl:
Publisher:
pypi.yml on mietzen/keepassxc-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keepassxc_cli-0.1.1-py3-none-any.whl -
Subject digest:
8de32b3acb0a53ab580d52c73afe461731b3cf1c9bbd963fdd33c47fb8e0c952 - Sigstore transparency entry: 1280825594
- Sigstore integration time:
-
Permalink:
mietzen/keepassxc-cli@89a2299b47c7d7fd3b536ddb1b901591abe6d272 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mietzen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@89a2299b47c7d7fd3b536ddb1b901591abe6d272 -
Trigger Event:
release
-
Statement type: