VaultLens is a full-stack TypeScript app for interacting with HashiCorp Vault using an LLM agent. It combines:
- Vault audit analysis (via
vault-mcp-server) - Vault operational queries/actions (via
vault-audit-mcp) - A React UI with streaming responses and session-scoped history
- Documentation suggestions
This provides a natural language interface to reconcile Vault configuration against client activity and behaviors.
What is the current cluster status?Have there been any failed authentication events recently?Which Vault entities have access to the secret at kv/foo in the operations namespace?Which ACL policies have been used within the last 24 hours?Which auth roles associated with the mount auth/oidc have been used to login recently?Have there been secret access errors in the past two hours?
- Frontend: React 18 + Vite
- Backend: Express + TypeScript (
tsxin dev) - LLM providers: Anthropic and OpenAI (selectable)
- MCP integration: stdio child-process clients for both MCP servers
- Browser client calls Express API (
/api/*through Vite proxy in dev) - Express server orchestrates tool execution through an LLM service
- Execution engine calls:
vault-audit-mcp(stdio)vault-mcp-server(stdio)
- Vault authentication state is managed server-side (OIDC or token auth)
- Node.js 18+
- Built binaries (or runnable commands) for:
vault-audit-mcpvault-mcp-server
- Vault cluster accessible from the backend
- Loki if you use audit queries (see the
vault-audit-mcpproject for details) - API key for selected LLM provider
Note that vault-audit-mcp and vault-mcp-server should be sourced from https://github.com/czembower?tab=repositories
- Install dependencies:
npm install- Create env file:
cp .env.example .env- Configure
.env.
LLM_PROVIDER:anthropic(default) oropenaiANTHROPIC_API_KEY: required whenLLM_PROVIDER=anthropicOPENAI_API_KEY: required whenLLM_PROVIDER=openaiOPENAI_MODEL: OpenAI model name (runtime default:gpt-5.2)VAULT_AUDIT_MCP_COMMAND: command/path for audit MCP server (default./vault-audit-mcp)VAULT_MCP_COMMAND: command/path for Vault MCP server (default./vault-mcp-server)LOKI_URL: passed tovault-audit-mcp(defaulthttp://localhost:3100)API_PORT: backend port (default3001)VITE_PORT: frontend dev port (default5173)VAULT_OIDC_REDIRECT_URI: OIDC callback URL (defaulthttp://localhost:8250/oidc/callback)
Notes: MCP servers are started as local processes via stdio, not HTTP URLs.
Run frontend and backend together:
npm run dev- Backend:
http://localhost:3001(orAPI_PORT) - Frontend:
http://localhost:5173(orVITE_PORT)
The frontend proxies /api to the backend.
npm run buildOutputs:
- Server build under
dist/server - Client build under
dist/client
Base backend endpoints:
GET /healthPOST /queryPOST /query/stream(SSE stream)GET /historyPOST /history/clearGET /tokensGET /suggestionsPOST /suggestions/clearGET /activitiesPOST /activities/clearGET /auth/statusPOST /auth/loginPOST /auth/oidc/auth-urlPOST /auth/oidc/completePOST /auth/switch-clusterPOST /auth/logout
Session behavior:
- Session ID is read from
X-Session-IDheader. - If omitted, backend uses
defaultsession. - Frontend generates and persists a session ID in
localStorage.
VaultLens supports:
- OIDC login flow (popup + local callback)
- Direct token-based login
Current token handling:
- Tokens are cached in memory only (per cluster)
- Periodic renewal checks clear expiring tokens and require re-authentication
- Logout attempts token revocation (
revoke-self) for OIDC-managed tokens
Audit-side capabilities include:
- search/aggregate/trace audit events
- fetch detailed event data by
request_id
Vault-side capabilities include many vault-mcp-server tools (for example namespace, mount, secret, policy, auth-method, replication, health, metrics, and lease inspection).
Exact available tools are determined by the connected MCP servers and current versions.
src/
client/ React UI
server/ Express API, auth manager, LLM services, MCP clients
npm run devnpm run dev:servernpm run dev:clientnpm run buildnpm run build:servernpm run build:clientnpm run previewnpm run type-check
This section consolidates critical content that previously lived in:
ARCHITECTURE.md, FILES_INDEX.md, GETTING_STARTED.md, LLM_PROVIDERS.md,
MCP_CONNECTION.md, MCP_STDIO.md, PROJECT_SUMMARY.md,
SETUP_COMPLETE.md, and TOKEN_MANAGEMENT.md.
- User sends a natural-language query from the React UI.
- Backend (
Express) forwards query + tool definitions to the selected LLM provider. - LLM decides on tool calls.
ExecutionEngineroutes tool calls:- Audit tools ->
vault-audit-mcpclient - Vault tools ->
vault-mcp-serverclient
- Audit tools ->
- Tool results are returned to the LLM for synthesis.
- Final response (plus tool call/result metadata) is streamed back to UI.
- Current transport model is local-process execution via configured command paths.
- Ensure binaries are present and executable:
VAULT_AUDIT_MCP_COMMANDVAULT_MCP_COMMAND
- Typical verification:
./vault-audit-mcp --help
./vault-mcp-server --help- Common failures:
EACCESor permission denied ->chmod +x <binary>- command not found / startup timeout -> fix command path in
.env
LLM_PROVIDER=anthropicorLLM_PROVIDER=openai- Required key must be present for selected provider:
ANTHROPIC_API_KEYOPENAI_API_KEY
- Restart server after switching provider.
- The API/UI behavior is provider-agnostic; provider-specific logic stays in
src/server/llm/*.
VaultLens expects summarized audit payloads for high-volume queries to avoid token overflow:
- Large audit result sets should be reduced to summary statistics + small representative samples.
- Follow-up narrowing queries (namespace/status/path/time) are preferred over returning raw bulk events.
- Aggregate/count-style tools are naturally compact and should be preferred for broad scans.
- Main entry points:
src/server/index.tssrc/server/execution-engine.tssrc/server/auth/manager.tssrc/client/App.tsxsrc/client/DocumentationSidebar.tsx
- Start here for behavior changes instead of maintaining parallel docs.
- Auth appears stale or expired:
- check
GET /auth/status - re-authenticate via UI
- logout/login to force token reset
- check
- Tools not executing:
- verify MCP command paths in
.env - run binaries directly from shell
- check backend logs for tool timeout / parse errors
- verify MCP command paths in
- Frontend/backed mismatch:
- confirm Vite proxy and backend port (
VITE_PORT/API_PORT) - restart
npm run dev
- confirm Vite proxy and backend port (
See LICENSE.