Vault MCP Server

Vault MCP Server

Enables interaction with HashiCorp Vault to read, write, list, and delete secrets through a containerized MCP server with secure token-based authentication.

Category
访问服务器

README

vault-mcp

A containerized Model Context Protocol (MCP) server for interacting with HashiCorp Vault. This server provides MCP tools for reading, writing, listing, and deleting secrets in Vault.

Features

  • vault_read: Read secrets from Vault at a specified path
  • vault_write: Write secrets to Vault at a specified path
  • vault_list: List secrets at a specified path in Vault
  • vault_delete: Delete secrets from Vault at a specified path

Prerequisites

  • Docker and Docker Compose
  • HashiCorp Vault instance (can use the included dev server)
  • Vault token for authentication

Quick Start with Docker Compose

The easiest way to get started is using the included docker-compose.yml which sets up both Vault (in dev mode) and the MCP server:

# Build and start services
docker-compose up -d

# Check logs
docker-compose logs -f vault-mcp

This will start:

  • A Vault dev server at http://localhost:8200 with root token myroot
  • The vault-mcp server connected to the Vault instance

Building the Docker Image

Using Pre-built Images from GitHub Container Registry

Pre-built container images are automatically published to GitHub Container Registry:

# Pull the latest image
docker pull ghcr.io/kelleyblackmore/vault-mcp:latest

# Pull a specific version
docker pull ghcr.io/kelleyblackmore/vault-mcp:v1.0.0

The images are automatically built for multiple platforms:

  • linux/amd64 (x86_64)
  • linux/arm64 (ARM64/aarch64)

Building Locally

docker build -t vault-mcp .

Running the Container

With Docker Run

docker run -it \
  -e VAULT_ADDR=http://your-vault:8200 \
  -e VAULT_TOKEN=your-vault-token \
  vault-mcp

With Docker Compose

Edit the docker-compose.yml file to configure your Vault connection:

environment:
  VAULT_ADDR: http://vault:8200
  VAULT_TOKEN: your-token

Then run:

docker-compose up vault-mcp

Configuration

The server is configured via environment variables:

  • VAULT_ADDR: The Vault server address (default: http://127.0.0.1:8200)
  • VAULT_TOKEN: The Vault authentication token (required)

Using with MCP Clients

Claude Desktop Configuration

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "vault": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "VAULT_ADDR=http://your-vault:8200",
        "-e",
        "VAULT_TOKEN=your-vault-token",
        "ghcr.io/kelleyblackmore/vault-mcp:latest"
      ]
    }
  }
}

Note:

  • Replace your-vault:8200 with your Vault server address
  • Replace your-vault-token with your Vault authentication token

Migrating from local builds: If you previously built the image locally as vault-mcp, you can:

  • Use pre-built images by updating the image name to ghcr.io/kelleyblackmore/vault-mcp:latest, or
  • Continue using your local image by keeping the image name as vault-mcp

Available Tools

vault_read

Read a secret from Vault.

Parameters:

  • path (string, required): The path to read the secret from (e.g., secret/data/myapp)

Example:

{
  "path": "secret/data/myapp"
}

vault_write

Write a secret to Vault.

Parameters:

  • path (string, required): The path to write the secret to (e.g., secret/data/myapp)
  • data (object, required): The secret data to write as a JSON object

Example:

{
  "path": "secret/data/myapp",
  "data": {
    "username": "admin",
    "password": "secret123"
  }
}

vault_list

List secrets at a path in Vault.

Parameters:

  • path (string, required): The path to list secrets from (e.g., secret/metadata)

Example:

{
  "path": "secret/metadata"
}

vault_delete

Delete a secret from Vault.

Parameters:

  • path (string, required): The path to delete the secret from (e.g., secret/data/myapp)

Example:

{
  "path": "secret/data/myapp"
}

Development

Local Development Setup

# Install dependencies
npm install

# Build the project
npm run build

# Run locally (requires Vault server)
VAULT_ADDR=http://localhost:8200 VAULT_TOKEN=myroot npm start

Project Structure

vault-mcp/
├── .github/
│   └── workflows/
│       └── docker-build-publish.yml  # CI/CD workflow for container builds
├── src/
│   └── index.ts          # Main MCP server implementation
├── dist/                 # Compiled JavaScript (generated)
├── Dockerfile           # Container definition
├── docker-compose.yml   # Docker Compose configuration
├── package.json         # Node.js dependencies
├── tsconfig.json        # TypeScript configuration
└── README.md           # This file

CI/CD

The project uses GitHub Actions to automatically build and publish Docker images:

  • On push to main: Builds and publishes the latest tag and a SHA-based tag
  • On pull request: Builds the image to verify it compiles (does not publish)
  • On version tags (e.g., v1.0.0): Builds and publishes version-specific tags (e.g., v1.0.0, v1.0, v1)

Images are published to GitHub Container Registry at ghcr.io/kelleyblackmore/vault-mcp.

Security Considerations

  • Never hardcode Vault tokens in configuration files
  • Use appropriate Vault policies to limit MCP server permissions
  • For production use, replace the dev Vault server with a properly configured production instance
  • Consider using Vault AppRole or Kubernetes auth instead of token-based auth
  • Use secrets management tools to inject VAULT_TOKEN at runtime

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选