Postgres MCP server for AI agents. Connect the tables you've been keeping off-limits. PII masked at the source, policy enforced on the SQL AST, writes held for human approval, everything audited. MIT, self-hostable.
- ✓Open-source license (MIT)
- ✓Actively maintained (<30d)
- ✓Clear description
- ✓Topics declared
- ✓Documented (README)
claude mcp add midplane -- npx -y midplane{
"mcpServers": {
"midplane": {
"command": "npx",
"args": ["-y", "midplane"]
}
}
}MCP Servers overview
# Midplane
[](./LICENSE)
[](https://github.com/midplaneai/midplane/actions/workflows/engine-test.yml)
[](https://midplane.ai/docs)
[](https://modelcontextprotocol.io/)
**Safe-by-default SQL guardrails for AI agents.** Midplane sits in the query path
between an AI agent (Claude, Cursor, any MCP client) and your Postgres database. It
parses every statement with a real SQL AST — not a regex blocklist — enforces a
declarative per-table access policy, blocks destructive DML/DDL, and writes an
event-sourced audit log of which agent ran what, **before** the query executes.
> 📖 **Full documentation lives at [midplane.ai/docs](https://midplane.ai/docs)** —
> agent setup, the policy reference, self-hosting, deployment, and the threat model.
> This README is just the orientation.
<img width="960" height="540" alt="midplane-chat-demo" src="https://github.com/user-attachments/assets/d9800b2a-dc45-4a6e-a0b2-3aa219b1009a" />
## Why this exists
AI coding agents are being plugged into production Postgres without an audit trail
or a safety layer. The deprecated Anthropic reference Postgres MCP shipped a
stacked-statement injection vector (Datadog Security Labs, 2025); the common
service-role setup hands an agent a connection that can read and write every table.
Midplane parses every query as an AST, denies the dangerous shapes, and writes a
durable audit row **before** the query reaches your database.
## What it blocks
- **Destructive writes by default** — `DELETE FROM users` is denied even with a
`WHERE`, until you opt the table into `read_write`.
- **Whole-table wipes and schema destruction** — no-`WHERE` `DELETE` / `UPDATE`
and all `DROP` / `TRUNCATE` / `ALTER`, regardless of table policy.
- **Stacked-statement injection** — `SELECT 1; DROP TABLE users` denied at parse time.
- **Writes hidden inside a read** — `WITH x AS (DELETE FROM users RETURNING *)
SELECT * FROM x` is denied at the inner `DELETE`, not the outer `SELECT`. The
same recursive walk covers subqueries, UNION arms, and JOINs.
The full policy model, the parse → policy → audit pipeline, and the adversarial
corpus that pins it are documented at [midplane.ai/docs](https://midplane.ai/docs).
## In a real chat
A `delete all users` prompt to Claude Code, against a Midplane-fronted DB:
> ⏺ Hold on — that's destructive and irreversible. Before I run
> `DELETE FROM public.users`, please confirm.
>
> *user: confirm delete all users*
>
> ⏺ Midplane blocked it: *"writes to table `users` are not allowed by the
> table-access policy."* The DELETE was audited but not executed.
## Quick start
Three ways in — same open-core codebase behind all of them. Step-by-step guides
are at **[midplane.ai/docs](https://midplane.ai/docs)**.
### Managed cloud
The fastest way to try Midplane: **[sign up at app.midplane.ai](https://app.midplane.ai)**
and go from zero to your first guarded query in a couple of minutes. Dashboard,
policy editor, hosted audit log, agent-token issuance. Nothing to install,
multi-region, fully supported.
### Guard one database yourself
Put the MIT engine in front of a Postgres database and point an agent at it.
Nothing to install — `npx` ships with Node and fetches the
[`midplane`](https://www.npmjs.com/package/midplane) package on first run
(needs Node 22.16+; on anything older it says so and exits). Add this to your
MCP client's config (Claude Code, Claude Desktop, Cursor — they all take this
shape):
```json
{
"mcpServers": {
"midplane": {
"command": "npx",
"args": ["-y", "midplane", "server", "--stdio"],
"env": { "DATABASE_URL": "postgres://user:pass@host:5432/db" }
}
}
}
```
Keep the connection string in that `env` block rather than on a command line,
where it would leak to `ps aux` and your shell history. The block still lands in
a plaintext config file, so give Midplane its own least-privilege Postgres role:
it governs which SQL runs, not what the role underneath it can reach.
That config is already the safe default: reads allowed, writes and DDL denied,
every query audited to `~/.midplane/audit.db`. Read the log back with
`npx midplane audit denies`. To open specific tables up, generate a policy with
`npx midplane init` — it introspects your schema over a read-only connection,
suggests a tenant column, and writes a validated `midplane.policy.yaml`.
> For a CI pipeline or a long-lived sidecar, the same engine ships as a
> self-contained image with no Node in it — `midplane/midplane:0.20.0`, serving
> Streamable HTTP instead of stdio.
> [Setup](https://midplane.ai/docs) · [`engine/README.md`](./engine/README.md).
### Self-host the whole app
The complete single-tenant product — dashboard, policy editor, audit log,
agent-token issuance — keyless and uncapped, on your own Postgres. Docker is the
only prerequisite:
```bash
git clone https://github.com/midplaneai/midplane && cd midplane
./bin/self-host up # → http://localhost:3000
```
That generates secrets into `.env.self-host`, brings up Postgres + the web app,
applies migrations on boot, and prints the dashboard URL — the first
email+password signup becomes the owner.
Running from source, the single-image deploy, the engine-spawn topology, and the
full walkthrough: [midplane.ai/docs](https://midplane.ai/docs) (in-repo:
[`SELF_HOST.md`](./SELF_HOST.md)).
## Open core
Midplane is **open core, MIT, and self-hostable.** Everything outside
`apps/web/src/ee/` is the Community Edition — the whole single-tenant product,
uncapped when self-hosted. `apps/web/src/ee/` is the commercial Enterprise Edition
(SSO/SAML today; the governance band over time); deleting it leaves a working MIT
build. The managed cloud is the same codebase and the supported, paid path. See
[`LICENSE`](./LICENSE) for the MIT terms and [`NOTICE`](./NOTICE) for the `ee/`
carve-out.
## Architecture
One codebase, two deployables:
- **Control plane** (repo root) — dashboard, policy management, audit views,
agent-token issuance, hosted MCP proxy. MIT except `apps/web/src/ee/`.
- **Engine** ([`engine/`](./engine)) — the MIT query-path engine, compiled to a
self-contained binary. The control plane spawns it per project and never
reimplements it, so hosted and self-host run the exact same engine — only the
packaging differs.
```
apps/web Next.js dashboard + Better Auth + projects API
packages/db Drizzle schema (customers, projects, audit index)
packages/kms encryptDsn / decryptDsn (env-mode dev, AWS KMS prod)
packages/router Hosted MCP request handler — token → project → engine
engine/ The MIT query-path engine
infra/telemetry-proxy Cloudflare Worker for anonymized OSS install telemetry
```
Operating the managed multi-region cloud (Fly + Neon + KMS) is in
[`docs/deploy.md`](./docs/deploy.md).
## Contributing
Issues and PRs welcome — start with [`CONTRIBUTING.md`](./CONTRIBUTING.md). The
single highest-leverage contribution is a new entry in the adversarial SQL corpus:
a bypass attempt and the policy fix that defeats it. Commits are DCO-signed
(`git commit -s`). For security issues, follow [`SECURITY.md`](./SECURITY.md) —
don't open a public issue.
## License
MIT — see [`LICENSE`](./LICENSE). No copyleft, no BSL, no source-available rug-pull.
The one carve-out is `apps/web/src/ee/` (the commercial Enterprise Edition, governed
by [`apps/web/src/ee/LICENSE`](./apps/web/src/ee/LICENSE) and recorded in
[`NOTICE`](./NOTICE)); deleting it leaves a fully working MIT build.
---
**More:** [Docs](https://midplane.ai/docs) · [Pricing](./PRICING.md) ·
[Support](./SUPPORT.md) · [Design system](./DESIGN.md) ·
[Code of Conduct](./CODE_OF_CONDUCT.md)
What people ask about midplane
What is midplaneai/midplane?
+
midplaneai/midplane is mcp servers for the Claude AI ecosystem. Postgres MCP server for AI agents. Connect the tables you've been keeping off-limits. PII masked at the source, policy enforced on the SQL AST, writes held for human approval, everything audited. MIT, self-hostable. It has 4 GitHub stars and its last recorded update is dated 2026-08-25.
How do I install midplane?
+
You can install midplane by cloning the repository (https://github.com/midplaneai/midplane) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is midplaneai/midplane safe to use?
+
Our security agent has analyzed midplaneai/midplane and assigned a Trust Score of 95/100 (tier: Verified). See the full breakdown of passed checks and flags on this page.
Who maintains midplaneai/midplane?
+
midplaneai/midplane is maintained by midplaneai. The last recorded GitHub activity is dated 2026-08-25, with 1 open issues.
Are there alternatives to midplane?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy midplane to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/midplaneai-midplane)<a href="https://claudewave.com/repo/midplaneai-midplane"><img src="https://claudewave.com/api/badge/midplaneai-midplane" alt="Featured on ClaudeWave: midplaneai/midplane" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
The fastest path to AI-powered full stack observability, even for lean teams.
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!