Skip to main content
MCP server CX Codex

DB Connect MCP — MCP server for PostgreSQL, MySQL and ClickHouse

Gives an agent read-only access to PostgreSQL, MySQL and ClickHouse: schemas, tables, relationships and column profiles.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add db-connect-mcp -e DATABASE_URL=<DATABASE_URL> -- uvx db-connect-mcp
Open on GitHub

What DB Connect MCP does

The server stays read-only. It accepts SELECT and WITH only, and adds limits so a query cannot drag back a whole table. Every connection is opened with read-only parameters.

Three adapters sit inside: PostgreSQL with metadata and statistics, MySQL and MariaDB, and ClickHouse for analytical workloads. You get column profiling (mean, median, quartiles, value frequency), data sampling, object search and query plans. PostgreSQL also has hypothetical indexes through the HypoPG extension — opt-in, requiring DB_HYPOPG_ENABLED=true and an administrator who installed the extension. Those are planner estimates, not measured speedups.

You need Python 3.10 or higher and a connection string in DATABASE_URL. Databases behind a firewall are reachable over SSH tunnels with a password or a private key. The server does better with databases whose tables and columns carry comments: the agent then understands the data model instead of guessing from names alone.

What it helps with

  • explore an unfamiliar database schema without a manual client
  • pull the value distribution of a column
  • find tables and indexes by name
  • check a query plan before running the query
  • compare a hypothetical index against the current plan

Example prompts for the agent

  • List all schemas and show tables with their sizes
  • Describe the orders table and its foreign key relationships
  • Profile the status column in the orders table

How to install DB Connect MCP

Platform CLI

claude mcp add db-connect-mcp -e DATABASE_URL=<DATABASE_URL> -- uvx db-connect-mcp

Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from db-connect-mcp <command>

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about DB Connect MCP

How do I install DB Connect MCP in Claude Code?

Run claude mcp add db-connect-mcp -e DATABASE_URL=<DATABASE_URL> -- uvx db-connect-mcp with your own connection string.

What does DB Connect MCP do?

It gives an agent read-only access to PostgreSQL, MySQL and ClickHouse: schemas, tables, columns, relationships, data profiling and query plans.

Which databases are supported?

PostgreSQL, MySQL and MariaDB, plus ClickHouse. Each type has its own adapter with safety checks.

Similar MCP servers

All MCP servers for Data and databases →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor