Skip to content
MCP server

DB Explorer

Read-only SQL access to PostgreSQL, MySQL and SQLite with schema, EXPLAIN and index advice

Runs locally

DB Explorer is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.

Pricing
Open source
Platforms
CLI, Self-hosted
Runs
Locally
What it can do
Can change data (1 tool)
Version
0.1.0

Similar MCP servers

Install

Add with the CLI

Run in a terminal

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

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

Or share it with your project

Add to .mcp.json

{
  "mcpServers": {
    "db-explorer-mcp-server": {
      "command": "uvx",
      "args": [
        "db-explorer-mcp-server"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>"
      }
    }
  }
}

Claude Code setup guide

Add to claude_desktop_config.json

{
  "mcpServers": {
    "db-explorer-mcp-server": {
      "command": "uvx",
      "args": [
        "db-explorer-mcp-server"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>"
      }
    }
  }
}

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

Claude Desktop setup guide

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "db-explorer-mcp-server": {
      "command": "uvx",
      "args": [
        "db-explorer-mcp-server"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>"
      }
    }
  }
}

Use .cursor/mcp.json in a project to share it with the project.

Cursor setup guide

Add to ~/.copilot/mcp-config.json

{
  "mcpServers": {
    "db-explorer-mcp-server": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "db-explorer-mcp-server"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>"
      }
    }
  }
}

Or put the same entry in .mcp.json at your workspace root to share it.

VS Code setup guide

Add with the CLI

Run in a terminal

codex mcp add db-explorer-mcp-server --env DATABASE_URL='<DATABASE_URL>' -- uvx db-explorer-mcp-server

Or add to config.toml

Add to ~/.codex/config.toml

[mcp_servers.db-explorer-mcp-server]
command = "uvx"
args = ["db-explorer-mcp-server"]
env = { DATABASE_URL = "<DATABASE_URL>" }

Codex setup guide

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "db-explorer-mcp-server": {
      "command": "uvx",
      "args": [
        "db-explorer-mcp-server"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>"
      }
    }
  }
}
  • Gemini CLI and Antigravity

    Gemini CLI

    Add to ~/.gemini/settings.json

    {
      "mcpServers": {
        "db-explorer-mcp-server": {
          "command": "uvx",
          "args": [
            "db-explorer-mcp-server"
          ],
          "env": {
            "DATABASE_URL": "<DATABASE_URL>"
          }
        }
      }
    }

    Or run: gemini mcp add -s user -e DATABASE_URL='<DATABASE_URL>' db-explorer-mcp-server uvx -- db-explorer-mcp-server

    Antigravity

    Add to ~/.gemini/config/mcp_config.json

    {
      "mcpServers": {
        "db-explorer-mcp-server": {
          "command": "uvx",
          "args": [
            "db-explorer-mcp-server"
          ],
          "env": {
            "DATABASE_URL": "<DATABASE_URL>"
          }
        }
      }
    }

    Use .agents/mcp_config.json to add it to one workspace only.

    Gemini CLI and Antigravity setup guide

  • Devin Desktop (formerly Windsurf)

    Add to ~/.config/devin/mcp_config.json

    {
      "mcpServers": {
        "db-explorer-mcp-server": {
          "command": "uvx",
          "args": [
            "db-explorer-mcp-server"
          ],
          "env": {
            "DATABASE_URL": "<DATABASE_URL>"
          }
        }
      }
    }

    On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

    Devin Desktop setup guide

  • Cline

    Add to cline_mcp_settings.json

    {
      "mcpServers": {
        "db-explorer-mcp-server": {
          "command": "uvx",
          "args": [
            "db-explorer-mcp-server"
          ],
          "env": {
            "DATABASE_URL": "<DATABASE_URL>"
          }
        }
      }
    }

    Open it from the MCP Servers icon → Configure → Configure MCP Servers.

    Cline setup guide

  • Zed

    Add to Zed settings.json

    {
      "context_servers": {
        "db-explorer-mcp-server": {
          "command": "uvx",
          "args": [
            "db-explorer-mcp-server"
          ],
          "env": {
            "DATABASE_URL": "<DATABASE_URL>"
          }
        }
      }
    }

    Open it with zed: open settings file. Merge context_servers into the settings you already have.

    Zed setup guide

  • JetBrains AI Assistant and Junie

    AI Assistant

    Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add

    {
      "mcpServers": {
        "db-explorer-mcp-server": {
          "command": "uvx",
          "args": [
            "db-explorer-mcp-server"
          ],
          "env": {
            "DATABASE_URL": "<DATABASE_URL>"
          }
        }
      }
    }

    The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

    Junie

    Add to ~/.junie/mcp/mcp.json

    {
      "mcpServers": {
        "db-explorer-mcp-server": {
          "command": "uvx",
          "args": [
            "db-explorer-mcp-server"
          ],
          "env": {
            "DATABASE_URL": "<DATABASE_URL>"
          }
        }
      }
    }

    Use .junie/mcp/mcp.json to share it with a project.

    JetBrains AI Assistant and Junie setup guide

  • Kiro

    Add to ~/.kiro/settings/mcp.json

    {
      "mcpServers": {
        "db-explorer-mcp-server": {
          "command": "uvx",
          "args": [
            "db-explorer-mcp-server"
          ],
          "env": {
            "DATABASE_URL": "<DATABASE_URL>"
          }
        }
      }
    }

    Use .kiro/settings/mcp.json to add it to one workspace only.

    Kiro setup guide

Using several servers? Build one config file with the MCP config generator.

Configuration

  • DATABASE_URLSQLAlchemy URL of the database to explore. Unset opens the bundled demo database.

About DB Explorer

DB Explorer is built around one idea: the SQL your assistant writes is untrusted, so it is parsed rather than pattern-matched. The safety layer uses a SQL parser to accept only a single read-only SELECT, with no comments, a denylist and a row cap, so writes are blocked structurally and a rejected query never reaches the database. The server itself makes no LLM calls and needs no API key.

It exposes seven tools covering schema exploration, query execution, execution plans, schema health, index suggestions and migration review; migration files are parsed and never executed. It runs locally over stdio or remotely over streamable HTTP with bearer tokens. Set DATABASE_URL to a SQLAlchemy URL; with it unset, a bundled demo database opens.

The README reports 336 tests plus 26 run against real PostgreSQL and MySQL in CI, and an evaluation in which Claude completed 14 of 14 database tasks with no failed tool calls. It installs from PyPI with uvx db-explorer-mcp-server and needs Python 3.11 or later.

Tools this server provides (7)

Taken from the project documentation; the running server may differ.

From the tool list in its README, going by the names, 1 of 7 tools changes data; 3 names don't say.

From the server's own tool labels and tool names; not verified by us.

explore_schema
Inspect database structure
execute_queryName suggests: changes
Run a validated read-only SELECT
explain_queryName suggests: reads
Show the execution plan for a query
validate_schemaName suggests: reads
Check a schema for problems
suggest_index
Recommend indexes
migration_context
Provide context for reviewing a migration
validate_migrationName suggests: reads
Review a migration without executing it

What it does

SELECT-only safety
Parses SQL and rejects anything but one read-only SELECT, with a row cap.
Schema exploration
Inspects tables, columns and relationships across three database engines.
Execution plans
Runs EXPLAIN on a query to show how the database will run it.
Index suggestions
Recommends indexes based on the schema and queries.
Migration review
Reads up and down migrations without executing them.
Local or remote
Runs over stdio, or over streamable HTTP with bearer tokens.

Good for

  • Let an assistant explore a production replica without write risk
  • Audit a schema for design problems
  • Get index advice for a slow query
  • Review a migration before applying it

Pricing

Open source

Open source on GitHub

DB Explorer FAQ

Can DB Explorer modify my data?

No. Only a single read-only SELECT is accepted, enforced at parser level.

Which databases work?

PostgreSQL, MySQL and SQLite, through SQLAlchemy.

Does DB Explorer need an API key?

No. The server makes no LLM calls; reasoning happens in your MCP client.

How do I install DB Explorer?

Run uvx db-explorer-mcp-server, or add it with claude mcp add and set DATABASE_URL.

Is DB Explorer free?

Yes. DB Explorer is open source, so you can use and self-host it for free.

How do I add DB Explorer to Claude Code?

Run this command in your terminal: claude mcp add db-explorer-mcp-server --env DATABASE_URL='<DATABASE_URL>' -- uvx db-explorer-mcp-server

What are the best alternatives to DB Explorer?

The closest alternatives to DB Explorer are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

Where this comes from

  • Description: written from the project's README.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers