yasunchukandriy/mcp-db-explore
MCP server for natural language PostgreSQL exploration — ask questions in plain English/German, get SQL results via Claude API
A Model Context Protocol (MCP) server that lets you explore a PostgreSQL database using natural language. Ask a question in English or German, and Claude translates it to SQL, executes it safely, and returns the results.
# Clone and start services
git clone https://github.com/yasunchukandriy/mcp-db-explorer.git
cd mcp-db-explorer
cp .env.example .env
# Edit .env with your Anthropic API key
docker compose up -dAdd to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"db-explorer": {
"command": "docker",
"args": ["compose", "run", "--rm", "-i", "mcp-server"],
"cwd": "/path/to/mcp-db-explorer"
}
}
}Or run directly with Python:
{
"mcpServers": {
"db-explorer": {
"command": "mcp-db-explorer",
"env": {
"MCP_DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/explorer",
"MCP_ANTHROPIC_API_KEY": "sk-ant-..."
}
}
}
}| Tool | Description | |------|-------------| | list_tables | List all tables with approximate row counts | | describe_table | Show columns, constraints, and indexes for a table | | query | Ask a natural language question — translated to SQL automatically | | execute_sql | Run a raw SELECT query directly | | get_sample_data | Preview sample rows from a table |
| URI | Description | |-----|-------------| | db://schema | Full database schema as text | | db://tables/{table_name} | Schema for a specific table |
| Prompt | Description | |--------|-------------| | analyze_data | Data analysis workflow template | | generate_report | Report generation template |
Natural Language Question
│
▼
┌─────────────┐ ┌──────────────┐ ┌────────────┐
│ MCP Server │────▶│ Translator │────▶│ Claude API │
│ (FastMCP) │◀────│ (asyncio) │◀────│ Loading reviews...