Self-hosted MCP gateway that gives AI coding agents read-only access to your databases.
README
Give Claude Code, Cursor, Windsurf, or any MCP-compatible AI tool read-only access to your databases — without exposing credentials or risking data changes.
Self-hosted. Everything runs locally. Your passwords never leave your machine.
| | Database | Notes | |---|---|---| | <img src="client/public/postgre.png" width="20" height="20"> | PostgreSQL | All versions | | <img src="client/public/mysql.png" width="20" height="20"> | MySQL | MySQL 5.7+ / MariaDB | | <img src="client/public/sqlite.webp" width="20" height="20"> | SQLite | Local file, no server needed | | <img src="client/public/redshift.png" width="20" height="20"> | Amazon Redshift | SSL required, Redshift-specific catalog queries |
Instead of copy-pasting query results between your DB client and your AI tool, the gateway lets your AI query the database directly. It can explore schemas, inspect tables, and run SELECT queries. It cannot insert, update, delete, or drop anything.
git clone https://github.com/mdadul/db-mcp
cd db-mcp
# Generate .env with secure random keys, then start
sh scripts/setup.sh
docker compose up
docker compose pulls the pre-built image from Docker Hub — no build step required.
The MCP_TOKEN is printed by setup.sh — copy it before you close the terminal.
git clone https://github.com/mdadul/db-mcp
cd db-mcp
bun install
bun run dev # generates .env automatically, then starts the server
Open http://localhost:4080.
Your MCP_TOKEN is in .env.
claude mcp add --transport http db-mcp http://localhost:4080/mcp \
--header "Authorization: Bearer <MCP_TOKEN>"
Then restart Claude Code.
Add to your mcp.json: