MCP-warden AI agents use your API keys without seeing them
1 point
What I learned after open-sourcing a local credential broker for MCP agents
I’ve been using a local MCP server to keep secrets out of agent context for about half a year. It stores credentials in the OS keychain and only injects them server-side through scoped presets. Most of it I built with Claude a lot of the security edge cases and the threat model went through several rounds of “what if the agent does X”.
A few days ago I open-sourced it (mcp-warden). After posting, a couple of sharp comments made gaps obvious that weren’t clear when only I was using it. Here’s what landed in 0.5 based on that:
Someone pointed out that if an upstream echoes the Authorization header back (debug endpoints, error payloads, httpbin-style /headers), the secret still ends up in the agent’s context. That wasn’t handled. Now every form the credential was sent in gets scrubbed from the response body before the agent sees it.
Approvals on macOS and Windows were basically broken under real MCP clients (notifications have no buttons, TUI can’t run when the client launches the server). Added native dialogs.
Added a kill switch (lock / unlock, also /lock from Telegram) after realizing there’s no clean way to stop everything if something feels off.
Wrote scan + import because a lot of people (including past me) still have plaintext tokens sitting in Claude/Cursor/Codex configs. It finds them and moves them into the keychain, rewriting the entries.
Config used to be re-read on every call, so an agent with file access could widen a preset live. Now it’s frozen at startup.
A few other practical things: time-limited grants, a policy simulator so you can check if a call would be allowed without sending it, response size/field limits, more templates.
Still local-only, still just a single binary. The interesting part was how quickly real usage + a couple of comments surface things that weren’t obvious during solo use (even with Claude helping write it).
Repo: ermoluk/mcp-warden
Curious how other people are currently handling credentials with agents most setups I see still end up putting the value somewhere the agent can see.
1 point
MCP-warden local credential broker so AI agents never see your secrets
1 point
I got tired of putting API keys into Claude Code / Cursor configs, so I built a local credential broker for MCP
If you’re using Claude Code, Cursor or Codex with real API keys (GitHub PAT, Stripe, databases, etc.), you’ve probably done one of these:
• Put the key in the MCP config
• Put it in an env var
• Pasted it into the chat at some point
All of these are bad. One prompt injection or a leaked transcript and the secret is gone.
I built mcp-warden a local-first credential broker for MCP.
How it works:
1. You store the secret once in the OS keychain
2. You define scoped presets (e.g. github-read, stripe-charges)
3. The agent calls tools like proxy_http / ssh_exec
4. mcp-warden injects the credential server-side and returns only the result
The agent never sees the secret. Allow-list validation happens before the credential is used. You can require approval for sensitive actions (desktop notification, TUI or Telegram). Everything is logged locally.
It works with Claude Code, Cursor, Codex, Cline and any other MCP client. Written in Rust, fully local, Apache-2.0.
GitHub: ermoluk/mcp-warden
Curious how other people are currently handling secrets with agents. Is everyone just pasting keys into configs, or did someone already solve this differently?
24 comments
MCP-warden local credential broker so AI agents never see your secrets
I got tired of pasting GitHub PATs, Stripe keys and DB passwords into Claude Code / Cursor MCP configs. One prompt injection or a leaked chat and they’re gone.
So I built mcp-warden — a local-first credential broker for the Model Context Protocol.
How it works:
• You store the secret once in the OS keychain
• You define scoped presets (e.g. github-read, stripe-charges)
• The agent calls high-level tools (proxy_http, ssh_exec, db_query)
• mcp-warden injects the credential server-side and returns only the result
The agent’s context never contains the secret. Allow-list validation runs before credential injection. Sensitive actions can require approval (desktop notification, TUI, or Telegram). Everything is logged locally.
Works with Claude Code, Cursor, Codex, Cline and any other MCP client. Written in Rust, Apache-2.0, fully local.
GitHub: ermoluk/mcp-warden
Happy to answer questions about the threat model or how people are currently handling secrets with agents.
1 point · 2 comments
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 = "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: 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?
1 point · 1 comment
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 = "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: 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?
1 point
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 = "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: 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?
3 points · 10 comments
Mentions
MCP-warden AI agents use your API keys without seeing them
What I learned after open-sourcing a local credential broker for MCP agents I’ve been using a local MCP server to keep secrets out of agent context for about half a year. It stores credentials in the OS keychain and only injects them server-side through scoped presets. Most of it I built with Claude a lot of the security edge cases and the threat model went through several rounds of “what if the agent does X”. A few days ago I open-sourced it (mcp-warden). After posting, a couple of sharp comments made gaps obvious that weren’t clear when only I was using it. Here’s what landed in 0.5 based on that: Someone pointed out that if an upstream echoes the Authorization header back (debug endpoints, error payloads, httpbin-style /headers), the secret still ends up in the agent’s context. That wasn’t handled. Now every form the credential was sent in gets scrubbed from the response body before the agent sees it. Approvals on macOS and Windows were basically broken under real MCP clients (notifications have no buttons, TUI can’t run when the client launches the server). Added native dialogs. Added a kill switch (lock / unlock, also /lock from Telegram) after realizing there’s no clean way to stop everything if something feels off. Wrote scan + import because a lot of people (including past me) still have plaintext tokens sitting in Claude/Cursor/Codex configs. It finds them and moves them into the keychain, rewriting the entries. Config used to be re-read on every call, so an agent with file access could widen a preset live. Now it’s frozen at startup. A few other practical things: time-limited grants, a policy simulator so you can check if a call would be allowed without sending it, response size/field limits, more templates. Still local-only, still just a single binary. The interesting part was how quickly real usage + a couple of comments surface things that weren’t obvious during solo use (even with Claude helping write it). Repo: ermoluk/mcp-warden Curious how other people are currently handling credentials with agents most setups I see still end up putting the value somewhere the agent can see.
MCP-warden local credential broker so AI agents never see your secrets
I got tired of putting API keys into Claude Code / Cursor configs, so I built a local credential broker for MCP If you’re using Claude Code, Cursor or Codex with real API keys (GitHub PAT, Stripe, databases, etc.), you’ve probably done one of these: • Put the key in the MCP config • Put it in an env var • Pasted it into the chat at some point All of these are bad. One prompt injection or a leaked transcript and the secret is gone. I built mcp-warden a local-first credential broker for MCP. How it works: 1. You store the secret once in the OS keychain 2. You define scoped presets (e.g. github-read, stripe-charges) 3. The agent calls tools like proxy_http / ssh_exec 4. mcp-warden injects the credential server-side and returns only the result The agent never sees the secret. Allow-list validation happens before the credential is used. You can require approval for sensitive actions (desktop notification, TUI or Telegram). Everything is logged locally. It works with Claude Code, Cursor, Codex, Cline and any other MCP client. Written in Rust, fully local, Apache-2.0. GitHub: ermoluk/mcp-warden Curious how other people are currently handling secrets with agents. Is everyone just pasting keys into configs, or did someone already solve this differently?
MCP-warden local credential broker so AI agents never see your secrets I got tired of pasting GitHub PATs, Stripe keys and DB passwords into Claude Code / Cursor MCP configs. One prompt injection or a leaked chat and they’re gone. So I built mcp-warden — a local-first credential broker for the Model Context Protocol. How it works: • You store the secret once in the OS keychain • You define scoped presets (e.g. github-read, stripe-charges) • The agent calls high-level tools (proxy_http, ssh_exec, db_query) • mcp-warden injects the credential server-side and returns only the result The agent’s context never contains the secret. Allow-list validation runs before credential injection. Sensitive actions can require approval (desktop notification, TUI, or Telegram). Everything is logged locally. Works with Claude Code, Cursor, Codex, Cline and any other MCP client. Written in Rust, Apache-2.0, fully local. GitHub: ermoluk/mcp-warden Happy to answer questions about the threat model or how people are currently handling secrets with agents.
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 = "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: 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?
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 = "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: 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?
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 = "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: 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?