Securely manage HashiCorp Vault secrets and ACL policies through MCP.
HashiCorp Vault MCP Server
HashiCorp Vault MCP Server is a full-featured Model Context Protocol (MCP) integration that lets language models and other MCP-aware clients manage Vault secrets and policies through a safe, auditable interface. It bridges Vault's security model with the structured interaction model that MCP expects, so you can automate tasks such as credential rotation, policy authoring, and discovery without exposing raw Vault APIs.
Introduction
The server wraps the HashiCorp Vault KV v2 API and common policy workflows inside MCP primitives. Once a client connects, it can call typed tools, browse resources, and request prompt completions that are all backed by the same Vault instance you already operate. Every interaction is explicit: clients must supply the paths, data, and policies they want to work with, and the server relays those requests directly to Vault using a token you control.
Why Use This Server
- Automate secret rotation and retrieval directly from MCP-compatible IDEs and agents.
- Generate or update Vault ACL policies without manually editing HCL snippets.
- Safely expose only the operations you approve by scoping the Vault token that powers the server.
- Avoid ad-hoc scripting: the server comes with well-defined tools and prompts designed around common Vault tasks.
How the Server Works
- You launch the server either locally or inside a container with a Vault token.
- An MCP client (Cursor, Claude Desktop, custom agents) connects over stdio.
- The client calls tools like
create_secretorcreate_policy; the server validates the payload, forwards it to Vault, and returns structured responses. - Resource requests such as
vault://secretslist data-driven content that the client can browse or feed into follow-up prompts. - Prompt handlers like
generate_policyhelp you synthesize Vault-ready HCL from natural-language intents.
The implementation is written in TypeScript, bundles to a single JavaScript file, and relies on the official @modelcontextprotocol/sdk for transport and schema validation.
Requirements
- HashiCorp Vault 1.9+ with the KV secrets engine (v2) enabled on the paths you plan to manage.
- A Vault token that starts with
hvs.and grants the capabilities you need (read, create, update, delete and/or sudo for policy work). - Docker 24+.
- Network access from the machine running the MCP server to your Vault cluster.
Getting Started
Cursor
Production (recommended) — use the official image. Paste this under ~/.cursor/mcp.json:
{
"mcpServers": {
"Vault": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"VAULT_ADDR=https://your-vault-server:8200",
"-e",
"VAULT_TOKEN=hvs.your-vault-token",
"ashgw/vault-mcp:latest"
]
}
}
}
Cursor starts the container on-demand, wires stdio to the MCP transport, and tears it down once the session ends. Pin a tag (e.g. ashgw/vault-mcp:1.x.y) if you want a fixed version.
Local Cursor
You can build & run locally & use it like this
{
"mcpServers": {
"Vault": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--network=host",
"-e",
"VAULT_ADDR=http://127.0.0.1:8200",
"-e",
"VAULT_TOKEN=hvs.test-token-1234567890abcdef",
"vault-mcp:local"
]
}
}
}
Local Docker
git clone https://github.com/rccyx/vault-mcp.git
cd vault-mcp
docker build -t vault-mcp:local .
docker run -i --rm \
--network=host \
-e VAULT_ADDR=http://127.0.0.1:8200 \
-e VAULT_TOKEN=hvs.test-token-1234567890abcdef \
vault-mcp:local
Configuration
VAULT_ADDR(required): URL of the Vault cluster, for examplehttps://vault.internal:8200orhttp://127.0.0.1:8200.VAULT_TOKEN(required): Short-lived or renewable
Tools (4)
create_secretCreate a new secret in the Vault KV v2 engine.read_secretRetrieve a secret from the specified path in Vault.delete_secretDelete a secret from the specified path in Vault.create_policyCreate or update a Vault ACL policy using HCL.Environment Variables
VAULT_ADDRrequiredURL of the Vault cluster (e.g., https://vault.internal:8200)VAULT_TOKENrequiredVault token starting with hvs. that grants necessary capabilitiesConfiguration
{
"mcpServers": {
"Vault": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"VAULT_ADDR=https://your-vault-server:8200",
"-e",
"VAULT_TOKEN=hvs.your-vault-token",
"ashgw/vault-mcp:latest"
]
}
}
}