Skip to main content

DB Explorer — MCP Server

An MCP (Model Context Protocol) server that lets Claude explore and query your SQL databases.

What It Does

Connect this server to Claude Desktop (or any MCP client) and Claude can:

  • List all tables in your database with row counts
  • Describe table structure — columns, types, primary keys, foreign keys
  • (Coming soon) Run read-only SQL queries, explain query plans, and more

Supported Databases

  • SQLite (built-in, no extra setup)
  • PostgreSQL (install with pip install asyncpg)
  • MySQL (install with pip install aiomysql)

Quick Start

1. Clone and install

git clone <your-repo-url>
cd db-explorer
pip install -e "."

2. Set up your database connection

cp .env.example .env
# Edit .env and set your DATABASE_URL

3. Create sample data (optional)

python seed_database.py

This creates a sample.db SQLite file with a mini e-commerce database (customers, products, orders).

4. Test the server

python -m db_explorer.server

5. Connect to Claude Desktop

Edit your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json Windows: %AppData%\Claude\claude_desktop_config.json

Add this:

{
  "mcpServers": {
    "db-explorer": {
      "command": "python",
      "args": ["-m", "db_explorer.server"],
      "cwd": "/absolute/path/to/db-explorer"
    }
  }
}

Restart Claude Desktop. You should see "db-explorer" in the connectors menu.

6. Try it out!

Ask Claude:

  • "What tables are in my database?"
  • "Describe the orders table"
  • "What's the structure of the customers table?"

Project Structure

db-explorer/
├── .env                  # Your database URL (not committed to git)
├── .env.example          # Template for .env
├── pyproject.toml        # Project config and dependencies
├── seed_database.py      # Creates sample data for testing
├── sample.db             # Sample SQLite database (created by seed script)
├── README.md
└── src/db_explorer/
    ├── __init__.py
    ├── server.py          # MCP server + tool definitions
    ├── connection.py      # Database connection manager
    └── schema.py          # Schema inspection logic

Available Tools

Tool Description
list_tables Lists all tables with row counts
describe_table Shows columns, types, keys for a table
run_query Runs read-only SQL queries (SELECT only)
explain_query Shows the execution plan for a query
get_table_stats Per-column null counts, distinct values, min/max
get_indexes Shows indexes on a table
get_relationships Maps all foreign keys across the whole database
get_server_info Shows DB type, table count, and connection status

License

MIT

Metadata

Release files for db-explorer-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for db-explorer-mcp 0.1.0
File Size Uploaded
db_explorer_mcp-0.1.0.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for db-explorer-mcp 0.1.0
File Interpreter ABI Platform
db_explorer_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.3 kB

Release files / db_explorer_mcp-0.1.0.tar.gz

Download URL db_explorer_mcp-0.1.0.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
22774014483c69cd958d77f434af7b9eb1a8267faa7a8fde2045ac83a109ce88
BLAKE2b-256 checksum
How to use checksums
cd679b3f6c0461a68154093a82d64fd45114ebeb01e83ecd8e9894b28df24cc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release files / db_explorer_mcp-0.1.0-py3-none-any.whl

Download URL db_explorer_mcp-0.1.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50100a80a98cfcaa829714a532bac96b37387ba55bd2b31900d2184a36c8d075
BLAKE2b-256 checksum
How to use checksums
245b1088bbcacf09106cbcd2151c6bcd4456e11008111a505e3a4148041d4902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page