Skip to main content
MCP server CX Codex

DB Explorer — Claude Code MCP server: SQL and setup

A read-only MCP server for exploring schemas, running safe SQL, and reviewing database plans across PostgreSQL, MySQL, and SQLite.

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

What DB Explorer does

DB Explorer lets an MCP client inspect a relational database and ask for read-only query results. Its tools cover schema exploration, query execution, execution-plan analysis, schema checks, index suggestions, and migration review through explore_schema, execute_query, explain_query, validate_schema, suggest_index, migration_context, and validate_migration.

The server parses model-generated SQL before it reaches the database. It accepts one read-only SELECT, rejects write operations, and caps returned rows. Migration checks inspect up/down changes without applying them. Local connections use stdio; remote deployments can use streamable HTTP with bearer-token authentication.

Python 3.11+ and uv are required. Set DATABASE_URL for PostgreSQL, MySQL, or SQLite. The server does not make its own LLM API calls, so no API key is needed for its reasoning. Without Python 3.11+ and uv, it will not start.

What it helps with

  • inspect a relational database schema
  • run a guarded SELECT query
  • read a SQL execution plan
  • identify possible index additions
  • review a migration without applying it

Example prompts for the agent

  • Show me the database schema and explain the relationships between its tables.
  • Run a read-only SELECT to find orders from the requested period.
  • Inspect this query plan and suggest an index when the plan supports one.

How to install DB Explorer

Platform CLI

claude mcp add db-explorer-mcp-server -e DATABASE_URL=<DATABASE_URL> -- uvx db-explorer-mcp-server

Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from db-explorer-mcp-server <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 Explorer

How do I install DB Explorer in Claude Code?

Run claude mcp add db-explorer-mcp-server -e DATABASE_URL=<DATABASE_URL> -- uvx db-explorer-mcp-server. Then connect the server in Claude Code.

What does DB Explorer do?

It gives an agent read-only access to schema details, SELECT results, execution plans, index suggestions, and migration checks. Write operations are rejected.

Which databases does DB Explorer support?

It supports PostgreSQL, MySQL, and SQLite. The connection is provided through DATABASE_URL.

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