Token VaultDocs
Agents and Apps

Access

Decide what an agent or key may do with a credential (MCP or Value), which MCP servers, and for how long.

Access is a grant: one holder (an agent or an API key), one credential, a set of uses, and an expiry. Nothing is shared by default. Labels never grant access.

Uses: MCP or Value

MCP access is written tools in the API

The API and the grants reference write MCP access as uses: ["tools"]. The web app and the CLI say MCP, and tvault accepts mcp or tools in a grant spec. Both mean the same thing.

UseWhat the holder can doWhat it never gets
MCPCall the credential's MCP servers. Your webhook puts the credential into the upstream request.The value.
ValueRead the value itself, for scripts and the CLI. It comes from your webhook, not from Token Vault.Nothing extra.

A grant can hold one use or both. A grant made before uses existed means Value. MCP needs a credential that has at least one MCP server.

Keys are value-only

API keys (tvkey_) get Value and nothing else. The dialog says "Keys get Value only", and tvault keys grant has no =uses syntax. MCP access is for agents.

Which access should I give?

The holder is...GiveWhy
Claude Code, Cursor or another MCP client using GitHub, Linear or Sentry toolsMCPThe app can work but never holds the PAT. Nothing to leak into a transcript.
A script that needs the raw token for an SDK or curlValueIt reads the value from your webhook. Add an expiry.
An agent that needs both, for example to call tools and also run git pushMCP, ValueUse mcp:<server> to limit which MCP servers.
A CI jobValue on a key, or an agentKeys are value-only; they can carry an expiry of their own.
An agent you are testingValue, 24 hoursShort expiry, easy to widen later.
UnsureMCPThe narrower use. Edit access later to add Value.

MCP servers

An MCP grant can name which of the credential's MCP servers it covers. Leave it on All MCP servers and the grant also covers MCP servers you add later. Pick specific ones to keep it narrow.

Expiry

One expiry covers the whole grant (all uses together).

CaseDefault in the app
MCP onlyNever ("Until revoked")
Includes Value24 hours
Choices in the dialogNever, 24 hours, 7 days, 30 days, Custom date
API, expiresInHours absentNo expiry

An expired grant shows as expired in the Access tab and in the Matrix. The agent gets GRANT_EXPIRED.

Grant or edit access

Open Agents, then the agent's Access tab, then grant. Or open a cell in the Matrix. Or use the Who uses it and Access rows in Add credential.

Fill the dialog: Agent or key, Credential, uses (MCP, Value), MCP servers (All MCP servers or k of N), Expires.

Save. For an existing pair the dialog is titled Edit access and changes the grant in place. The dialog also prints the equivalent CLI line.

Matrix

/agents?view=matrix lays agents (and keys, with the keys toggle) down the side and credentials across the top, grouped by label. Each cell shows the uses and opens Grant access or Edit access. It is the quickest way to see who can reach what.

Revoke

  • Revoke on an Access row removes that one credential. A toast offers Undo.
  • Revoke all access (Home, or the Activity drawer) removes every credential from one agent or key and keeps the identity. No undo.
  • Stop keeps the grants but refuses every call. See Agents.
  • Stop all access refuses everything account-wide.

Revoking and suspending still work while access is stopped.

From the CLI

The agent comes first. =uses and :servers (the MCP servers an MCP grant covers) are optional. mcp and tools both work.

tvault grant claude-code github                        # value (plain service = value)
tvault grant claude-code github=mcp                    # MCP, all MCP servers
tvault grant claude-code github=value,mcp:github       # both; MCP limited to one MCP server
tvault grant claude-code github=mcp:github linear=mcp

Store and grant in one step:

printf %s "$PAT" | tvault add github --mcp github --for claude-code=mcp --yes
# order: resolve agents, store on your webhook, attach the MCP preset, grant, then labels

Requires tvault 0.14.0 or later. Keys use tvault keys grant <key> <service> (value only). Listings from the CLI show service names only, so an MCP-only grant looks like a value grant there. The web app shows the uses.

API

POST /api/agents/{id}/grants
Content-Type: application/json

{ "serviceName": "github", "uses": ["tools"], "servers": ["github"], "expiresInHours": 168 }

Change a grant in place with PATCH:

PATCH /api/agents/{id}/grants/github
Content-Type: application/json

{ "uses": ["tools", "value"], "servers": null, "expiresAt": null }

servers lists the MCP servers the grant covers; servers: null means all MCP servers. expiresAt: null means no expiry. Unknown fields are rejected. Keys use /api/keys/{id}/grants/.... POST /api/agents/{id}/grants/revoke-all removes every grant in one atomic batch. GET /api/grants lists every grant on the account (human only). The full contract is in the grants API reference.

What an agent sees when refused

SituationWhereResponse
No access to that credentialREST404 {"detail":{"code":"NO_GRANT","message":"..."}}
Access endedREST403 GRANT_EXPIRED
MCP-only, asks for the valueREST and MCP403 GRANT_TOOLS_ONLY
Agent suspendedany403 AGENT_INACTIVE
Granting more than you holdgrant API403 GRANT_USES_EXCEEDED or GRANT_SERVERS_EXCEEDED
curl -i 'https://api.tokenvault.uk/api/agents/credentials?service=github' \
  -H 'Authorization: Bearer tvagent_...'
HTTP/1.1 403 Forbidden
Content-Type: application/json

{"detail":{"code":"GRANT_TOOLS_ONLY","message":"This grant does not allow reading the credential value; it can only be used through MCP access."}}

The same call from the CLI as that agent:

$ 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 $?
1

The fix is on your side: Edit access, then tick Value. Every refusal is also in Activity with the plain-words reason. A holder cannot widen what it passes on: an agent granting to another cannot exceed its own uses or MCP servers.

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