Token VaultDocs
Agents and Apps

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/github

Install

npm i -g @tvault/cli

Needs 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 browser

Over 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:

TypeCreated bySendsSees
admintvault login (browser)A Token Vault CLI session (tvcli_ access, tvclr_ refresh), channel cliWhat you can do in the web app, except changes that a Who can read policy makes web-app only (WEB_CONSOLE_REQUIRED)
agentA tvagent_ keyThe key as BearerThe agent's own access
keyA tvkey_ keyThe key as BearerThe key's scopes and access
$ tvault ctx list
* default  admin  you@example.com
  ci       key     ci-deploy
$ tvault use ci
$ tvault --ctx default whoami

contexts.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 --force

Without --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.
  • --format is json, table, wide or name. Unset, you get a table on a terminal and JSON when piped. whoami prints 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
ExitMeaning
0Success
1Bad input, not found, or another refusal
2Not logged in, or the session failed to refresh
3Network failure
4Server error
5Access stopped (VAULT_LOCKED)
6The credential exists but has no value
7Rate limited
8Scope denied
9Human only
10Key expired
11Key suspended or agent inactive
12Invalid key
13A policy denied the call (POLICY_DENIED)
14No 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

Loading diagram...

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

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.

On this page