MCP Bastion
MCP proxy adding auto-reconnect, tool-security checks and audit logs
MCP Bastion is an open-source MCP server for security. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, Self-hosted
- Runs
- Locally
- Version
- 1.5.1
- Listing updated
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add mcp-bastion -- npx -y mcp-bastionAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"mcp-bastion": {
"command": "npx",
"args": [
"-y",
"mcp-bastion"
]
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"mcp-bastion": {
"command": "npx",
"args": [
"-y",
"mcp-bastion"
]
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"mcp-bastion": {
"command": "npx",
"args": [
"-y",
"mcp-bastion"
]
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"mcp-bastion": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mcp-bastion"
]
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add mcp-bastion -- npx -y mcp-bastionOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.mcp-bastion]
command = "npx"
args = ["-y", "mcp-bastion"]Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"mcp-bastion": {
"command": "npx",
"args": [
"-y",
"mcp-bastion"
]
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "mcp-bastion": { "command": "npx", "args": [ "-y", "mcp-bastion" ] } } }Or run: gemini mcp add -s user mcp-bastion npx -- -y mcp-bastion
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "mcp-bastion": { "command": "npx", "args": [ "-y", "mcp-bastion" ] } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "mcp-bastion": { "command": "npx", "args": [ "-y", "mcp-bastion" ] } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "mcp-bastion": { "command": "npx", "args": [ "-y", "mcp-bastion" ] } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "mcp-bastion": { "command": "npx", "args": [ "-y", "mcp-bastion" ] } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "mcp-bastion": { "command": "npx", "args": [ "-y", "mcp-bastion" ] } } }Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "mcp-bastion": { "command": "npx", "args": [ "-y", "mcp-bastion" ] } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "mcp-bastion": { "command": "npx", "args": [ "-y", "mcp-bastion" ] } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
About MCP Bastion
Instead of connecting your client to each MCP server directly, you point it at mcp-bastion, which connects to those servers for you. It acts as a normal MCP server to the client and a normal MCP client to every upstream, so the upstream servers run unchanged and removing it is a one-line config revert. The README names Claude Code, Cursor, Cline, Windsurf, Zed and Claude Desktop as clients.
The starting problem is dropped connections: when a server disconnects mid-session, the agent only sees a generic missing-tool error and cannot tell it from a tool that never existed. Bastion health-checks each server, reconnects with backoff, and exposes control tools so the agent itself can inspect connection health and recover a dropped server.
Security rests on three mechanisms. Definition integrity covers tool pinning against rug pulls, server identity, config drift and argument schemas. Runtime authorization applies per-caller policy and delegation checks before any upstream contact. The audit trail records each decision with redaction, a hash chain and signed checkpoints, mapped to NIST AI RMF and OWASP LLM Top 10. Findings are marked deterministic or heuristic, and enforcement runs in observe, balanced (default) or strict profiles. The README reports 66% coverage of the attack surface on its own open benchmark, mcp-defense-bench, and calls heuristic findings risk signals rather than proof of safety.
What it does
- Self-healing connections
- Health-checks upstream servers and reconnects with backoff.
- Agent-side control tools
- Lets the agent inspect connection health and recover a dropped server.
- Tool pinning
- Detects changed tool definitions such as rug pulls and description poisoning.
- Runtime authorization
- Applies per-caller policy to tools and argument values before upstream contact.
- Tamper-evident audit trail
- Records decisions with a hash chain and signed checkpoints, mapped to NIST AI RMF and OWASP LLM Top 10.
- Enforcement profiles
- Observe, balanced and strict profiles decide whether findings warn or block.
Good for
- Keep long agent sessions from silently losing MCP tools
- Detect when an approved tool's definition changes
- Restrict which tools and arguments each caller may use
- Keep an audit log of MCP tool calls for compliance review
- Put one security layer in front of several MCP servers
Pricing
Open source
MCP Bastion FAQ
Which clients does MCP Bastion work with?
Any compliant MCP client through configuration alone; the README lists Claude Code, Cursor, Cline, Windsurf, Zed and Claude Desktop.
Do I have to modify my existing MCP servers?
No. Your servers run unchanged and Bastion connects to them as a client.
What are the enforcement profiles?
Observe warns only, balanced (default) blocks deterministic findings and warns on heuristic ones, and strict blocks both.
How is MCP Bastion installed?
It is published on npm as mcp-bastion and runs over stdio.
Is MCP Bastion free?
Yes. MCP Bastion is open source, so you can use and self-host it for free.
How do I add MCP Bastion to Claude Code?
Run this command in your terminal: claude mcp add mcp-bastion -- npx -y mcp-bastion
What are the best alternatives to MCP Bastion?
The closest alternatives to MCP Bastion are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.


