# Midplane MCP server

> Lets AI agents query Postgres tables through policy checks, masked columns, approval-gated writes, and a hash-chained audit log.

- Repository: https://github.com/midplaneai/midplane
- Page: https://hostedmcp.org/servers/midplaneai/midplane
- Transport: stdio
- Stars: 5
- License: MIT
- Latest version: 0.26.2

## Install

### Claude Code

```sh
claude mcp add --env 'MIDPLANE_TOKEN=<YOUR_MIDPLANE_TOKEN>' midplane -- npx -y midplane
```

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

```json
{
  "mcpServers": {
    "midplane": {
      "command": "npx",
      "args": [
        "-y",
        "midplane"
      ],
      "env": {
        "MIDPLANE_TOKEN": "<YOUR_MIDPLANE_TOKEN>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "midplane": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "midplane"
      ],
      "env": {
        "MIDPLANE_TOKEN": "<YOUR_MIDPLANE_TOKEN>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"midplane","type":"stdio","command":"npx","args":["-y","midplane"],"env":{"MIDPLANE_TOKEN":"<YOUR_MIDPLANE_TOKEN>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "midplane": {
      "command": "npx",
      "args": [
        "-y",
        "midplane"
      ],
      "env": {
        "MIDPLANE_TOKEN": "<YOUR_MIDPLANE_TOKEN>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add midplane --env 'MIDPLANE_TOKEN=<YOUR_MIDPLANE_TOKEN>' -- npx -y midplane
```

### Codex config.toml (`~/.codex/config.toml`)

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

[mcp_servers.midplane.env]
MIDPLANE_TOKEN = "<YOUR_MIDPLANE_TOKEN>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'MIDPLANE_TOKEN=<YOUR_MIDPLANE_TOKEN>' midplane npx -- -y midplane
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "midplane": {
      "command": "npx",
      "args": [
        "-y",
        "midplane"
      ],
      "env": {
        "MIDPLANE_TOKEN": "<YOUR_MIDPLANE_TOKEN>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `MIDPLANE_TOKEN` | yes | yes | A token from `midplane token`, verified at start and on every call. It stays in this entry, so give it a --ttl (seconds) as long as the entry should work: the default is an hour. |

## FAQ

### What does Midplane do between AI agents and Postgres?

Midplane is an MCP gateway that parses every statement an agent sends, checks it against a policy, and records it before it runs, granting table access, masking columns, and holding writes for approval.

### How do I run Midplane in local mode?

In local mode the policy lives in a YAML file and tokens come from `midplane token`.

### Where is Midplane's audit log stored and how can I export it?

The audit log stays on the gateway's disk and is hash-chained, and you can export or verify it with the audit commands.

### What Node version does Midplane require?

Midplane requires Node 24.16 or newer.

### Is Midplane open source?

Yes, Midplane is MIT licensed.
