vaultwarden-mcp
Connects to a Bitwarden vault to provide default-deny, allowlisted access to item fields and to use secrets in pre-approved outbound HTTP requests without revealing their values to the AI agent.
Connects to a self-hosted Vaultwarden vault to provide default-deny, allowlisted access to item fields and to use secrets in approved HTTP requests while masking them from the AI agent.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@vaultwarden-mcp Use my Stripe API key to fetch the latest 5 customers"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
vaultwarden-mcp
Let AI agents use your Vaultwarden / Bitwarden secrets — without giving them your vault.
vaultwarden-mcp is a self-hosted Model Context Protocol server that connects any MCP client (GitHub Copilot, Claude Desktop / Claude Code, Cursor, VS Code, Codex, ChatGPT and Claude.ai connectors…) to a Vaultwarden or Bitwarden vault through a default-deny policy. The agent can see item names, read only the fields you explicitly allow, and — the key feature — use a secret in an HTTP request without ever seeing its value.
Contents
Related MCP server: keywarden
Why
Agents increasingly need credentials: an API token to call a service, a database password for a migration, a deploy key. The usual options are bad: paste the secret into the chat (now it lives in the transcript forever), or give the agent full vault access (one prompt injection away from exfiltrating everything).
vaultwarden-mcp sits in between:
Nothing is readable by default. You allowlist individual item fields.
Secrets can be used without being revealed.
use_secretinjects the value into an outbound HTTPS request to a URL you pre-approved and masks it in the response. The model only sees the API's answer.A human can stay in the loop. Any read or use can require per-request approval via MCP elicitation.
Everything is audited — without ever logging secret values.
Features
🔒 Default-deny policy | Per item, per field allowlist; re-read on every call, so edits take effect immediately. |
🕶️ | Inject a secret into an HTTP request (URL, header or body) bound to allowlisted URL prefixes and methods; response is masked (raw, URL-encoded, base64, JSON-escaped forms). |
✋ Human approval |
|
⏳ Grant limits |
|
🧾 Audit log | JSON lines (tool, item id, field, origin/path, result, user) to stderr and optionally a file — never values. |
🔌 Two transports | stdio for local clients; Streamable HTTP for remote clients. |
🪪 Auth for HTTP | Static bearer token, or OAuth 2.1 via any OIDC provider (Authentik, Keycloak, Auth0, Entra ID…) with protected-resource metadata. |
👥 Multi-user | With OIDC, each user gets their own vault session, policy and Bitwarden state. Experimental. |
📦 Easy to run |
|
🧰 Setup CLI |
|
How it works
flowchart LR
subgraph Clients["MCP clients"]
A1["Copilot / Claude Code / Cursor<br/>(local, stdio)"]
A2["ChatGPT / Claude.ai connectors<br/>(remote, HTTP + OAuth)"]
end
subgraph Server["vaultwarden-mcp"]
T["Transport<br/>stdio · Streamable HTTP"]
AU["Auth<br/>bearer token · OIDC JWT"]
P["Policy engine<br/>default deny · approval · TTL · max uses"]
U["use_secret<br/>inject → fetch → mask"]
L["Audit log<br/>(no values)"]
end
IdP["OIDC provider<br/>(e.g. Authentik)"]
BW["Bitwarden CLI (bw)<br/>unlocked session"]
VW[("Vaultwarden /<br/>Bitwarden server")]
API["Allowlisted API<br/>https://api.example.com/v1/"]
A1 --> T
A2 --> T
T --> AU --> P
AU -. "validate JWT (JWKS)" .-> IdP
P --> BW --> VW
P --> U --> API
P --> L
U --> LThe server drives the official Bitwarden CLI (bw) with a pre-unlocked session key. The master password never touches the server process: you unlock once, store the session key in a file (or a systemd credential), and the server reads it per call.
Quickstart
You need: a Vaultwarden or Bitwarden account, a personal API key (Vaultwarden: Settings → Security → Keys), and either Node.js ≥ 20 + bw (npm i -g @bitwarden/cli) or Docker.
Option A — local, with npx (stdio)
npx -y vaultwarden-mcp init # creates ~/.config/vaultwarden-mcp and prints the next stepsinit prints the exact commands for your OS. They boil down to:
export BITWARDENCLI_APPDATA_DIR=~/.config/vaultwarden-mcp/bw
bw config server https://vault.example.com
bw login --apikey
bw unlock --raw > ~/.config/vaultwarden-mcp/session && chmod 600 ~/.config/vaultwarden-mcp/sessionThen allow some fields in ~/.config/vaultwarden-mcp/policy.json (see Policy) and print a config for your client:
npx -y vaultwarden-mcp config claude-desktopOption B — local, with Docker (stdio)
Same data directory, but bw runs inside the image — nothing to install except Docker:
docker run --rm -it -v ~/.config/vaultwarden-mcp:/data -e BITWARDENCLI_APPDATA_DIR=/data/bw \
--entrypoint sh ghcr.io/metodex-tech/vaultwarden-mcp:latest -c \
'bw config server https://vault.example.com && bw login --apikey && bw unlock --raw > /data/session'
npx -y vaultwarden-mcp config cursor --launch dockerOption C — remote server, over HTTP (docker compose)
For ChatGPT / Claude.ai connectors or a shared team server:
git clone https://github.com/metodex-tech/vaultwarden-mcp && cd vaultwarden-mcp
cp .env.example .env # choose VW_AUTH=token or oidc, set VW_PUBLIC_URL
mkdir -p data && sudo chown 1000:1000 data
docker compose run --rm --entrypoint bw vaultwarden-mcp config server https://vault.example.com
docker compose run --rm --entrypoint bw vaultwarden-mcp login --apikey
docker compose run --rm --entrypoint sh vaultwarden-mcp -c 'bw unlock --raw > /data/session'
docker compose up -d
curl -s http://127.0.0.1:3000/healthzPut a TLS reverse proxy in front of port 3000. Details, OIDC and multi-user setup: docs/deployment.md, docs/oidc.md.
OIDC / multi-user mode is experimental. It is covered by unit tests but has not yet been verified in a production deployment. HTTP with a static bearer token and stdio (local or over SSH) are the field-tested paths.
Option D — remote server, over SSH (stdio)
No HTTP exposed at all: the client runs ssh, and an authorized_keys forced command starts the server inside a long-running container with docker exec. This is the most locked-down remote setup and works with every stdio client. See docs/deployment.md#ssh-stdio.
npx -y vaultwarden-mcp config copilot --launch ssh --ssh-target mcp@vault-host.example.comConnecting clients
vaultwarden-mcp config <client> prints a snippet and where to put it. Clients: copilot, claude-desktop, claude-code, cursor, vscode, codex, generic. Launch modes: --launch npx|docker|ssh|http.
{
"mcpServers": {
"vaultwarden": {
"command": "npx",
"args": ["-y", "vaultwarden-mcp", "serve"],
"env": {
"VW_POLICY": "/home/you/.config/vaultwarden-mcp/policy.json",
"VW_SESSION_FILE": "/home/you/.config/vaultwarden-mcp/session",
"BITWARDENCLI_APPDATA_DIR": "/home/you/.config/vaultwarden-mcp/bw"
}
}
}
}Claude Desktop: claude_desktop_config.json; Cursor: ~/.cursor/mcp.json; Copilot CLI: ~/.copilot/mcp-config.json.
claude mcp add vaultwarden \
-e VW_POLICY=$HOME/.config/vaultwarden-mcp/policy.json \
-e VW_SESSION_FILE=$HOME/.config/vaultwarden-mcp/session \
-e BITWARDENCLI_APPDATA_DIR=$HOME/.config/vaultwarden-mcp/bw \
-- npx -y vaultwarden-mcp serve{
"servers": {
"vaultwarden": {
"type": "stdio",
"command": "npx",
"args": ["-y", "vaultwarden-mcp", "serve"],
"env": { "VW_POLICY": "${userHome}/.config/vaultwarden-mcp/policy.json",
"VW_SESSION_FILE": "${userHome}/.config/vaultwarden-mcp/session",
"BITWARDENCLI_APPDATA_DIR": "${userHome}/.config/vaultwarden-mcp/bw" }
}
}
}{
"mcpServers": {
"vaultwarden": {
"type": "http",
"url": "https://vault-mcp.example.com/mcp",
"headers": { "Authorization": "Bearer <VW_HTTP_TOKEN>" }
}
}
}With OIDC (--auth oauth), omit the header: the client discovers the authorization server from /.well-known/oauth-protected-resource and runs the OAuth flow. For ChatGPT and Claude.ai, add a custom connector with URL https://vault-mcp.example.com/mcp. Clients that only speak stdio can use mcp-remote.
Tools
Tool | What the model gets | Gated by |
| Lock status ( | — |
|
| — (no secret values) |
| The value of one allowlisted field: |
|
| The HTTP response of a request in which |
|
Example use_secret call made by the model:
{
"id": "6f0c…",
"field": "password",
"request": {
"method": "GET",
"url": "https://api.example.com/v1/me",
"headers": { "Authorization": "Bearer {{secret}}" }
}
}Prefer use_secret over get_secret whenever the secret is only needed to call an API: the value never enters the model context, the transcript, or the client's logs.
Policy
A JSON file (default /policy/allowlist.json, set with VW_POLICY). Missing file = deny everything. Re-read on every call.
{
"approval": { "get_secret": "always", "use_secret": "never" },
"items": {
"2b1e0c9a-0000-4000-8000-000000000001": ["username", "password"]
},
"use": {
"2b1e0c9a-0000-4000-8000-000000000002": {
"password": {
"http": {
"allowedUrls": ["https://api.example.com/v1/"],
"methods": ["GET", "POST"]
},
"maxUses": 50,
"expiresAt": "2026-12-31T23:59:59Z",
"approval": "always"
}
}
}
}items— fields readable viaget_secret.use— fields usable viause_secret, independently ofitems(a secret can be usable but not readable).approval—"never"or"always"; the most specific setting wins (per-grant → per-tool →VW_APPROVAL). Unknown values fail closed to"always".
Full reference: docs/policy.md · Example: examples/policy.example.json.
Configuration
All configuration is via environment variables (see .env.example).
Variable | Default | Description |
|
| Policy file path |
|
| File with the |
| bw default | Bitwarden CLI state directory |
|
| Path to the Bitwarden CLI |
|
| Default approval mode ( |
| — | Also append audit JSON lines (always written to stderr) to this file |
| — | Persist |
|
|
|
|
| HTTP listen address |
| — | External base URL, e.g. |
| public URL host + loopback |
|
|
| Idle MCP session expiry |
| inferred |
|
| — | Static bearer token (≥ 24 chars) |
| — | OIDC issuer URL and expected |
| — | Comma-separated scopes every token must have |
| — | Enables multi-user mode: one sub-directory per OIDC user |
| everyone authenticated | Comma-separated |
Security model
What we protect: vault contents from an AI agent that is curious, wrong, or prompt-injected; and from anyone who reaches the HTTP endpoint.
Threat | Mitigation |
Prompt injection asks the agent to dump secrets | Default deny; only allowlisted fields; prefer |
Agent sends a usable secret to an attacker's server |
|
API echoes the secret back | Response body, status text and |
Runaway usage |
|
Secret leaks into logs | Audit records ids, fields, origin/path, results — never values or full URLs with query strings. Errors from outbound requests are replaced with generic messages. |
Unauthenticated network access | HTTP refuses to start without auth on non-loopback addresses; token compared in constant time; OIDC JWTs validated against JWKS (issuer, audience, expiry, scopes); Host-header allowlist. |
One user reads another's vault | Per-user directories (session, policy, bw state); MCP sessions are bound to the identity that created them. |
Stolen session key | Keep it in a |
Out of scope / limitations — please read:
A field you allow for
get_secretis disclosed to the model and the client provider. Useuse_secretwhen possible.An allowed API can still be misused within its scope (e.g.
POSTto an allowed endpoint). Scope URL prefixes and methods tightly.Masking can't catch every transformation (hashes, partial echoes, encrypted forms).
Without
VW_STATE_DIR,maxUsescounters are in memory and reset when the server process restarts (in SSH-stdio mode, per connection). SetVW_STATE_DIRto persist them.Whoever controls the host running the server and its session key controls the allowed secrets.
Approval relies on the MCP client implementing elicitation honestly.
See SECURITY.md for reporting vulnerabilities.
Comparison with @bitwarden/mcp-server
| ||
Goal | Let agents use specific secrets safely | Let agents manage the vault (CRUD, org admin) |
Default access | Deny all, field-level allowlist | Full vault of the unlocked account |
Use a secret without revealing it | ✅ | ❌ |
Human approval per request | ✅ elicitation | ❌ |
Grant TTL / use limits | ✅ | ❌ |
Remote HTTP with OAuth / multi-user | ✅ | stdio only |
Write access to the vault | ❌ (by design) | ✅ |
They are complementary: use Bitwarden's server for vault administration, this one for agents that should only consume secrets.
Roadmap
Telegram / webhook approval channel (for clients without elicitation)
use_secretfor local commands (inject into env of an allowlisted command)Persistent use counters (
VW_STATE_DIR)Additional unlock providers: Bitwarden Secrets Manager, TPM-sealed session key
Publish to npm, GHCR and the MCP Registry
Development
npm ci
npm run lint
npm test # node --test, uses a mock bw (fixtures/mock-bw.js)
BW_CLI_PATH=fixtures/mock-bw.js npm run smokeContributing
PRs welcome — see CONTRIBUTING.md. Changes that widen what an agent can see must come with tests and a threat-model note.
Reporting vulnerabilities
Please don't open public issues for security problems — see SECURITY.md.
License
MIT © metodex-tech. Not affiliated with Bitwarden, Inc. or the Vaultwarden project.
Available Tools
4 toolsget_secretGet allowlisted secretA
Return one secret field of a vault item, only if that item id and field are listed in the server-side allowlist. Every call is audited. Prefer use_secret when the value only needs to be sent to an API.
Inputs: id (required), field (required).
list_item_metadataList vault item metadataA
List item IDs, names, and types only. Passwords, notes, fields, attachments, and secret values are never returned.
Inputs: no named parameters.
use_secretUse a secret without revealing itA
Send an HTTPS request with a vault secret injected server-side. Write {{secret}} where the secret goes (URL, header value, or body); the value is substituted by the server and is never returned to you. Responses are masked. Only URLs allowlisted for that item/field in the server policy are permitted; the policy may also require human approval and limit uses or lifetime.
Inputs: id (required), field (required), request (required).
vault_statusVault statusA
Return only whether the Bitwarden CLI vault is unlocked, locked, unauthenticated, or in an unknown state.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
get_secret and use_secret both involve secret access and could initially look overlapping, but the descriptions clearly distinguish returning a value versus server-side injection without disclosure. vault_status and list_item_metadata are cleanly separate from the secret-access tools.
Three names follow a clear verb_noun pattern (get_secret, list_item_metadata, use_secret), while vault_status is noun-based and lacks a verb. This is a minor inconsistency but the overall convention remains readable and predictable.
Four tools is well-scoped for a security-sensitive secret broker: check status, discover allowed items, retrieve a secret, and use a secret. Each tool has a distinct role and none feels redundant.
The surface covers the core secret-consumption lifecycle: vault state, item discovery, controlled retrieval, and server-side use. Write or administrative operations are intentionally absent for security, though a way to inspect policy/allowlist details could be a useful minor addition.
Maintenance
Related MCP Connectors
Security gateway for AI agents: policy, approval, and audited execution, no secrets shared.
Governed access to sensitive data, secrets and APIs for AI agents. A signed proof for each decision.
Credential isolation for AI agents: placeholder secrets, policy checks, optional human approval.
Password vault for AI agents with scoped, user-approved access
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to securely use real secrets (API keys, database passwords) by requiring human approval for each release, ensuring secrets never enter the model's context.2Apache 2.0
- AlicenseAqualityDmaintenanceEnables AI agents to make authenticated API calls and run commands with secrets injected, while keeping credentials completely hidden from the model, with policy enforcement, grants, and audit logging.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to access only task-relevant data with secrets hidden and personal details pseudonymized, while enforcing destination policies to prevent data leakage even under prompt injection.2AGPL 3.0
- AlicenseAqualityBmaintenanceEnables AI agents to look up stored logins by URL, name, or alias and use them without seeing the secrets, injecting authentication into HTTP requests, running commands with credentials in the environment and scrubbed output, and fetching 2FA codes, subject to per-credential policies and user approval.23MIT