# mcp-bastion

A proxy that sits between your MCP client and your servers: it watches connections, restarts dropped ones, and hands the agent tools to recover them itself.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 7
- Author: Gowthaman90
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/Gowthaman90/mcp-bastion
- Updated: 2026-10-20
- HTML: https://affpapa.org/en/nevibecode/mcp/mcp-bastion

## What it does

Your client talks to Bastion instead of talking to each server directly, and Bastion talks to those servers for it. Nothing changes on the server side, and undoing the setup is a config revert. For stdio servers it runs health checks and reconnects with capped exponential backoff.

The part that matters in long sessions: `bastion__status` and `bastion__reconnect`. Without them a dropped server looks like a tool that never existed, and only a human can bring it back. With them the agent checks connection health and revives the server on its own. Tool names from different servers get namespaced, so one server cannot shadow another.

There is runtime security too. Tool definitions are pinned, and a server that changes a tool after approval gets blocked. Audit events can go to the console, a file, or a webhook. Node.js 20 or newer is required to run it.

## Requirements
- Needs: Node.js (commands run via npx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add mcp-bastion -- npx -y mcp-bastion
```

### Codex

**Platform CLI**
```bash
codex mcp add mcp-bastion -- npx -y mcp-bastion
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "mcp-bastion": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-bastion"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "mcp-bastion": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "mcp-bastion"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add mcp-bastion npx -y mcp-bastion
```

## When to use it
- recover a crashed MCP server without restarting the session
- tell why a tool disappeared from the list mid-session
- merge several MCP servers into one connection without name clashes
- block a server from redefining a tool after approval
- keep a log of tool calls for review

## Example prompts
- Check the MCP servers with bastion__status
- Reconnect the dropped server using bastion__reconnect
- Route all my MCP servers through mcp-bastion and list the tools that are available

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872

## Other versions with the same name
- [MCP-Bastion · vaquarkhan](https://affpapa.org/en/nevibecode/mcp/vaquarkhan-mcp-bastion.md) — ★ 7

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
