The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the MCP Multi Db listing page.
One MCP server for all your SQL databases — read-only and safe by default.
Connect an AI agent to PostgreSQL, MySQL, and SQLite at the same time through a
single Model Context Protocol server. List
your databases in one config file and the agent picks which one to query by
database_id. Every query is enforced read-only at the database level, so it's
safe to point at real data.

The clip drives the real server over stdio (via the MCP SDK) against a seeded SQLite database. Regenerate it with
npm run build && vhs examples/demo.tape.
| Tool | Description |
|---|---|
list_databases | List configured database connections |
list_tables | List tables/views in a database |
describe_table | Show column metadata for a table |
run_query | Run read-only SQL (SELECT, WITH, EXPLAIN) |
No install needed — npx fetches the package on first use.
databases.jsonCopy the example and edit with your connection details:
Never commit
databases.json— it contains credentials. It's already gitignored if you cloned the repo. Prefer read-only database users (see Security).
The server speaks MCP over stdio, so it works with any MCP-capable client.
Use npx mcp-multi-db as the command and pass MCP_DB_CONFIG (the path to
your databases.json). See mcp.example.json and
databases.example.json for templates.
Edit claude_desktop_config.json (macOS:
~/Library/Application Support/Claude/claude_desktop_config.json):
Restart Claude Desktop afterward.
Add to ~/.cursor/mcp.json (or .cursor/mcp.json in your project), then open
Cursor Settings → Tools & MCP, restart the server, and use Agent mode:
Any client that supports stdio MCP servers uses the same shape: command npx,
args ["-y", "mcp-multi-db"], and env MCP_DB_CONFIG pointing at your
databases.json. Consult your client's docs for where its MCP config lives.
Prefer a pinned global install?
npm install -g mcp-multi-db, then use commandmcp-multi-dbwith no args.
Config is loaded from one of two environment variables, in order:
MCP_DB_CONFIG — path to a JSON file (recommended).MCP_DATABASES — inline JSON (useful when a file path is awkward).The JSON may be either { "databases": [ ... ] } or a bare array. Each entry:
| Field | Required | Notes |
|---|---|---|
id | yes | Unique; the agent references this as database_id |
type | yes | postgres | mysql | sqlite |
connectionString | postgres/mysql | Standard connection URI |
path | sqlite | Absolute path to the .db file |
label | no | Human-friendly name shown to the agent |
description | no | Extra context shown to the agent |
local-sqlite?"users table in analytics-pg"SELECT COUNT(*) FROM orders on reporting-mysql"INSERT, UPDATE, DELETE, DDL, etc. are blocked — both
by a SQL-text guard and by running each query inside a database-level
read-only transaction (SQLite opens read-only). A SELECT that calls a
side-effecting function is still refused.A multi-stage Dockerfile is included. Build and run with your
databases.json mounted in:
The image runs as a non-root user, ships only the built JS and runtime
node_modules (no toolchain), and speaks MCP over stdio just like the npx
install — so it slots into any MCP client by replacing the command and
args with the appropriate docker run -i invocation.
Tests use Node's built-in test runner (no extra dependencies) and cover the read-only SQL guard and the SQLite adapter end to end. CI runs build + tests on every push and pull request.
Adding another database engine is a contained change: add the config variant in
src/config.ts, implement the SqlDatabasePort interface in a
new adapter under src/adapters/, and register it in the
adapter factory. New adapters must enforce read-only at the connection level —
not rely on the text guard alone. See docs/extending.md for
the full checklist.
The full index is in docs/.
Issues and pull requests are welcome — see CONTRIBUTING.md for setup, the read-only invariants, and how to add a database engine.
ISC — see LICENSE.