Vault MCP

Vault MCP

Enables LLM agents to securely use credentials like passwords and API keys without exposing them in the context window, through encrypted storage and proxy-based injection.

Category
访问服务器

README

Vault MCP

MCP server for credential isolation in LLM agents. Your bot uses passwords and API keys — but never sees them in its context window.

The Problem

  User                     LLM                    Website
   │                        │                        │
   │  "password: MyP@ss!"   │                        │
   ├───────────────────────►│                        │
   │                        │──── MyP@ss! ──────────►│
   │                        │                        │
   │                        │◄──── 200 OK ───────────│
   │                        │                        │
   ▼                        ▼                        ▼
                     ┌──────────────┐
                     │ MyP@ss! is   │
                     │ now stored   │
                     │ in LLM       │
                     │ context,     │
                     │ conversation │
                     │ history,     │
                     │ session logs │
                     └──────────────┘

The Solution

  User          Browser Form       Vault MCP         LLM          Website
   │            (localhost)          │                 │              │
   │  ●●●●●●●●    │                 │                 │              │
   ├──────────────►│                 │                 │              │
   │               │── encrypt ─────►│                 │              │
   │               │                 │◄── vault_login ─┤              │
   │               │                 │── fill form ───────────────────►│
   │               │                 │◄──── 200 OK ───────────────────┤
   │               │                 │── { status: ok }─►│            │
   │               │                 │                 │              │
   ▼               ▼                 ▼                 ▼              ▼
                              ┌──────────────┐  ┌──────────────┐
                              │ Password:    │  │ LLM context: │
                              │ AES-256-GCM  │  │              │
                              │ encrypted    │  │ "status: ok" │
                              │ on disk      │  │ (no password)│
                              └──────────────┘  └──────────────┘

Scenarios

Scenario 1: First-time Login (vault_add → vault_login)

The agent needs credentials it doesn't have. It calls vault_add() — a browser form opens where you enter the password. Then vault_login() fills the form via Chrome.

  User              Claude Code           Vault MCP            Chrome
   │                    │                     │                   │
   │ "Log me into       │                     │                   │
   │  Jira"             │                     │                   │
   ├───────────────────►│                     │                   │
   │                    │── vault_list() ────►│                   │
   │                    │◄─ { credentials:[] }┤                   │
   │                    │                     │                   │
   │                    │── vault_add ───────►│                   │
   │                    │   { site: "jira" }  │                   │
   │                    │                     │                   │
   │   ┌────────────────────────────┐         │                   │
   │   │ Browser opens             │         │                   │
   │   │ localhost:9900/add         │         │                   │
   │   │                           │         │                   │
   │   │ Site ID:  [jira]          │         │                   │
   │   │ Email:    [me@work.com]   │         │                   │
   │   │ Password: [●●●●●●●●●●]   │         │                   │
   │   │ URL:      [jira.com/login]│         │                   │
   │   │                           │         │                   │
   │   │ [Add to Vault]            │         │                   │
   │   └────────────┬───────────────┘         │                   │
   │                │                         │                   │
   │                └── POST (encrypted) ────►│                   │
   │                                          │                   │
   │                    │◄─ { status: ok } ───┤                   │
   │                    │   site_id: "jira"   │                   │
   │                    │                     │                   │
   │                    │   (no password      │                   │
   │                    │    in this response) │                   │
   │                    │                     │                   │
   │                    │── vault_login ─────►│                   │
   │                    │   { site: "jira" }  │── decrypt ──┐     │
   │                    │                     │◄────────────┘     │
   │                    │                     │── fill email ────►│
   │                    │                     │── fill pass  ────►│
   │                    │                     │── click submit ──►│
   │                    │                     │◄─ page loaded ───┤
   │                    │                     │── clear pass ────►│
   │                    │                     │                   │
   │                    │◄─ { status: ok,  ───┤                   │
   │                    │    title: "Jira     │                   │
   │                    │    Dashboard" }     │                   │
   │                    │                     │                   │
   │◄── "You're logged  │                     │                   │
   │     into Jira!"    │                     │                   │

Scenario 2: API Key Proxy (vault_api_request)

The agent makes an API call. Vault injects the API key into headers — the key never appears in the LLM context.

  Claude Code           Vault MCP                  Stripe API
   │                      │                            │
   │── vault_api_request ►│                            │
   │   service: "stripe"  │                            │
   │   url: "/v1/charges" │                            │
   │   method: "GET"      │                            │
   │                      │── decrypt API key          │
   │                      │                            │
   │                      │── GET /v1/charges ────────►│
   │                      │   Authorization:           │
   │                      │   Bearer sk-live-****      │
   │                      │                            │
   │                      │◄── { data: [...] } ───────┤
   │                      │                            │
   │                      │── scan response            │
   │                      │   for leaked key           │
   │                      │   (replace with ***)       │
   │                      │                            │
   │◄── { status: ok,  ───┤                            │
   │     body: "..." }    │                            │
   │                      │                            │
   │   (API key NOT in    │                            │
   │    this response)    │                            │

Scenario 3: Returning User (credentials already stored)

If credentials already exist, the agent skips vault_add and goes straight to vault_login:

  User              Claude Code           Vault MCP            Chrome
   │                    │                     │                   │
   │ "Open GitHub"      │                     │                   │
   ├───────────────────►│                     │                   │
   │                    │── vault_list() ────►│                   │
   │                    │◄─ [{ siteId:       ─┤                   │
   │                    │     "github",       │                   │
   │                    │     active: true }] │                   │
   │                    │                     │                   │
   │                    │── vault_login ─────►│                   │
   │                    │   { site: "github" }│── decrypt ───┐    │
   │                    │                     │◄─────────────┘    │
   │                    │                     │── CDP login ─────►│
   │                    │                     │◄─ success ───────┤
   │                    │◄─ { status: ok } ───┤                   │
   │                    │                     │                   │
   │◄── "Done!"         │                     │                   │

Scenario 4: Credential Revocation

Remove access instantly — the agent can no longer use the credential:

  Admin (CLI)           Vault MCP            Claude Code
   │                      │                      │
   │── vault-mcp remove   │                      │
   │   "jira"             │                      │
   │                      │── delete from store   │
   │                      │── audit: removed      │
   │◄── "Removed: jira"   │                      │
   │                      │                      │
   │                      │    ... later ...      │
   │                      │                      │
   │                      │◄── vault_login ──────┤
   │                      │    { site: "jira" }  │
   │                      │                      │
   │                      │── { status: FAIL, ──►│
   │                      │   "Credential not    │
   │                      │    found: jira" }    │
   │                      │                      │

Scenario 5: Audit Trail

Every credential use is logged with a tamper-proof hash chain:

  ~/.vault-mcp/audit.jsonl

  ┌─────────────────────────────────────────────────────────────┐
  │ evt_001 │ credential.created │ jira    │ success │ hash_1  │
  │         │                    │         │         │    │    │
  │ evt_002 │ credential.used    │ jira    │ success │    │    │
  │         │ bot: claude        │         │         │    ▼    │
  │         │                    │         │ prevHash: hash_1  │
  │         │                    │         │         │ hash_2  │
  │         │                    │         │         │    │    │
  │ evt_003 │ credential.used    │ jira    │ success │    ▼    │
  │         │ bot: claude        │         │ prevHash: hash_2  │
  │         │                    │         │         │ hash_3  │
  │         │                    │         │         │    │    │
  │ evt_004 │ credential.removed │ jira    │ success │    ▼    │
  │         │                    │         │ prevHash: hash_3  │
  └─────────────────────────────────────────────────────────────┘

  Modify any entry → hash chain breaks → tamper detected

  $ vault-mcp audit
  Chain integrity: VALID (4 entries)

Quickstart

# 1. Clone and build
git clone https://github.com/Chill-AI-Space/vault-mcp.git
cd vault-mcp
npm install
npm run build

# 2. Register with Claude Code
claude mcp add -s user vault -- node ~/path/to/vault-mcp/dist/index.js

# 3. Use in Claude Code
#    "Log me into GitHub" →
#    Claude calls vault_add("github") → browser form opens → you enter password
#    Claude calls vault_login("github") → Chrome logs in via CDP
#    Claude sees only { status: "success" }

Or add credentials via CLI (outside of Claude Code):

vault-mcp add --site github --email you@example.com --url https://github.com/login
# Password is prompted interactively (masked with *)

MCP Tools

Tool What it does What the LLM sees
vault_add(site_id?) Opens browser form for secure credential entry { status, site_id }
vault_login(site_id) Logs into website via Chrome CDP { status, page_title }
vault_api_request(service, url, ...) Makes API call with injected credentials { status, body }
vault_list() Lists stored credentials [{ siteId, type, active }]
vault_status(site_id) Shows credential metadata + audit stats { siteId, active, lastUsed }

What the LLM never sees: passwords, API keys, emails, tokens, encrypted data.

CLI Commands

vault-mcp add                        # Interactive: add credential (password masked)
vault-mcp add --site X --email Y     # Semi-interactive
vault-mcp list                       # List credentials (no secrets)
vault-mcp remove <site_id>           # Remove credential
vault-mcp audit [site_id]            # View audit log + chain integrity
vault-mcp dashboard                  # Web UI on localhost:9900
vault-mcp serve                      # Start MCP server (for debugging)

Architecture

vault-mcp/
├── src/
│   ├── index.ts              ── Entry: CLI or MCP mode (auto-detect)
│   ├── server.ts             ── MCP server, 5 tools registered
│   ├── cli.ts                ── CLI commands (commander + inquirer)
│   ├── tools/
│   │   ├── vault-add.ts      ── Opens browser form, waits for submit
│   │   ├── vault-login.ts    ── Decrypt → CDP → fill form → status
│   │   ├── vault-api.ts      ── Decrypt → inject headers → fetch → sanitize
│   │   ├── vault-list.ts     ── Return metadata only
│   │   └── vault-status.ts   ── Metadata + audit stats
│   ├── store/
│   │   ├── encrypted-store.ts ── AES-256-GCM CRUD, JSON file backend
│   │   └── keychain.ts        ── Master key: env var or auto-generate
│   ├── browser/
│   │   └── cdp-bridge.ts     ── Playwright connectOverCDP, form fill
│   ├── audit/
│   │   └── logger.ts         ── Append-only JSONL, SHA-256 hash chain
│   └── dashboard/
│       ├── server.ts         ── HTTP server (127.0.0.1:9900 only)
│       ├── index.html        ── Full dashboard (CRUD + audit viewer)
│       └── add.html          ── Focused add-credential form (for vault_add)
└── test/                     ── 29 tests including credential sanitization

Configuration

Env Variable Default Description
VAULT_MASTER_KEY (auto-generated) Encryption key. Without it, a random key is saved to ~/.vault-mcp/.master-key
VAULT_CDP_URL http://localhost:9222 Chrome DevTools Protocol endpoint
# Register with env vars
claude mcp add -s user vault \
  -e VAULT_MASTER_KEY=my-secret-key \
  -e VAULT_CDP_URL=ws://localhost:9222 \
  -- node ~/path/to/vault-mcp/dist/index.js

Storage

~/.vault-mcp/
├── credentials.json    ── Encrypted credentials (AES-256-GCM, unique IV per entry)
├── audit.jsonl         ── Append-only log with SHA-256 hash chain
└── .master-key         ── Auto-generated master key (mode 0600)

Security

See SECURITY.md for full threat model.

  Protects against                 Does NOT protect against
  ─────────────────                ────────────────────────
  ✓ LLM context leakage           ✗ User typing password in chat
  ✓ Plaintext credential storage   ✗ Compromised host (root access)
  ✓ Audit log tampering            ✗ Malicious MCP client
  ✓ Accidental exposure in logs    ✗ Browser-level memory attacks

Testing

npm test              # 29 tests
npm run test:watch    # Watch mode

Tests verify: encryption round-trip, wrong-key rejection, credential sanitization in all tool responses, hash chain integrity, tamper detection, full lifecycle flows.

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选