I got tired of switching between Claude Code and my database client every time I needed to check some data. So I built mcp-database — a Python MCP server that lets Claude query SQLite, PostgreSQL, and MySQL databases directly.
The Problem
You are in Claude Code, writing a feature. You need to check what columns the orders table has. What do you do?
- Open a new terminal
- Connect to the database
- Run
DESCRIBE orders - Copy the result
- Go back to Claude
- Paste it
Six steps for a simple question. Every time.
The Solution
With mcp-database, you just ask Claude:
"What columns does the orders table have?"
Claude calls the get_table_info tool and answers directly. No context switching.
Quick Start
pip install mcp-database
claude mcp add mcp-database -e MCP_DATABASE_URL=sqlite:///your.db -- mcp-database
That is it. Now you can ask Claude things like:
- "What tables are in my database?"
- "Show me the schema for the users table"
- "Query the top 10 orders by amount"
- "Find all columns related to email"
- "Sample some rows from the products table"
8 Tools
| Tool | What It Does |
|---|---|
list_databases |
List all configured database connections |
list_tables |
List all tables |
get_table_info |
Table details (columns, types, row count) |
get_schema |
Full CREATE TABLE statements |
query |
Execute read-only SQL |
execute |
Write operations (opt-in only) |
sample_rows |
See what the data looks like |
search_tables |
Search tables/columns by keyword |
Multi-Database Support
# SQLite (built-in)
MCP_DATABASE_URL=sqlite:///path/to/db.sqlite
# PostgreSQL
pip install "mcp-database[postgres]"
MCP_DATABASE_URL=postgres://user:pass@localhost:5432/mydb
# MySQL
pip install "mcp-database[mysql]"
MCP_DATABASE_URL=mysql://user:pass@localhost:3306/mydb
Security First
- Read-only by default — your data is safe
-
Write opt-in — must explicitly set
MCP_DATABASE_READ_ONLY=false - Statement detection — write tool rejects SELECT statements
- Row limits — max 100 rows by default, configurable
Why Python?
- Largest developer community — lower contribution barrier
- Uses the official
mcpSDK (FastMCP) — not reinventing the wheel - Minimal dependencies — fast install
Claude Desktop Support
Works with Claude Desktop too:
{
"mcpServers": {
"database": {
"command": "mcp-database",
"env": {
"MCP_DATABASE_URL": "sqlite:///your.db"
}
}
}
}
Links
If you find this useful, star the repo — it helps more developers find it. Questions? Comments below!
Tags: mcp database python claude devtools












