tvault CLI
Install tvault, sign in, switch contexts and run the everyday commands for credentials, access, labels and MCP servers.
tvault is the Token Vault command-line client: a single Go binary, source at c-lgrant/tvault. This page covers install, login, contexts and everyday use. Every command and flag is in the CLI reference. Requires tvault 0.14.0 or later.
tvault login # browser login
printf %s "$PAT" | tvault add github --mcp github --for claude-code=mcp --yes
tvault get github --check && echo present
tvault connect claude-code github=mcp:github --server github/githubInstall
npm i -g @tvault/cliNeeds Node 16 or later on Linux or macOS (x64 or arm64). The postinstall step downloads the matching release binary and verifies it against checksums.txt. TVAULT_VERSION pins a version; TVAULT_SKIP_DOWNLOAD skips the download.
$ tvault version
tvault 0.14.0 (commit <sha>, built <date>)Shell completion: tvault completion install writes a completion file for bash, zsh or fish (PowerShell is not supported) and never edits your rc files. For zsh it prints an fpath= line for you to add.
Log in
tvault login # opens your browser, loopback flow
tvault login --as work # name the context
tvault login --no-launch-browser # SSH or headless: paste a code instead
printf %s "$AGENT_KEY" | tvault login --key-stdin --as ci # an agent or key, no browserOver SSH, or on Linux with no display, tvault login falls back to the code-paste flow by itself. A key login needs --as <name>. Prefer --key-stdin: --key <key> works but leaves the key in shell history and the process list. The default servers are https://api.tokenvault.uk and https://tokenvault.uk; use --api-url (and --frontend-url) for another control plane.
Contexts
A context is a saved login. There are three types:
| Type | Created by | Sends | Sees |
|---|---|---|---|
admin | tvault login (browser) | A Token Vault CLI session (tvcli_ access, tvclr_ refresh), channel cli | What you can do in the web app, except changes that a Who can read policy makes web-app only (WEB_CONSOLE_REQUIRED) |
agent | A tvagent_ key | The key as Bearer | The agent's own access |
key | A tvkey_ key | The key as Bearer | The key's scopes and access |
$ tvault ctx list
* default admin you@example.com
ci key ci-deploy
$ tvault use ci
$ tvault --ctx default whoamicontexts.yaml lives in ~/.config/tvault/ (mode 0600). Use --context <name> (alias --ctx) on any command, or tvault use <name> to switch. tvault logout drops the context and, for an admin login, revokes its refresh token on the server. An admin login counts as the tvault CLI channel in policies ("Who can read").
Everyday commands
tvault ls # list credentials (alias: credentials, creds)
printf %s "$SECRET" | tvault add stripe # store; the value goes to your webhook, not Token Vault
printf %s "$NEW" | tvault set stripe # rotate the value
tvault get stripe # value to stdout, safe in $(...)
tvault get stripe --check # exit 0 if it has a value, 6 if empty; prints nothing
tvault show stripe # metadata only
tvault history stripe # recent events
tvault rm stripe --forceWithout --value or a pipe, add and set ask for the value with a hidden prompt. --value <v> works but warns, because it lands in shell history. Composite credentials: tvault get svc --field key or svc.key, --kv for KEY=VALUE lines.
Output and exit codes
Scripts can rely on these:
- stdout carries only data: credential values, new key secrets, tables and JSON. Status lines, warnings and prompts go to stderr, so
KEY=$(tvault keys create ...)captures only the secret. --formatisjson,table,wideorname. Unset, you get a table on a terminal and JSON when piped.whoamiprints text unless you pass--format json.- Denials print two lines, a plain sentence and a fix:
$ tvault get github
denied: access to github allows tool calls only, not reading the value.
hint: add the value use: `tvault grant <agent> github=value`
$ echo $?
14| Exit | Meaning |
|---|---|
| 0 | Success |
| 1 | Bad input, not found, or another refusal |
| 2 | Not logged in, or the session failed to refresh |
| 3 | Network failure |
| 4 | Server error |
| 5 | Access stopped (VAULT_LOCKED) |
| 6 | The credential exists but has no value |
| 7 | Rate limited |
| 8 | Scope denied |
| 9 | Human only |
| 10 | Key expired |
| 11 | Key suspended or agent inactive |
| 12 | Invalid key |
| 13 | A policy denied the call (POLICY_DENIED) |
| 14 | No grant for this use (NO_GRANT, GRANT_EXPIRED, GRANT_TOOLS_ONLY) |
tvault explain <CODE> describes any code and its fix. All exit codes are on the errors reference.
How a read works
Writes mirror it: the CLI asks Token Vault for a store ticket, then posts the value straight to your webhook's /v1/store. Token Vault never sees the value.
Next steps
CLI reference
Every command, flag and alias.
Scripts and CI
Run tvault in a pipeline with a least-privilege key.
Connect your apps
tvault connect and the per-app commands.
Ready to try it?
Sign in with Google or email. Your credentials stay on your own webhook, and the quickstart gets Claude Code making its first MCP tool call in about 15 minutes.