# Midplane

Midplane — an MCP server that gives agents Postgres access with policies, column masking and query audit trails.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 6 repo stars
- Author: midplaneai
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/midplaneai/midplane/tree/HEAD/apps/gateway
- Updated: 2026-10-23
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/midplaneai-midplane

## What it does

Midplane sits between an agent and a database. The agent sends SQL, the server validates it against policies, masks columns and logs the query. The agent sees only what you allow, write queries can wait for manual approval. The server runs next to your databases, only agents connect to it.

Two modes: local with policies in a YAML file and tokens from `midplane token`, and linked mode where policies, logs and approvals come from Midplane Cloud. The `midplane setup` command prompts for connection strings, validates them and writes the gateway configuration. The audit log lives on the gateway's disk in a hash chain, export with `midplane audit export`, verify with `midplane audit verify`.

Node 24.16 or newer required.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `MIDPLANE_TOKEN` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env MIDPLANE_TOKEN=<MIDPLANE_TOKEN> --transport stdio gateway -- npx -y midplane
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add gateway --env MIDPLANE_TOKEN=<MIDPLANE_TOKEN> -- npx -y midplane
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "gateway": {
            "command": "npx",
            "args": [
                "-y",
                "midplane"
            ],
            "env": {
                "MIDPLANE_TOKEN": "<MIDPLANE_TOKEN>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "gateway": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "midplane"
            ],
            "env": {
                "MIDPLANE_TOKEN": "<MIDPLANE_TOKEN>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e MIDPLANE_TOKEN=<MIDPLANE_TOKEN> gateway npx -y midplane
```
Replace <…> with your own values

## When to use it
- grant an agent table access in Postgres with masked data
- validate an agent's SQL statements before execution
- record every query an agent sends in an audit log
- hold write queries until a person approves them
- contain an agent after it reads untrusted content

## Example prompts
- Show tables in the database via `midplane`
- Select all rows from `users` where `role` is admin
- Check the `midplane` gateway audit log

## Similar
- [supabase-security-audit](https://affpapa.org/en/nevibecode/commands/supabase-security-audit.md) — command · 1020 installs
- [Postgres MCP](https://affpapa.org/en/nevibecode/mcp/edelciomolina-postgres-mcp.md) — MCP server · ★ 5 repo stars
- [postgres](https://affpapa.org/en/nevibecode/skills/sanjay3290-postgres.md) — skill · 661 installs
- [quarry](https://affpapa.org/en/nevibecode/mcp/quarry.md) — MCP server · ★ 5 repo stars
- [Kaiva Postgres MCP](https://affpapa.org/en/nevibecode/mcp/kaiva-postgres-mcp.md) — MCP server · ★ 1 repo stars
- [database-optimization](https://affpapa.org/en/nevibecode/agents/database-optimization.md) — subagent · 3924 installs

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