Token VaultDocs
Get Started

Quickstart: your first MCP tool call

Deploy the reference webhook, bind it, add a GitHub credential with its MCP server, connect Claude Code and watch the tool call and a denial appear in Activity.

At the end of this page Claude Code calls GitHub's MCP tools with your token, and never holds the token. You deploy the server that stores it, so step 2 is a deploy.

You needWhy
A Cloudflare account (free tier)Runs the reference webhook: a Worker plus a D1 database
A GitHub account and a personal access tokenThe credential. A fine-grained token with read-only access to one repo is enough
Claude Code, or another MCP appMakes the tool call. Tabs below cover seven apps
Optional: Node 16+ or GoOnly for the CLI path

Time: about 15 minutes. The Cloudflare deploy is most of it.

Sign in

Open tokenvault.uk/login. Sign in with Google, email and password, or an email link. The first sign-in creates your account.

With no webhook bound yet you land on Home, which shows a setup prompt. Follow it to the setup wizard. Its steps are Deploy, Enter URL, Connect and Ready; on the Cloudflare Workers path the worker's own /bind page replaces the middle two.

Deploy your webhook

On Deploy, pick Deploy to Cloudflare Workers (recommended) or Self-host.

The button opens Cloudflare with the reference webhook from c-lgrant/tvault:

https://deploy.workers.cloudflare.com/?url=https://github.com/c-lgrant/tvault/tree/main/examples/webhook

Cloudflare forks the repo into a private repo in your account, connects Workers Builds (every later push redeploys) and provisions a D1 database named tv-webhook. Click Deploy.

The build also sets the root secret TV_WEBHOOK_SEED, if its token has Workers Scripts: Edit. If it could not, the webhook's /bind page says Setup required and prints this command:

openssl rand -hex 32 | npx wrangler secret put TV_WEBHOOK_SEED --name <your-worker-name>

You get a URL like https://tv-webhook.<your-subdomain>.workers.dev. Check it:

Terminal
$ curl -s https://tv-webhook.<your-subdomain>.workers.dev/v1/health
{"status":"healthy","version":"…","keyConfigured":true,"capabilities":["store","credential","proxy","refresh",…],…}

The seed never leaves your Cloudflare account. The webhook derives its AES-256-GCM key and its HMAC secret from it in memory.

Settle the seed before you bind

If you change TV_WEBHOOK_SEED after binding, the HMAC secret changes and every call fails until you bind again.

Prefer your own machine or cloud? Self-host the webhook. It is the same contract.

Bind it to Token Vault

Binding is one handshake. You never copy a secret by hand.

  1. Open your worker's root, https://tv-webhook.<your-subdomain>.workers.dev/. The page shows Deployed, Seed and Connected to Token Vault: not yet.

  2. Check the line Binding to: https://tokenvault.uk. The site you continue to receives a one-time code that completes the key exchange, so confirm it is yours.

  3. Click Connect to Token Vault. The /bind page opens ("Connect this webhook to Token Vault"). Click Connect to Token Vault again. The webhook mints the code and sends your browser to:

    https://tokenvault.uk/vault/webhook-bind?code=<one-time code>&webhook_url=<base64 url>&hmac_hash=<sha256 of the HMAC secret>
  4. On Connect Webhook, review the URL, tick I deployed this webhook myself., then click Connect Webhook. The button stays disabled until you tick the box.

Token Vault's backend calls your webhook's POST /v1/exchange with the code, gets the HMAC secret, and checks that its SHA-256 matches hmac_hash. Token Vault now holds your webhook URL and that HMAC secret. It holds no credential and no encryption key. Details: Binding.

Add a credential

Open Credentials and click Add credential (/credentials/new). It is one page with one Save.

RowSet it to
WhatGitHub (the MCP preset chip)
Namegithub (suggested by the preset; you cannot rename it later)
LabelsLeave empty, or work. Labels never grant access
ValuePaste your PAT. The row says: Sent from this browser to your webhook at <host>. Token Vault never sees it.
MCP serversThe github preset, ticked: https://api.githubcopilot.com/mcp/ with Authorization: Bearer ${TOKEN}
Who uses itClaude Code is ticked. Tick the other apps you use. Each one becomes its own agent with MCP access

The CLI row shows the same thing as one command. Click Save. The receipt lists each step with its own Retry:

✓ Value on your webhook
✓ MCP server        github: <n> tools
✓ Access            1 holder: claude-code (MCP)

MCP means the agent can call the MCP server's tools and never gets the value. MCP access defaults to Until revoked. Value access would default to 24 hours.

Connect your app

Open the agent from the receipt (Open claude-code). Its Connect tab prints the exact text for your agent and MCP servers. The entry is named tokenvault-github-github and its URL is the MCP server URL:

https://api.tokenvault.uk/api/mcp/github/github

Where your Token Vault has the single URL enabled, the tab shows one tokenvault entry (https://api.tokenvault.uk/api/agents/mcp) instead; use that the same way.

claude mcp add --transport http --scope user tokenvault-github-github https://api.tokenvault.uk/api/mcp/github/github

Run /mcp in Claude Code, select the MCP server, press Authenticate. Your browser opens Token Vault: pick claude-code and press Authorize.

From the CLI, tvault connect claude-code github=mcp:github --server github/github runs the same claude mcp add (it names the entry tv-github-github).

The app signs in with OAuth 2.1 and gets a one-hour tvsess_… session for that agent. No key is pasted anywhere. Scripts, CI and the headless option: Connect your apps.

Make the first tool call

Ask Claude Code something only GitHub can answer:

> Who am I on GitHub? Use the GitHub tools.

Claude calls the MCP server's get_me tool. This is the request Token Vault receives:

Claude Code → Token Vault
POST /api/mcp/github/github HTTP/1.1
Host: api.tokenvault.uk
Authorization: Bearer tvsess_…
Content-Type: application/json
Accept: application/json, text/event-stream

{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"get_me","arguments":{}}}

Token Vault checks the session, the MCP access, the kill switch and your policies. Then it forwards the body to your webhook with a signed ticket and the header template:

Token Vault → your webhook: POST /v1/proxy (trimmed)
{
  "ticket": "eyJzdmMiOiJnaXRodWIiLCJwdXIiOiJwcm94eSIs…fQ.4b1d…e09c",
  "service": "github",
  "upstream": {
    "url": "https://api.githubcopilot.com/mcp/",
    "method": "POST",
    "body": "<base64 of the JSON-RPC body>"
  },
  "headerTemplates": {
    "Authorization": "Bearer ${TOKEN}",
    "Accept": "application/json, text/event-stream"
  }
}

Your webhook verifies the ticket, replaces ${TOKEN} with the stored PAT, calls GitHub, and returns GitHub's response unchanged. Claude Code shows your GitHub login.

See it in Activity

Open Activity (/activity). The newest row is Allowed: claude-code, credential github, MCP server github/github, channel MCP tools. Click it for the drawer. Its footer reads Events hold metadata, never values.

Filter to this MCP server with /activity?server=github/github. Drawer rows include Who, MCP server or tool, Channel, Response and Event type.

Now try to read the value

claude-code holds MCP access, so reading the value must fail. On the agent's Connect tab, Reveal the agent key (the reveal is itself audited), then:

Terminal
$ 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."}}

Token Vault refused before it signed any ticket, so your webhook was never called. In the tvault CLI, logged in with that agent key, tvault get github prints:

denied: access to github allows tool calls only, not reading the value.
hint: add the value use: `tvault grant <agent> github=value`

Back in Activity, a Denied row says:

claude-code can use github through MCP but not read the value. Its access allows tool calls only. Reading the value needs the Value use.

Its fix button is Edit access: add Value. Leave it as it is: MCP-only is the point.

What just happened

Every hop, and who saw the PAT:

#HopWhat movedSaw the PAT
1Browser → Token Vault POST /api/vault/store-ticket{"serviceName":"github"}No
2Token Vault → browser{"ticket":"…","webhookUrl":"…","expiresIn":60}No
3Browser → webhook POST /v1/storeticket + tokenData.accessTokenWebhook only (encrypted at rest by the reference webhook)
4Browser → Token Vault PUT /api/tokens/github/mcp-serversMCP server URL + Authorization: Bearer ${TOKEN} (a template, not a value)No
5Claude Code ↔ Token Vault, OAuthtvsess_… session for claude-codeNo
6Claude Code → Token Vault POST /api/mcp/github/githubJSON-RPC tools/callNo
7Token Vault → webhook POST /v1/proxyTicket + body + header templatesNo
8Webhook → GitHub MCPAuthorization: Bearer ghp_…Webhook and GitHub
9GitHub → webhook → Token Vault → Claude CodeTool resultNo. Token Vault relays the result and does not log it
10Agent key → Token Vault GET /api/agents/credentialsRefused: 403 GRANT_TOOLS_ONLYNo ticket was signed

Token Vault saw names, URLs, templates, tickets it signed and metadata. The token itself only went browser → webhook and webhook → GitHub. Diagrams for every path: How it works.

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