# MCP Bastion

> MCP Bastion is an open-source MCP server for security. MCP proxy adding auto-reconnect, tool-security checks and audit logs. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Self-hosted
- **Repository:** https://github.com/gowthaman90/mcp-bastion
- **MCP Registry name:** io.github.Gowthaman90/mcp-bastion
- **Categories:** [security](https://ai-powered.com/categories/security), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-23

## About

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.

## Features

- **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

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add mcp-bastion -- npx -y mcp-bastion
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "mcp-bastion": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-bastion"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mcp-bastion": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-bastion"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mcp-bastion": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-bastion"
      ]
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```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.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add mcp-bastion -- npx -y mcp-bastion
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.mcp-bastion]
command = "npx"
args = ["-y", "mcp-bastion"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "mcp-bastion": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-bastion"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user mcp-bastion npx -- -y mcp-bastion

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "mcp-bastion": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-bastion"
      ]
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```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 (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "mcp-bastion": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-bastion"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```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 (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "mcp-bastion": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-bastion"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "mcp-bastion": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-bastion"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "mcp-bastion": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-bastion"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mcp-bastion": {
      "command": "npx",
      "args": [
        "-y",
        "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.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Context7](https://ai-powered.com/mcp/context7): Context7 is a freemium MCP server for developer tools.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-2): Chrome DevTools MCP is an open-source MCP server for browser automation.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/mcp-bastion
