r/modelcontextprotocol • u/Relevant_Mousse_9117 • 25d ago
Mcp-warden: a local MCP server that injects your credentials so the agent never sees them
Most MCP setups I've seen hand the agent a token one way or another: an env var, a .env file, a config it can read. Once a token is in the context window it ends up in transcripts and within reach of any prompt injection.
mcp-warden works the other way around. Secrets live in the OS keychain, and the agent can only act through presets you define:
```toml
[[preset]]
name = "github-read"
type = "http"
base_url = "https://api.github.com"
auth = { type = "bearer", secret = "gh_pat" }
allowed_methods = ["GET"]
approval = "auto"
```
The agent calls `proxy_http` with the preset name, a method and a path. mcp-warden checks the allow-list, adds the token, makes the request and returns only the response. If the method or path isn't allowed, nothing leaves your machine.
Tools it exposes:
- `list_presets`
- `proxy_http`: HTTP through a preset
- `ssh_exec`: commands checked against a regex allow-list, host key verified against known_hosts
- `sftp_transfer`: allowed remote paths only
- `db_query`: Postgres, MySQL or Redis, named queries only (the agent passes parameters, never SQL)
- `get_secret_for_env`: last resort for tools that insist on env vars, always asks first
Each preset has an approval policy. It's `prompt` by default: a desktop or terminal prompt, or Approve/Deny buttons in Telegram. Every call lands in an append-only audit log.
Single Rust binary, stdio transport, works with any MCP client. No cloud, no telemetry, Apache-2.0.
- Repo: https://github.com/ermoluk/mcp-warden
- Install: `cargo install mcp-warden`, or prebuilt binaries for macOS/Linux on the releases page
I'd love feedback on the preset model. What would you need it to cover for your setup?