MCP servers
Attach MCP servers to a credential so agents call their tools through your webhook, which injects the credential, and never see the value.
A credential can carry up to 5 MCP servers. An agent with MCP access calls an MCP server's tools through Token Vault. Your webhook puts the credential into the upstream request. The agent never receives the value.
MCP tools need a single value, so the web app offers MCP servers only for Plain text and OAuth (access + refresh) credentials. The API refuses Multi-field credentials outright. Do not attach MCP servers to SSH, certificate, TOTP or raw credentials: the webhook has no single value to inject.
Running your own MCP server that only needs to know which agent is calling? Use Token Vault sign-in. It stores no value and uses ${AGENT_SESSION} instead of ${TOKEN}.
Attach an MCP server
In Add credential, the MCP servers row offers:
- A preset MCP server for the chosen preset, ticked by default.
- Custom URL: a name, an upstream URL and header templates. The default header is
Authorization: Bearer ${TOKEN}.
With no preset, the row reads "No preset MCP server for this kind. Agents can then read the value, or you add a custom URL."
Presets
| Preset | Upstream URL |
|---|---|
github | https://api.githubcopilot.com/mcp/ |
linear | https://mcp.linear.app/mcp |
sentry | https://mcp.sentry.dev/mcp |
Each preset sets Authorization: Bearer ${TOKEN} and Accept: application/json, text/event-stream.
Rules
| Field | Rule |
|---|---|
| MCP server name | ^[a-z0-9][a-z0-9_-]{0,31}$, unique on the credential. Error MCP_SERVER_NAME_INVALID or MCP_SERVER_NAME_DUPLICATE. |
| Count | Max 5 per credential (MCP_SERVERS_CAP). |
| URL | https URL that passes the server-side address check. |
| Credential name | Must be URL-safe (it appears in the MCP server URL). Otherwise SERVICE_NOT_HOSTABLE. |
| Who may change it | Anyone with tokens:update. Adding an MCP server or re-pointing its URL or headers also needs a recent sign-in (person), or credentials:read plus the key's or agent's own live Value grant. Other edits do not. |
| Stored URL | A trailing / is stripped, so https://api.githubcopilot.com/mcp/ is stored as https://api.githubcopilot.com/mcp. |
${TOKEN} header templates
Token Vault stores header templates. The literal text ${TOKEN} marks where the credential goes. The webhook substitutes it at call time.
{
"name": "github",
"url": "https://api.githubcopilot.com/mcp",
"headers": {
"Authorization": "Bearer ${TOKEN}",
"Accept": "application/json, text/event-stream"
},
"template": "github"
}A header whose name looks like a credential (it contains auth, cookie, token, secret, key, passw, credential, signature or session) must be the ${TOKEN} placeholder. A literal secret there is rejected with MCP_SERVER_LITERAL_CREDENTIAL. Neutral headers such as Accept can be literal.
Tool lists
After you save an MCP server, Token Vault fetches its tools/list through your webhook in the background, and caches the result. The MCP servers tab shows one of:
| State | Meaning |
|---|---|
12 tools (or 12+ tools) | Fetched. + means the cache hit a bound. |
Not fetched yet | Waiting for the first fetch. |
Fetch failed | With a reason, for example "Your webhook could not be reached." |
| "Fetched for an earlier URL or headers; refetch to update." | You changed the MCP server after the last fetch. |
Press Refetch tools (or POST /api/tokens/{service}/mcp-servers/{name}/schema) to update. A second refetch within 10 seconds answers 429. The cache holds at most 5 pages, 256 tools and 256 KiB of tool JSON per MCP server.
The MCP server URL
Every MCP server has its own URL. Point an MCP client at it:
https://api.tokenvault.uk/api/mcp/{service}/{server}The Agent URL on the MCP servers tab copies it. Clients sign in with OAuth (hosted clients and IDEs) or send the agent key. The URL is its own protected resource. A 401 carries a challenge naming this MCP server:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://api.tokenvault.uk/.well-known/oauth-protected-resource/api/mcp/github/github"A session issued for one MCP server is refused on another. The agent needs the mcp:use scope, never credentials:read.
Where your Token Vault has it enabled, one URL (/api/agents/mcp) serves Token Vault's own tools plus the tools of every MCP server an agent holds MCP access on. The MCP server URL works everywhere. See MCP endpoint.
One tool call, hop by hop
The request an agent sends:
POST /api/mcp/github/github HTTP/1.1
Host: api.tokenvault.uk
Authorization: Bearer tvagent_...
Content-Type: application/json
Accept: application/json, text/event-stream
Mcp-Session-Id: 3f1a9c
{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"get_me","arguments":{}}}What Token Vault forwards to your webhook (signed with the webhook's HMAC secret, 60 second one-shot ticket, no credential in it):
{
"ticket": "eyJzdWIiOi...<elided>.9c1f...",
"service": "github",
"upstream": {
"url": "https://api.githubcopilot.com/mcp",
"method": "POST",
"headers": { "Content-Type": "application/json" },
"body": "eyJqc29ucnBjIjoiMi4wIiwi...<base64 of the JSON-RPC body>"
},
"headerTemplates": { "Authorization": "Bearer ${TOKEN}" },
"requestId": "req_3b1f9a02c4d1"
}The agent receives the upstream's answer unchanged:
{"jsonrpc":"2.0","id":7,"result":{"content":[{"type":"text","text":"{\"login\":\"octocat\"}"}]}}| Hop | Sees the credential? | Sees the tool call and result? |
|---|---|---|
| Agent | No | Yes |
| Token Vault | No | Passes them through. It does not log them. |
| Your webhook | Yes (it is the custodian) | Passes them through |
| Upstream MCP server | Yes (the Authorization header) | Yes |
When it is refused
| Situation | Response |
|---|---|
| No grant for the credential | NO_GRANT |
| Grant expired | GRANT_EXPIRED |
| Grant is Value only | GRANT_NOT_FOR_TOOLS |
| Grant limited to other MCP servers | SERVER_NOT_GRANTED |
| MCP server not on the credential | 404 SERVER_NOT_FOUND |
| Session is identity-only | 403 IDENTITY_ONLY_SESSION |
| Rate limit | JSON-RPC error -32029, or 429 with Retry-After |
| Policy denial | POLICY_DENIED (see Denials) |
| Webhook down | WEBHOOK_UNAVAILABLE, or WEBHOOK_CIRCUIT_OPEN after repeated failures |
MCP-only access
Give an agent MCP access on a credential and it can call the credential's MCP servers but cannot read the value. A request for the value is refused:
GET /api/agents/credentials?service=github HTTP/1.1
Authorization: Bearer tvagent_...
HTTP/1.1 403 Forbidden
{"detail":{"code":"GRANT_TOOLS_ONLY","message":"This grant does not allow reading the credential value; it can only be used through MCP access."}}A grant can also name MCP servers: the agent then reaches only those. Absent means every MCP server. MCP grants default to never expiring. See Give an agent access.
tvault grant claude-code github=mcp:githubPolicies on an MCP server
Attach a policy to a single MCP server with entity type mcp_server and id {service}:{server} (for example github:github). In the app, open the MCP servers tab and press Add policy, or find it on the Limits tab. The policy applies to calls through that MCP server only, on top of policies on the agent, the credential and its labels. See Policies.
Calls through MCP servers appear in Activity with the channel MCP tools.
Hosted clients
Claude.ai, ChatGPT and Gemini take a plain URL and cannot set a header, so they sign in with OAuth. Paste the MCP server URL as a custom connector. The client finds Token Vault's sign-in from the URL, you pick an agent and press Authorize. No key is pasted anywhere.
Per-app steps are on Connect your apps. The sign-in flow is on OAuth for MCP clients.
If sign-in stops with "Redirect host <host> is not trusted", add the client's host under Settings, Trusted hosts (https://tokenvault.uk/settings/trusted-hosts).
| Client | Redirect host to trust |
|---|---|
| Claude.ai, Claude Desktop | claude.ai |
| ChatGPT | chatgpt.com |
| Gemini | oauth-redirect.googleusercontent.com |
The MCP server must be covered by an MCP grant on the agent you pick. Suspend the agent or revoke the grant, and the connector stops at its next call.
Next steps
Give an agent access
MCP server endpoint
MCP servers API
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.
Add a credential
Store a credential on your webhook from one page, attach MCP servers, label it and give apps access, then rotate, delete and watch its health.
Token Vault sign-in
Let an MCP server you run accept Token Vault as its sign-in. It stores no value. Each calling agent gets a 15-minute identity pass that only that MCP server accepts.