docs

Set Up VaultKit with a Coding Agent

A coding agent (Claude Code, Cursor or another) can set VaultKit up for you. It installs vkit, connects your database, installs and deploys policies, and configures VaultKit’s MCP server so it can query your data through VaultKit. It never sees your database password or the agent token.

Start from the console

The easiest way to start is from your VaultKit console (control plane 0.14.0-alpha or later):

  1. Sign in to the console as an admin and open Overview.
  2. In the Set up with your agent card, click Copy prompt.
  3. Open your agent in the project you want it to query from, and paste the prompt.

The prompt names your control plane, so the agent connects to the right one even if vkit was used with another control plane before:

Set up VaultKit for this project by following https://docs.vaultkit.io/setup.md. Control plane: https://vaultkit.example.com

The card shows until your organization has a datasource and an active policy bundle. After that, Overview has a smaller Set up again with your agent link that opens the same card. Members don’t see either.

Start without the console

Paste this into your agent, in the project you want it to query from:

Set up VaultKit for this project by following https://docs.vaultkit.io/setup.md

The agent asks for your control plane URL, or, if vkit already has one saved, checks with you that it’s the right one before it connects. You can also add Control plane: <URL> to the end of the prompt yourself. The URL is usually the address you open the VaultKit console at.

How it works

setup.md is written for the agent: a checklist, the exact commands, what their --format json output looks like, and what to do for each error. It’s served as plain markdown so an agent can read it as it is.


What you need

What you’ll be asked to do

The agent does the setup. A few steps are yours, and it stops and asks at each one:

  1. Approve a setup session. The agent runs vkit login --setup and shows you a code and a link. Open the link signed in as an admin, check that the code matches, and approve it.
    • This gives the agent a token that lasts 30 minutes and can only set VaultKit up: add datasources, scan schemas and deploy policies. It can’t query data, approve requests or create tokens.
    • Its calls show in Activity as “agent setup on behalf of” you.
    • If your organization is already set up, the page has a box: “Allow this session to replace existing policies and datasources”. Leave it unticked unless you want the agent to change what’s deployed.
  2. Give the database details: host, port, database name, the read-only username, region and environment. None of these are secret.
  3. Type the database password yourself. The agent writes out a vkit datasource add … --password-prompt command for you to run in your own terminal. The password goes from your keyboard to VaultKit.
  4. Choose policy packs. starter is always installed. The agent explains ai_safety and financial_compliance, and you decide.
  5. Review the classifications. The agent shows you a table of columns that VaultKit couldn’t classify, or that hold personal, financial or credential data. It changes only the labels you ask it to. Columns nobody has reviewed stay masked for agents until someone does.
  6. Create the agent token on the console’s Agents page: click Create agent token, give it the name the agent suggests, and pick an expiry. Set a tenant under Advanced if the dialog asks for one. The dialog shows the token once, with three export lines (VAULTKIT_TOKEN, VAULTKIT_BASE_URL, VAULTKIT_ORG) to put in your shell profile or secret manager.
    • Never put it in a .env file in the repository, never paste it into the agent’s chat, and never put it in VKIT_TOKEN: the vkit CLI reads that, so vkit itself would act as the agent.
    • On an older control plane without that button, you create it with vkit agents tokens create in your own terminal instead, sign out with vkit logout, and approve a second setup session. The agent walks you through it.
  7. Restart the agent from a new terminal, so it picks up the variables and the MCP server, and paste the prompt again. It carries on where it stopped.

When it’s done

Setup is done when vkit doctor reports no failures. Two things are normal to see:

The agent finishes by telling you what it set up and running one safe query, such as a count grouped by a column that isn’t sensitive.

You end up with:

If something goes wrong

See also: CLI reference, MCP Usage Guide, Schema Discovery, Policy Packs.