Database MCP Servers for Claude Code — 11 Tested Integrations | AI Code Toolkit
11 tested integrations · Read-only by default · Official + community

Database MCP Servers

The highest-ROI MCP category for most projects. Schema awareness, query realism, and migration safety — 11 database MCP servers covering Postgres, MySQL, SQLite, MongoDB, Redis, DynamoDB, and the major managed Postgres platforms.

11
Databases
3
Auth Patterns
Read-Only
By Default
48h
Update SLA

Why database MCPs are the highest-ROI Claude Code integration

Ask Claude to "add pagination to the users API" without a database MCP and you get a reasonable guess based on your model definition. Ask the same thing with a Postgres MCP connected, and Claude reads the actual users schema, notices you already have a created_at DESC index, and writes cursor-based pagination that uses that index. Same model, same question — a code review's worth of quality difference in one exchange.

That's the pattern that makes database MCPs the single highest-ROI integration for most projects: schema awareness leads directly to better code. Query patterns, migration correctness, index usage, and constraint respect all improve when Claude can read the actual database instead of guessing from an ORM file.

The lens: Database MCPs solve three problems at once — schema awareness (Claude knows what tables and columns actually exist), query realism (Claude can test that a query works before suggesting it), and migration safety (Claude can inspect current state before writing a migration). Any one is worth installing for; together they change how Claude works on data code.

Official vs community servers — when it matters

Most popular databases have both official first-party MCP servers and community wrappers. Rules of thumb:

  • Prefer official when it exists (Postgres has one from Anthropic; Supabase and Neon ship their own; Firebase is Google's). Official servers are audited, have real security review, and get updated with the database itself.
  • Community wrappers are fine for less-common databases, dev-time tools, and prototyping. Just review the source before pointing it at a database with real data.
  • Avoid any MCP server that asks for a connection string with elevated privileges without explaining why. Legitimate servers document what permissions they need.

The three auth patterns you'll see

Every database MCP falls into one of three categories:

  • Connection string — the most common. postgres://user:pass@host/db or equivalent. Simple, but the string is a full credential — treat it like one.
  • Managed platform tokens — Supabase, Neon, PlanetScale, Firebase. Platform-specific tokens with scopes you can control. Better security profile than raw connection strings.
  • IAM / cloud identity — DynamoDB, Firebase Admin, and AWS RDS with IAM auth. Uses the cloud provider's identity system. Safest but requires more setup.

Reference config — Postgres with a read-only connection

json .claude/settings.json
{ "mcpServers": { "postgres-readonly": { "type": "stdio", "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-postgres", "${DATABASE_URL_READONLY}" ] }, "postgres-migrate": { "type": "stdio", "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-postgres", "${DATABASE_URL_MIGRATE}" ] } } }

Two connections, two named servers — postgres-readonly for schema queries and normal exploration, postgres-migrate for migration work. The read-only one uses a database user with only SELECT privileges; the migrate one has schema-mod rights but only exists in developer environments. This split is the single most important safety pattern for database MCPs.

Four safety patterns every team should adopt

  • Read-only by default. Point Claude at a read-only replica or a user with only SELECT rights. If mutations are needed, use a second explicitly-named MCP server. Two connections force intent.
  • Statement timeout. Set a server-level statement_timeout (e.g., 5 seconds). Prevents a mistake from running an unbounded query on production. Cheap insurance.
  • Row limits. Wrap the MCP with a PreToolUse hook that appends LIMIT 1000 to any query without a limit. Stops accidental full-table scans.
  • Never production. Never point a Claude Code MCP at production. Use a staging replica, a scrubbed dev copy, or an on-demand branch (Neon/PlanetScale make this easy). The convenience of "just check prod" isn't worth the tail risk.

Database MCP vs just running psql

Fair question. A database MCP gives Claude four things a raw shell command doesn't:

  • Structured tool inputs — Claude doesn't have to construct correct SQL syntax; the MCP validates.
  • Typed outputs — results come back as structured data, not text Claude has to parse.
  • Resources — schemas, table lists, and index info are exposed as MCP resources Claude can query without running SQL.
  • Guardrails at the MCP layer — the official Postgres MCP has a read-only mode; a shell doesn't.

Roughly: use the MCP when you want Claude to think about the database as a system. Use raw psql via Bash when you want to run a specific migration or a one-off script.

Complete Listing

All 11 database MCP servers, grouped by category

Each server has documented auth setup, safety patterns, and the specific tools and resources it exposes. Prefer official first-party servers when available.

Decision Framework

Which database MCP should I install?

Quick guidance for the common project shapes teams work on.

You're on plain Postgres or MySQL
Install the official postgres or mysql MCP. Use read-only connection by default. Add a second read-write connection under a different server name only for migration work.
You're on Supabase, Neon, or PlanetScale
Install the platform's first-party MCP instead of raw Postgres. You get platform-specific features (auth, branches, deploy requests) plus the standard SQL surface. Skip the generic server — the platform one is strictly more useful.
You want Claude to test migrations safely
Use Neon or PlanetScale. Both make branch-per-migration trivial — Claude can create a branch, apply the migration, verify, and delete without touching main. Best safety profile for schema work.
Your app uses Prisma or Drizzle
Install the underlying database MCP (postgres or mysql). For Prisma specifically, also install the Prisma MCP for schema/migration-file operations. Two servers, complementary.
You use MongoDB or DynamoDB
Install the matching NoSQL MCP. Note that MongoDB aggregation pipelines are harder to write correctly than SQL — the MCP's ability to test queries before suggesting them is especially valuable here.
You want Redis awareness for caching decisions
Install the redis MCP. Especially useful for hot-key analysis, TTL debugging, and validating cache-key patterns match what production sees.

🐛 Hit an error while using these?

Our sister site AI Error Hub covers Claude Code errors, MCP connection failures, and stack traces — cross-referenced with everything on this site.

Visit AI Error Hub →
FAQ

Frequently asked questions

The questions developers ask most about databases.

Whichever database your project actually uses — that's not a dodge, it's the answer.

  • Plain Postgresofficial postgres MCP.
  • Supabase, Neon, PlanetScale → the platform-specific MCP (broader surface, includes SQL).
  • MongoDB, MySQL, Redis → the matching MCP.

If you're setting up a starter environment without a specific project, Postgres is the most common choice.

Read-only by default. Point the MCP at a database user with only SELECT privileges (or a read-only replica).

If mutations are needed, use a second MCP server with a different name (e.g., postgres-migrate) and a connection that has write rights.

Two named servers force explicit intent — Claude has to be pointed at the write-capable server, which is much safer than one god-mode connection.

Technically yes; you should not.

The convenience of "let Claude check the prod database directly" is never worth the tail risk of:

  • An accidental full-table scan.
  • An unbounded query on a hot table.
  • A subtle mistake with real data.

Use a staging replica, a scrubbed dev copy, or an on-demand branch (Neon/PlanetScale make branching trivial). The MCP experience is nearly identical; the risk profile is not.

Yes. Set statement_timeout at the database session level via the connection string. For Postgres:

postgres://user:pass@host/db?options=-c%20statement_timeout%3D5000

… gives you 5 seconds. Any query that runs longer gets terminated.

Cheap insurance against a mistake causing a runaway query on a shared database — set it for both dev and staging MCPs.

Install both. They complement each other:

  • Database MCP (postgres or mysql) — reads the actual schema and tests queries. Reality checks.
  • Prisma MCP — handles schema-file operations and migration management. Source-of-truth changes.

This pattern applies to Drizzle and other ORMs too, once their MCPs mature.

Yes, with two caveats:

  1. Use session mode or transaction mode carefully — the MCP's expectations around session state (temp tables, prepared statements) can conflict with pool modes. Session mode is safest; transaction mode works if the MCP doesn't rely on cross-statement state.
  2. Keep the MCP's connection count in mind — it counts against your pool budget.

Both are excellent; the choice comes down to what you use in production.

  • Neon is Postgres — pick if production is Postgres or you value the Postgres feature set (JSONB, PostGIS, extensions).
  • PlanetScale is Vitess-backed MySQL — pick if you're already on MySQL.

Both offer trivial branching that makes Claude Code + migrations safe to iterate on. The underlying DB is the real deciding factor.

Three layers of defense:

  1. Statement timeout at the connection level (query terminated after N seconds).
  2. A PreToolUse hook that appends LIMIT 1000 to any query without a limit.
  3. A note in your CLAUDE.md telling Claude to always add explicit LIMIT clauses when exploring unfamiliar tables.

Any one of the three helps; all three together is bulletproof.

Depends on the server:

  • Reputable community MCPs (well-starred on GitHub, active maintainers, clear source) are generally fine for dev-time use.
  • Review the source before pointing at anything sensitive.
  • Prefer first-party official MCPs when they exist — Anthropic's Postgres MCP, Supabase's own, Neon's own, Cloudflare's own.

For less-common databases, community wrappers are often the only option; treat them like any dependency and audit before adopting.

Yes, and it's a great pairing:

  • The MCP gives Claude the ability to read schema and run queries.
  • The subagent (e.g., postgres-dba) gives Claude the mental model — how to think about indexes, vacuum tuning, query plans.

Alone, the MCP is a tool without a specialist; the subagent is a specialist without hands. Together they're a database engineer with a database open.

Share with