Overview
@agentvault/mcp is a Model Context Protocol
server. It exposes the Agent Vault proxied browser as tools, so any MCP-capable
agent can fill checkout and sign-in forms with
mock tokens while the proxy types the real values.
There are two ways to connect:
- Hosted MCP server, if your deployment runs one: your MCP client connects to a remote server over streamable HTTP. You sign in once in your browser, then choose on the dashboard’s Connected apps page which cards and logins the connection may use. Nothing to install, no API key to copy. See Connect to the hosted server.
- Local MCP server: your MCP client launches
@agentvault/mcpon your machine, with your API key in its environment. Setup starts at Before you start.
@agentvault/playwright call, so it has the same proxy
protocol, URL locking and tunnel behaviour. It reads the same environment
variables the SDK reads, plus one optional network setting of its own
(AGENTVAULT_NETWORK_FAMILY_AUTOSELECTION, below) that you rarely need.
Connect to the hosted server
This section applies only when your dashboard’s framework picker shows a Sign in route. If it does not, your deployment has no hosted server: use the local setup below.1
Paste the line into your agent
Copy the line under Sign in and paste it into your agent:The agent reads the connect skill, adds the server and asks you to sign in.
2
Or add the server by hand
The hosted MCP server is at
https://mcp.agentvault.io/mcp. Self-hosting? Use
the URL under Set it up by hand in the framework picker instead.The Claude Code command is the one the dashboard gives. It has no
--scope
flag, so Claude Code adds the server only for the project you run it in. To use
it in every project, add --scope user after --transport http.Sign-in opens the Agent Vault sign-in page in your browser. Sign in with your
Agent Vault account.3
Make a first call
Ask your agent to call Your deployment may add a link after that sentence. Until you choose access,
every tool that uses your account answers this way. Only
get_token_catalog. Codex keeps the MCP servers it
started with, so start a new Codex session first if you added the server from
inside a running one.The first call after a new sign-in is expected to fail. The call creates the
connection with nothing granted yet, and the tool answers:get_checkout_recipes, which reads the public recipe registry, works before
then. The refusal’s code is access_not_chosen, but the agent sees only the
message.4
Choose what it may use
In the dashboard sidebar, under Vault, click Connected apps. Find the
new connection’s row: its Access column reads Choose what it may use.
Click the Choose access button on that row.In the What this app may use dialog:
- Under Cards, pick All cards, or keep Only selected and tick the cards it may use.
- Under Logins, pick All logins, or keep Only selected and tick the logins it may use.
- Tick Let this app create and change its own logins only if the agent should sign you up for new accounts.
- Tick Ask me before every purchase from this app if you want to approve each of its purchases yourself.
- Tick Fill a test card instead of my card if this connection only tests checkouts.
- Click Save access.
5
Check it works
Ask your agent to call
get_token_catalog again. It now returns mock tokens for
the cards and logins you allowed.Your sign-in does not last forever. When the access token expires or is
refused, the server answers HTTP 401 with error="invalid_token" before any
tool runs, so the agent gets no tool error to act on. Your MCP client may refresh
the token by itself. If it cannot, the server appears in your client as needing
sign-in and its tools fail until you sign in again. Retrying the tool does not
help. See
Sign-in responses.A new sign-in can create a new connection, which again starts with nothing
granted. If the agent gets the error above after you sign in again, choose
access for the new row on Connected apps.The hosted server has the same tools as the local one, and each takes one more
argument, session. The call that starts a session, such as open_page or
get_token_catalog, returns a session handle, and your agent passes it on every
later call so they reach the same browser. See
On the hosted server.A hosted session closes after 13 minutes without a call to its browser, or 56
minutes after its browser opened. The hosted server waits up to 4 minutes for a
tool call’s answer (12 for request_challenge_handoff, which waits for the
account holder). After that wait, the server reports the outcome as unknown.
The call is not cancelled and may still complete. Check the page before
repeating a click or any other action. A restart of the hosted server ends every
session.A connection can hold at most 50 live credentials at once. Each open session
holds one. The recipe submission tools hold one while they run. A credential
request that timed out keeps its credential, with no session owning it, for up
to 75 minutes. So you can hit the limit with fewer than 50 open sessions, and
closing sessions may not free it. See
Limits.6
Review, change or revoke it later
Each sign-in is listed on Connected apps with three details: what it may
use, when it was last used, and a Revoked if unused by date.
- To change what it may use, click Change access on its row, change the settings and click Save access. The app’s next call uses them.
- To stop it for good, click Revoke on its row, then Revoke connection.
This cannot be undone: to reconnect, sign in again and choose access for the
new connection. After revoking, the app cannot get a new credential or fill a
saved value. Any browser session it has open closes within about a minute. A call that needs a new credential is
refused with
connection_revoked. A call on a session that is already open may still run briefly (for example a click) and then fails because the session closed, so do not wait forconnection_revokedspecifically.
Before you start
For the local server you need the items below. The hosted server needs none of them: only an MCP client that supports remote servers over streamable HTTP with OAuth.- An API key. Create one on the dashboard’s API keys page with New key. See API keys.
- Node.js with
npxon yourPATH. Your MCP client runs the server throughnpx. npm 12 refuses to fetch a package from a URL unless--allow-remote=allcomes before the URL, so every command below includes it. npm 11 accepts it with an “Unknown cli config” warning. - Only on a self-hosted Agent Vault: your deployment’s origin, as your
dashboard’s address bar shows it, in place of
https://app.agentvault.iobelow.
The install URL
The package is not on npm. It is a self-contained tarball (server, SDK and their dependencies) that Agent Vault hosts at:The config blocks below point at the hosted service at
app.agentvault.io. If
you change only the install URL, your key is sent to the hosted proxy and API,
which do not recognise it. Self-hosting? Copy the whole block from the framework
picker on your dashboard’s Overview page instead. It fills in your
deployment’s install URL, proxy URL and API URL.Add the server to your MCP client
Pick your MCP client. Each block uses the same server definition; only the file and its format differ.- Claude Code
- Claude Desktop
- Cursor
- Codex
- Other MCP clients
1
Add the server
Add the Or use the CLI.
agent-vault entry to the mcpServers object in your user-level
~/.claude.json, merged with any servers already there:~/.claude.json
claude mcp add-json takes only the inner server object, not
the whole mcpServers document. Keep --scope user: without it, Claude Code
adds the server only for the project you run the command in. The dashboard’s
command has no --scope flag, so add it yourself.2
Allow the tools
Claude Code asks before each MCP tool call unless a permission rule allows it.
If a call is refused mid-run, the agent can leave a form half filled or a
session open. Allow the server once in
~/.claude/settings.json (or an uncommitted .claude/settings.local.json),
merged with any rules already there:~/.claude/settings.json
mcp__agent-vault matches only this server’s tools. It does not loosen anything
for other servers or for shell commands.3
Restart Claude Code
Restart so Claude Code picks up the new server and the permission rule.
Configuration
The server reads the same environment variables as the SDK, plusAGENTVAULT_NETWORK_FAMILY_AUTOSELECTION, which only the MCP server reads. Set
them in the env block of your MCP client’s config.
string
required
The agent’s API key, from the dashboard. Used for the proxy session and the
token catalog.
string
required
The proxy WebSocket URL. Use
wss://proxy.agentvault.io/v1 for the hosted
service, or your deployment’s proxy URL. If unset, the server tries a local
development proxy at ws://localhost:4000/v1 and fails with
Failed to connect to proxy when none is running.string
required
The token catalog API base,
https://api.agentvault.io on the
hosted service.string
Controls whether the browser’s traffic leaves from your own IP address
through a tunnel.
- Unset (default): use the tunnel if available; otherwise leave from the deployment’s own egress (the proxy’s address, or its residential egress where configured).
1: require the tunnel. The browser refuses to launch without it.0: never use the tunnel.
string
Set to
1 to require residential egress without a tunnel through your
machine. The first open_page then fails with egress_unavailable when the
deployment has none or its provider is not answering, instead of leaving from
the proxy’s address. A residential egress session is HTTPS only. See
Residential egress.string
MCP server only. Set to
1 to let Node pick between IPv4 and IPv6 by racing
both (Node’s default). Leave unset to connect to one address per hostname,
which avoids silent fetch failed errors on networks with a broken IPv6 path.Verify the connection
1
Fetch the token catalog
Ask your agent to call
get_token_catalog. It needs no browser and no open
page. A successful call returns your mock tokens: identity, addresses, cards and
logins.2
Run a test checkout
On API keys, tick Fill a test
card instead of my card on the key in your config, or create a separate key
with it ticked. A change to an existing key applies from the agent’s next
session.Then ask your agent to check out at
https://app.agentvault.io/demo-checkout,
or your own origin plus /demo-checkout if self-hosted. It should call
open_page, fill the card with a mock token through fill_checkout, submit,
and confirm with get_session_outcome. The fill_checkout reply carries a
card_fields_verified note when the test card went in. If it does not, stop
before submitting.If it fails
The server did not start
The server did not start
The install URL is almost always the cause. Look in your MCP client’s server
log for a 404 or a DNS failure. In Claude Code,
claude mcp list shows each
server’s status.Failed to connect to proxy
Failed to connect to proxy
SELF_AGENT_PAY_PROXY_URL is unset, wrong, or the proxy is unreachable.
Check that the proxy is reachable: open https://proxy.agentvault.io/health
(on a self-hosted deployment, use your proxy’s hostname, with https:// in
place of wss://). It returns {"ok":true,...}.Every request fails with fetch failed
Every request fails with fetch failed
The server already avoids the most common cause, an IPv6 path that neither
connects nor refuses. If you set
AGENTVAULT_NETWORK_FAMILY_AUTOSELECTION=1,
unset it and restart your MCP client.rate_limited on the catalog
rate_limited on the catalog
The catalog is rate-limited per key and per account (all keys of an account
share the account limit). The limits depend on the plan. The response
includes
Retry-After in seconds. Wait that long: the window is fixed, so
retrying early is refused again.A page tool says to call open_page first
A page tool says to call open_page first
Page tools need a browser. Call
open_page with a URL before click,
fill_checkout or any other page tool.Add the agent skill
The tools give your agent the capability. The skill gives it the judgement: when to hand a step to the account holder, why it must never invent a password, and what order to fill card fields in. Install both. See Rules of engagement.Next steps
Tool reference
All 29 tools, their parameters and what they return.
Rules of engagement
The rules your agent is expected to follow.
Error codes
What each refusal means and whether to retry.
First checkout
Walk through a full checkout end to end.