vault-mcp
Provides a credential preset for Cloudflare API tokens and keys, enabling agents to inject them into environments without revealing the secret values.
Provides a credential preset for Firebase service accounts and API keys, including placeholder-based injection into configuration files.
Provides a credential preset for GitHub tokens and API keys, allowing safe injection into .env files without exposing the values.
Provides a credential preset for Google Maps API keys, letting agents write the key into environment files while only seeing metadata.
Provides a credential preset for OpenAI API keys, enabling secure storage and injection into environment files without exposing the key.
Provides a credential preset for Resend API keys, allowing agents to inject them into .env files without revealing the secret.
Provides a credential preset for SendGrid API keys, enabling secure injection into environment files without exposing the value.
Provides a credential preset for Stripe secret keys, publishable keys, and webhook secrets, allowing agents to inject them into .env files while never seeing the values.
Provides a credential preset for Supabase API keys and credentials, enabling secure storage and injection into environment files.
Provides a credential preset for Twilio credentials, allowing agents to inject account keys and tokens into environments without exposing them.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
vault-mcp
A personal secrets vault for AI coding agents. Your agent uses your API keys without ever seeing them.
You: "Add a map to the dashboard showing user locations."
Agent: [vault_search "google maps"] -> [vault_inject_env] -> sets NEXT_PUBLIC_GOOGLE_MAPS_API_KEY in .env
Agent: "I set NEXT_PUBLIC_GOOGLE_MAPS_API_KEY in .env and wired up the map component."Store a key once. When the agent needs it, the agent searches the vault, reads the metadata, and writes the value
straight into your .env, a config file, a command's environment or a remote server. The value goes to disk. The
conversation only ever sees the variable name.
Works with Claude Code, Claude Desktop, Cursor, Windsurf, Antigravity, VS Code (Copilot) and Zed, and with any other client that speaks MCP over stdio.
License: MIT · Node 20+ · Install from GitHub (not yet published to npm)
Contents
Related MCP server: envguard
Features
The agent never sees values. All 29 MCP tools return metadata and status only. A test drives every tool and scans each response for known plaintexts, including base64 and URL-encoded copies.
The agent stops asking you for keys. It searches the vault first and injects what it finds.
Four injection targets. A local
.env, any config file through{{vault:path}}placeholders, a command's environment with output redacted, or a remote server's env file over SSH.Groups, accounts and projects.
stripe/acmeandstripe/personalstay apart. A project holds its own keys and links to shared ones, so one call sets up a whole.env.Copy and move. Copy a key into another project, or move and rename it. Projects linked to a moved key follow it.
15 service presets. Stripe, Google Maps, OpenAI, Anthropic, AWS, Cloudflare, Supabase, Database URL, Twilio, Resend, SendGrid, Firebase, GitHub, SSH server, and a generic catch-all.
Encrypted at rest, nothing to remember. AES-256-GCM, with the master key in the macOS Keychain, Windows Credential Manager or libsecret.
Access code. Locks the web dashboard and guards keys marked protected. Protected keys unlock for 15 minutes.
Local web dashboard.
Home grid of credential groups, with search and filters by scope, environment and sort order.
Projects in the sidebar (up to 5, plus "view all"), and a page per project showing its linked and independent keys.
Reveal or copy a value, add credentials from presets, copy or move keys between projects.
Backups, activity log, and a visible timer for the 15-minute protected unlock.
Brand icons for known services.
Backups. Local snapshots to undo mistakes, and portable passphrase-sealed backups to move machines.
Guard rails. Refuses to write a key into a git-tracked file. Warns when a server-only key is headed for a browser variable. Logs every read and injection, never the value.
Requirements
Node.js 20 or later.
An OS keychain: macOS Keychain, Windows Credential Manager, or libsecret on Linux. No keychain (headless server, CI, some Linux setups)? Set
VAULT_MASTER_PASSWORDand the master key is derived from it instead.An MCP client (see the table under Register with your client).
Quick start
1. Install
git clone https://github.com/MHasnainJafri/vault-mcp.gitcd vault-mcpnpm installnpm run buildnpm linknpm link makes the vault command available everywhere. Without it, run node dist/cli.js from the repository
folder wherever this README says vault.
2. Create the vault and set an access code
vault initvault set-pinvault init creates ~/.vault-mcp and stores a random master key in your OS keychain. vault set-pin sets a
4–12 digit access code. You type it yourself; the agent never needs it unless you hand it over for a protected key.
Prefer a guided first run? vault setup does init, your first key and client registration in one go.
3. Register with your client
vault installWith no options it lists the clients it knows and marks the ones it found on this machine. Then:
vault install --client cursorClient |
| Where it writes |
Claude Code |
| Prints |
Claude Desktop |
| macOS |
Cursor |
|
|
Windsurf |
|
|
Antigravity (IDE and CLI) |
|
|
VS Code (Copilot) |
|
|
Zed |
| Use |
Other options: --all (every client detected), --project (project-level config), --config <path> (a specific
file), --print (show the JSON only).
The config is merged into what is already there. The original is copied to <config>.vault-backup first, so no
other server or setting is touched.
Any other MCP client takes the standard block:
{
"mcpServers": {
"vault": { "command": "node", "args": ["/absolute/path/to/vault-mcp/dist/cli.js", "serve"] }
}
}VS Code calls the top-level key servers instead of mcpServers.
4. Restart your client
A newly registered server appears the next time the client starts. Its tools show up as vault_*.
5. Add your first key
vault add openai/personal/api_key --env OPENAI_API_KEYPaste the key at the hidden prompt. Then ask your agent to use OpenAI in a project, and it will find the key and inject it.
Adding keys
Paths are group/account/field, for example stripe/acme/secret_key. Containers are created as needed.
Hidden prompt (recommended for live keys). The value is never in your shell history or a chat window.
vault add openai/personal/api_key --env OPENAI_API_KEY --tags ai --notes "server only"Inline value. Quick, but the value lands in your shell history. Fine for test keys. The command reminds you.
vault add openai/personal/api_key sk-test-123A whole service from a preset. Give the account path without a field and it walks every field the service needs.
vault add stripe/acmeThis asks for secret_key, publishable_key and webhook_secret, with the right env var names and usage notes.
Run vault presets to see all 15.
From stdin or the clipboard. Good for multi-line values such as PEM keys.
cat key.pem | vault add ssh/prod/private_key --stdinpbpaste | vault add github/personal/token --stdinImport a file you already have. A .env, or a JSON object of named fields.
vault import ./my-app/.env --to projects/my-appvault import ./server.json --to vps/my-serverEach variable or field becomes its own key. Nested JSON is flattened ({"db":{"user":"root"}} becomes db/user),
and arrays are kept whole. Add --overwrite to replace keys that already exist.
The web dashboard. Run vault ui and add a credential from a preset, by hand, or by pasting a file.
From inside your AI chat. Tell the agent "I need to add a key to the vault". There are three routes:
Route | What happens | Use it for |
Terminal command | The agent gives you a | Any key. The agent never sees it |
| Your browser opens the dashboard behind your access code; you type the key there | Production keys. The agent is not given the page's token |
| You paste the value in chat and the agent stores it | Test keys only. The value stays in the transcript, so rotate anything live |
Useful flags on vault add: --env, --tags, --notes, --description, --environment
(development | staging | production | any), --protected, --expires <iso-date>, --stdin.
Organizing keys
stripe/
acme/ secret_key, publishable_key, webhook_secret
personal/ secret_key
google-maps/
default/ api_key
projects/
my-shop/ database_url <- the project's own key
+ linked: stripe/acme/secret_keyLink a shared key into a project instead of copying it. The optional --env renames it for that project only.
vault link projects/my-shop stripe/acme/secret_keyvault link projects/my-shop stripe/acme/secret_key --env PAYMENTS_KEYCopy a key into a project (it keeps its name) or to a new path:
vault cp stripe/acme/secret_key projects/my-shopvault cp openai/team/api_key projects/chatbot/llm_key --env LLM_KEYMove or rename a key. Projects linked to it follow it to the new path.
vault mv projects/old-app/database_url projects/new-appBoth refuse to replace a key that already exists unless you pass --overwrite. Protected keys stay protected, and
the CLI asks for your access code before copying or moving one.
Write a project's keys into a .env:
vault inject --project projects/my-shop --file .envUsing keys from the agent
The agent searches first (vault_search), then picks one of four targets. Each returns only variable names and a
status.
1. A .env file — vault_inject_env. Keeps existing lines, comments and order. Refuses a git-tracked file.
vault_inject_env { projectPath: "projects/my-shop", envFile: ".env" }2. Any config file — vault_render_file fills {{vault:path}} placeholders. Transforms: |base64, |json,
|uri.
# docker-compose.yml
environment:
STRIPE_KEY: "{{vault:stripe/acme/secret_key}}"
SA_JSON: "{{vault:firebase/prod/service_account|base64}}"3. A command's environment — vault_run. Nothing is written to disk. Every occurrence of the value, plain,
base64 or URL-encoded, is stripped from the output the agent sees.
vault_run {
command: "npx",
args: ["wrangler", "secret", "put", "STRIPE_KEY"],
secrets: [{ path: "stripe/acme/secret_key", varName: "STRIPE_KEY" }],
stdinSecret: "stripe/acme/secret_key"
}4. A remote server — vault_ssh_inject upserts keys into a remote env file over SSH and sets it to chmod 600.
The SSH credentials come from the vault too: store them first with vault add ssh/<name>.
vault_ssh_inject { serverPath: "ssh/prod", remoteFile: "/srv/app/.env", projectPath: "projects/my-shop" }Example prompts
You do not need to name tools. Ask in plain words and the agent picks them.
You say | What the agent does |
"Add Stripe payments to this app." |
|
"Set up the .env for my-shop." |
|
"Which keys is this project missing?" |
|
"Make a .env.example I can commit." |
|
"Deploy the Stripe key to Cloudflare." |
|
"Put the database URL on the prod server." |
|
"I need to add my OpenAI key." | Opens the dashboard with |
"What did you do with my keys today?" |
|
If a key is not in the vault, the agent says so and lets you choose how to add it. For live keys it is told to prefer the dashboard, so the value never enters the chat.
Web dashboard
vault uiIt opens http://127.0.0.1:5177/?token=… in your browser.
Loopback only. It never listens on the network.
Token. A one-time token is generated at startup and required on every request.
Access code. If you set one, the page asks for it before showing anything. Five wrong tries lock it for ten minutes. A session lasts one hour.
What you can do there:
Browse every credential group, with search and filters by scope, environment and sort order.
Open a project to see its linked keys and its own (independent) keys.
Reveal or copy a value, one key at a time. Every reveal is logged.
Add credentials from a preset, by hand, or by importing a
.envor JSON.Edit metadata, copy or move a key to another project, link and unlink, delete.
Create and restore backups, including portable ones with a passphrase that never leaves the page.
Read the activity log.
See how long the protected tier stays unlocked, and lock it again.
A tour of the dashboard
Sidebar. Home, Backups and Activity; up to five projects (most recently used first) with a + to create one and
View all for the rest; then every service you have keys for, with its logo. The badge next to the name shows how
many minutes protected keys stay unlocked. Click it to lock them now, or to unlock when it says Locked.
Home. One card per credential group, for example Stripe · acme or SSH Server · prod-web. Each card shows its
path, the project that uses it (or Shared for keys under shared/), how many keys it holds, the environment, a
PIN mark for protected keys and when it was last used.
All Scope narrows to keys used by a project, standalone services, or shared keys.
Search matches service, path, key name, env var name, tag and description. Press
⌘K(orCtrl+K) to jump to it.Env and Sort filter by environment and order by last used, last added, name or number of keys.
+ Add Credential opens a picker of the 15 services, plus Custom key and Import .env / JSON.
Project page. Click View keys on a card or a project in the sidebar.
Linked & grouped credentials: shared keys the project links to, and groups stored inside the project.
Independent keys: keys that belong to this project alone.
Each row shows a masked value (
sk_live_••••9Xq). Reveal shows it, Copy puts it on your clipboard. Public values such as publishable keys are shown in full and marked Public. PEM keys and JSON files show their size and open in a viewer.The
⋯menu on a row: edit details, copy or move, use in another project, copy the env var name or path, remove from the project, delete.+ Add to Project: link existing keys, copy one in, add a service, add a single key, or import a
.env.
Backups. Create a portable backup (downloads to your browser), take a local snapshot, restore from a file, or restore any backup listed for this machine. A Replace restore asks for confirmation first.
Activity. The latest 50 events: what happened, who did it (AI agent, terminal or dashboard), which keys, where they went, and whether it worked.
Options: --port <port> (default 5177), --no-open. If an agent started the dashboard for you, vault ui-url
prints its link and vault ui-stop stops it.
Tools reference
The server registers as vault, so its tools appear as vault_*. Full parameters are in TOOLS.md.
Area | Tool | What it does |
Find |
| Fuzzy search by service, purpose, env var name or tag. Metadata only |
Find |
| Browse the tree of groups, accounts and projects |
Find |
| One key in full; optional heavily masked preview ( |
Find |
| Everything a project needs, with the env var name for each |
Find |
| The 15 service templates and their fields |
Find |
| Counts, and whether the access code is set or unlocked |
Find |
| Recent activity: which key went where |
Use |
| Write keys into a |
Use |
| Fill |
Use |
| Run a command with keys in its environment, output redacted |
Use |
| Write keys into a remote server's env file over SSH |
Use |
| Compare a |
Use |
| Generate a committable |
Use |
| Check a secrets file is git-ignored; optionally fix it |
Organize |
| Open the dashboard so you type a key in yourself |
Organize |
| Store a value you gave in chat (it stays in the transcript) |
Organize |
| Import a |
Organize |
| Change env var name, notes, tags, environment, sensitivity or expiry |
Organize |
| Create a group, account or project |
Organize |
| Let a project use a shared key without copying it |
Organize |
| Remove a key or a container; needs |
Organize |
| Unlock protected keys for 15 minutes, or lock again |
Backups |
| Encrypted local snapshot, sealed with this machine's key |
Backups |
| List backups from their headers, without decrypting |
Backups |
| Inspect one backup file |
Backups |
| Restore a local backup (merge or replace); safety snapshot first |
Backups |
| Delete a backup file |
Plus one resource, vault://catalog: every key's metadata in a single JSON document.
CLI reference
Command | What it does |
| Create the vault and its master key |
| Guided first run: init, first key, register with a client |
| Add a key (hidden prompt, or inline value) or a whole preset |
| List what is stored ( |
| One key's metadata ( |
| Print a value to stdout, for piping |
| Delete ( |
| Import a |
| Link a shared key into a project ( |
| Copy a key to another path or project ( |
| Move or rename a key; linked projects follow ( |
| Write keys into a local |
| Set the access code |
| Portable backup with a passphrase; |
| Restore a backup; |
| List backups on this machine |
| Older bundle format; superseded by backup/restore |
| Start the web dashboard ( |
| Link to, or stop, a dashboard an agent started |
| Run the MCP server over stdio (what your client launches) |
| Register with an MCP client |
| Vault health and where things live |
| Recent activity ( |
| List the service templates |
Security model
The vault is one AES-256-GCM encrypted file,
~/.vault-mcp/vault.enc.The master key lives in your OS keychain under the service name
vault-mcp. Another user account on the same machine cannot read it. Without a keychain, it is derived fromVAULT_MASTER_PASSWORD.Access code. 4–12 digits. It unlocks the dashboard and guards keys marked protected. Protected keys are sealed with a key derived from both the master key and the code, so they need both. The code unlocks them for 15 minutes; five wrong tries lock it for ten. The code is a second gate, not the main encryption: the keychain does the real work.
Rules the code enforces:
No MCP tool result contains a secret value. A test drives all 29 tools and scans every response for known plaintexts, including base64 and URL-encoded forms.
vault_runredacts injected values from command output.Writing a key into a git-tracked file, or an un-ignored file inside a repo, is refused unless you pass
force.addToGitignore: truefixes it properly instead.Nothing may be written inside
~/.vault-mcpitself.Every read and injection is appended to
~/.vault-mcp/audit.log: paths and destinations, never values.The dashboard is loopback-only, needs a startup token, and asks for the access code when one is set.
vault_open_uistarts the dashboard but is not given its token, so the agent cannot read the page it opened.Portable backups need a passphrase of 10+ characters, and no tool accepts a passphrase as an argument.
Backups
The whole vault in one encrypted file. Two kinds:
Sealed with | Restores on | Use it for | |
Local | This machine's master key | This machine only | Undoing a bad delete. Nothing to remember |
Portable | A passphrase you type (10+ characters) | Any machine | A drive, cloud storage, moving to a new computer |
vault backupvault backup --localvault backupsvault restore <file>vault restore <file> --replacemerge(the default) keeps what is in the vault and adds what is missing.--replacemakes the vault match the backup exactly.A restore always takes a safety snapshot first, so even
--replacecan be undone.The dashboard's Backups page creates a portable backup and hands it to your browser's downloads. The passphrase is typed in the page and never leaves it.
The agent can take local snapshots (
vault_backup) and does so before destructive steps. It cannot make or restore a portable backup, because that needs a passphrase.A backup is one file, not a zip: it reveals a date and a count, not your key names. It carries a checksum, so a damaged copy is refused rather than half-restored.
Lose the passphrase and the portable backup is gone. There is no recovery.
Configuration and file locations
Environment variable | Effect |
| Use a different vault directory (default |
| Derive the master key from this instead of the OS keychain |
What | Where |
MCP server name |
|
CLI command |
|
Vault directory |
|
Encrypted keys |
|
Backups |
|
Activity log |
|
Master key | OS keychain, service |
Dashboard |
|
Troubleshooting
The client does not show the vault_* tools. Restart the client completely. Check that the config file from
the client table contains a vault entry pointing at an existing dist/cli.js
(run npm run build if dist/ is missing). Some Cursor builds ignore the global file; use
vault install --client cursor --project.
"Vault is not initialized. Run vault init first." Run vault init. If you set VAULT_MCP_DIR, make sure the
client launches the server with the same value.
"No OS keychain available and VAULT_MASTER_PASSWORD is not set." Common on headless Linux and CI. Set
VAULT_MASTER_PASSWORD in the environment of both your shell and your MCP client, and keep it the same, or the
vault cannot be opened.
A protected key is refused as locked. Give the agent your access code so it can call vault_unlock; it stays
unlocked for 15 minutes. If no code is set yet, run vault set-pin first.
Lost the dashboard link an agent opened. Run vault ui-url. Run vault ui-stop to stop it.
Port 5177 is already in use. Start the dashboard on another port: vault ui --port 5178.
"Too many wrong codes." Five wrong access codes lock the dashboard for ten minutes. Wait it out.
zsh: command not found: vault. The command is only installed after npm link in the repository folder. Run it,
then open a new terminal tab (or run rehash in zsh). Until then, use node dist/cli.js from the repository folder.
The dashboard looks out of date after a pull. Run npm run build, stop the dashboard (Ctrl+C or
vault ui-stop) and start it again.
Updating and uninstalling
Update to the latest version. Your keys, backups and settings in ~/.vault-mcp are not touched.
git pullnpm installnpm run buildThen restart your MCP client so it loads the new server.
Uninstall. Remove the global command:
npm unlink -g vault-mcpRemove the vault entry from your client's config file (see the client table). A
copy of the original was saved as <config>.vault-backup when you ran vault install.
To delete your keys as well, first make a portable backup if you might want them again (vault backup), then delete
~/.vault-mcp and the vault-mcp entry in your OS keychain (Keychain Access on macOS, Credential Manager on
Windows). This cannot be undone.
Development
npm run buildnpm testnpm run typechecknpm run build bundles with tsup into dist/. npm test runs the vitest suite (111 tests).
src/core/ crypto, keychain, store, envfile, importer, template, presets, git guards, audit, backup
src/mcp/ server and tools (read, inject, run, manage, ssh, backup, open-ui)
src/cli/ commander CLI and client registration
src/ui/ loopback web dashboard, its server, and brand icon data (public/icons.json)
test/ core, vault, backup, copy/move, dashboard masking, git guard, client config, and the no-leak suiteMeasured on a laptop, search stays around 10 ms and reading one key under 50 ms up to 2,000 keys. The whole vault is held in memory while the server runs: it is built for one person's keys, not a company-wide store.
Contributing
Issues and pull requests are welcome at https://github.com/MHasnainJafri/vault-mcp.
Run
npm testandnpm run typecheckbefore opening a pull request.Add a service preset: add an entry to
src/core/presets.tswith its fields, env var names, usage notes, format hints and which fields are public or protected. The CLI, the agent tools and the dashboard pick it up.Add a brand icon: add the service to the
SERVICESlist insrc/ui/public/index.html. If Simple Icons has its logo, add the slug's colour and path tosrc/ui/public/icons.json; otherwise give it a letter tile.Never let a tool result carry a secret value. The no-leak test in
test/no-leak.test.tsmust stay green.
Known limits
vault getprints a value by design. Do not run it on a shared screen.The dashboard can reveal values. It is local-only, token-gated and code-gated, but it is a deliberate exception to "never show a value": for you, not for the agent.
The audit log is append-only but not tamper-proof. Anything that can read the vault file can rewrite it.
"The agent never sees a value" covers the MCP tool surface. It keeps keys out of your transcript; it is not a sandbox against an agent that also has shell access to your machine.
License
MIT © 2026 M. Hasnain Jafri.
Brand icons in the dashboard come from Simple Icons 16.35.0 (CC0 1.0). Each logo is a trademark of its owner and is used only to identify that service. Brands that ask not to be redistributed (OpenAI, AWS, Twilio, SendGrid, Heroku, Slack) are shown as plain lettered tiles instead.
Issues and source: https://github.com/MHasnainJafri/vault-mcp.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Secrets for developers and agents—secure context and workflows without exposing secret values.
A secret store for AI agents: the agent never sees the plaintext.
Password vault for AI agents with scoped, user-approved access
Governed access to sensitive data, secrets and APIs for AI agents. A signed proof for each decision.
Related MCP Servers
- AlicenseCqualityCmaintenanceEnables AI agents to securely store and manage encrypted secrets locally while using them indirectly through environment-variable injection or file writes, so plaintext values never enter the agent's context.8MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to scan and audit environment files for leaked secrets, sanitize them, encrypt/decrypt vaults, and run processes with zero-disk secret injection.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to manage and use API keys and secrets without ever seeing their values, by checking availability, listing names, requesting missing values, and running commands with injected secrets and redacted output.50 npmMIT
- AlicenseNot gradedqualityCmaintenanceLets AI coding agents read project documentation and secret metadata, then use credentials by injecting them into child processes while redacting the values from all output. Agents can deploy, migrate databases, or SSH using real secrets without the values ever entering their context, transcripts, or logs.MIT