db-insight

by enclavex-labs

Not rated
GitHub

About

connect a read-only replica, analytics database, or staging database. Keep credentials on your machine while the tool discovers schema, generates safe SQL, previews it for approval, runs the query, and summarizes the result.

Details

Author
enclavex-labs
Categories
Developer Tools, Database, Other

Setup

Install db-insight in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/enclavex-labs/db-insight

Follow the installation instructions in the repository README, then restart your MCP client.

Local-first SQL insight CLI and MCP server for Postgres and SQLite.

Positioning: connect a read-only replica, analytics database, or staging database. Keep credentials on your machine while the tool discovers schema, generates safe SQL, previews it for approval, runs the query, and summarizes the result.

python -m venv .venv source .venv/bin/activate pip install -e ".[dev]"
DATABASE_URL=postgresql://readonly:password@localhost:5432/app_db DB_INSIGHT_MODEL=gemma3:latest DB_INSIGHT_OLLAMA_URL=http://localhost:11434
DATABASE_URL=sqlite:///absolute/path/to/app.sqlite DB_INSIGHT_MODEL=gemma3:latest DB_INSIGHT_OLLAMA_URL=http://localhost:11434

If your provider gives a URL with special characters, wrap it in quotes:

DATABASE_URL="postgresql://readonly:password@host.example.com:5432/app_db"

DB_INSIGHT_MODELis configurable so you can use the best Gemma/Ollama tag available on your machine.

db-insight connect db-insight schema --refresh db-insight ask "Why did revenue drop last week?"

By default,askuses the same MCP-style flow as the server:

user question → LLM plans tool calls → discover_schema / schema memory → generate_safe_sql → preview SQL for approval → run_approved_sql → summarize_results

The user-facing CLI previews generated SQL and asks before running it.

db-insight schema --refreshstores a local schema memory snapshot in.db-insight/schema_memory.json. Later questions reuse that schema picture so the model does not need to rediscover the same database structure every time. The memory contains metadata only, not table rows.

For Android health-ring chat architecture, seeAndroid Health Chat Implementation.

This exposes safe local tools over stdio for MCP clients:

- plan_tool_calls
- discover_schema
- refresh_schema_memory
- schema_memory_status
- catalog_overview
- inspect_table
- explain_sql
- generate_safe_sql
- run_approved_sql
- ask_database

In a full MCP client, the LLM decides which tools to call.ask_databaseis a convenience tool that performs that decision loop inside this local server while still requiring explicit approval before execution.

For team use, run the same server over HTTP:

DB_INSIGHT_MCP_HOST=0.0.0.0 \ DB_INSIGHT_MCP_PORT=8000 \ db-insight mcp --transport streamable-http

Put it behind your existing auth layer, VPN, or private network. Do not expose a database-backed MCP server directly to the public internet.

docker pull ghcr.io/enclavex-labs/db-insight:latest

Install Gemma on the host Docker server:

Configure your MCP client to launch the container over stdio.

{ "mcpServers": { "db-insight": { "command": "docker", "args": [ "run", "-i", "--rm", "--add-host=host.docker.internal:host-gateway", "-e", "DATABASE_URL", "-e", "DB_INSIGHT_MODEL", "-e", "DB_INSIGHT_OLLAMA_URL", "ghcr.io/enclavex-labs/db-insight:latest" ], "env": { "DATABASE_URL": "postgresql://readonly:password@host.docker.internal:5432/app_db", "DB_INSIGHT_MODEL": "gemma3:latest", "DB_INSIGHT_OLLAMA_URL": "http://host.docker.internal:11434" } } } }
{ "mcpServers": { "db-insight": { "command": "docker", "args": [ "run", "-i", "--rm", "--add-host=host.docker.internal:host-gateway", "-v", "/absolute/path/to/data:/data:ro", "-e", "DATABASE_URL", "-e", "DB_INSIGHT_MODEL", "-e", "DB_INSIGHT_OLLAMA_URL", "ghcr.io/enclavex-labs/db-insight:latest" ], "env": { "DATABASE_URL": "sqlite:////data/app.sqlite", "DB_INSIGHT_MODEL": "gemma3:latest", "DB_INSIGHT_OLLAMA_URL": "http://host.docker.internal:11434" } } } }

For VS Code/Copilot, use the same body underserversinstead ofmcpServers.

Each user fillsDATABASE_URLwith their own Postgres connection string or SQLite file URL. For SQLite in Docker, mount the folder containing the database to/dataand use four slashes:sqlite:////data/app.sqlite.

For Postgres, ifDATABASE_URLuseslocalhostor127.0.0.1, the Docker image remaps it tohost.docker.internalautomatically.

If you need a long-running shared HTTP endpoint instead, run:

docker run --rm -p 8000:8000 \ --add-host=host.docker.internal:host-gateway \ -e DATABASE_URL=postgresql://readonly:password@host.docker.internal:5432/app_db \ -e DB_INSIGHT_OLLAMA_URL=http://host.docker.internal:11434 \ ghcr.io/enclavex-labs/db-insight:latest db-insight mcp --transport streamable-http

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

MCP servers that give AI clients safe, structured access to SQL databases. One installable package per database engine. Every package exposes the same minimal two-tool surface, execute_sql and search_objects, with guardrails on by default: read-only mode, row caps, and statement timeouts.

Browse, create, and manage schema projects on the Schematica schema library. 8 MCP tools for AI-powered schema design and data modeling.

Manage, explore, transform and join data across multiple clusters using different flavours of Apache Kafka via Lenses.io (including the free Community Edition)

An example of a remote, authentication-free MCP server deployable on Cloudflare Workers.

Efficient, SQL-backed C++ project indexer designed for large codebases with low memory footprint.

MCPg - Production-grade PostgreSQL MCP Server

Safe-by-default PostgreSQL Model Context Protocol server for AI agents.

The All-in-One Data Stack for Agents & Builders

Analyze, lint, and fix SQL queries using the SQLFluff linter.

Official MCP server for dbt (data build tool) providing integration with dbt Core/Cloud CLI, project metadata discovery, model information, and semantic layer querying capabilities.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.