Skip to content

Releases: mahAnuj/mcp-multi-db

v1.0.2 — Glama install-test fix

Choose a tag to compare

@mahAnuj mahAnuj released this 21 Jun 08:57

v1.0.2 — Boot tolerant of missing config file (Glama install-test fix)

A follow-up to v1.0.1's defensive-startup work.

The problem

Directory smoke tests (Glama, Smithery) inject MCP_DB_CONFIG=/app/config.json but don't always populate a file at that path. v1.0.1 only handled the case where neither env var was set — the path-set-but-file-missing case still crashed:

Fatal error in main(): Error: ENOENT: no such file or directory, open '/app/config.json'
    at readFileSync (node:fs:441:20)
    at loadRawFromEnv (file:///app/build/config.js:47:26)

The fix

  • MCP_DB_CONFIG points at a missing file → log a clear stderr hint, boot with an empty registry. (Was: fatal crash.)
  • MCP_DB_CONFIG points at an empty file → same.
  • MCP_DB_CONFIG is unreadable (permissions, corrupted JSON read) → same, with the underlying error in the log line.
  • { "databases": [] } is now a valid config shape. Useful for the new image-baked default and for users iterating on a fresh setup. Both databases.min(1) constraints relaxed; everything else (per-DB Zod validation, duplicate-id check) unchanged.
  • Default /app/config.json in the Docker image — a tiny {"databases": []} so directory harnesses that don't mount a config still find a valid file at the standard path.
  • Stricter logging: when MCP_DB_CONFIG is set but unreadable, we log one specific message instead of two redundant ones.
  • +3 tests covering the new paths: missing file, empty file, valid file at MCP_DB_CONFIG. Test count: 31 → 34, all passing.

Behaviour after the fix

$ MCP_DB_CONFIG=/missing/path.json npx mcp-multi-db
[mcp-multi-db] MCP_DB_CONFIG="/missing/path.json" was set but no file exists
at that path. Starting with an empty registry.
mcp-multi-db server running on stdio

The server stays alive and responds to MCP introspection. Add your config and restart to query.

Upgrade

npx mcp-multi-db@1.0.2

Or just npx mcp-multi-db — npm resolves to latest. No config-file changes required.

Links

v1.0.1 — Boot tolerant of missing config

Choose a tag to compare

@mahAnuj mahAnuj released this 21 Jun 08:45

v1.0.1 — Boot tolerant of missing config

A small but important fix for first-time users and directory smoke tests (Glama, etc.).

The problem

In v1.0.0, the server fatal-crashed on startup if neither MCP_DB_CONFIG nor MCP_DATABASES was set. That meant:

  • Running npx mcp-multi-db to "try it out" failed with an error before any MCP handshake completed.
  • Directory listings (Glama and others) probed the server, got an immediate process exit, and marked the install as broken.
  • The friendly install story ("npx -y mcp-multi-db then point your MCP client at it") was undermined for users who hadn't created databases.json yet.

The fix

  • The server now boots cleanly with no env config. It logs a clear hint to stderr explaining what to do next.
  • list_databases returns an empty array (correct: there are no databases registered).
  • If you try to run a query against the empty registry, you get a friendly "no databases configured, here's how" error with a link to the README — instead of the previous Available: (empty list).
  • 5 new tests cover the config paths: empty, inline MCP_DATABASES, bare-array shape, duplicate IDs, and malformed JSON. Test count: 26 → 31, all passing.

Behaviour after the fix

$ npx mcp-multi-db
[mcp-multi-db] No database configuration found. Set MCP_DB_CONFIG to the path
of your databases.json (or MCP_DATABASES with inline JSON). Server is starting
with an empty registry — list_databases will return [] until you configure at
least one database.
mcp-multi-db server running on stdio

The server stays alive and responds to MCP introspection. Add your config and restart to query.

Upgrade

npx mcp-multi-db@1.0.1

Or just npx mcp-multi-db — npm resolves to latest. No config-file changes required.

Links

v1.0.0 — Initial release

Choose a tag to compare

@mahAnuj mahAnuj released this 21 Jun 07:25

v1.0.0 — Initial release

One MCP server for Postgres, MySQL, and SQLite. Read-only and safe by default.

What it does

Lets any MCP-capable client (Claude Desktop, Claude Code, Cursor, Cline, Windsurf, etc.) talk to PostgreSQL, MySQL, and SQLite databases — all from a single server config. List databases, list tables, describe columns, and run read-only queries through one unified tool surface.

Install

npx mcp-multi-db

Or register in your MCP client (see README for client-specific configs):

{
  "mcpServers": {
    "mcp-multi-db": {
      "command": "npx",
      "args": ["-y", "mcp-multi-db"],
      "env": { "MCP_DB_CONFIG": "/path/to/databases.json" }
    }
  }
}

Features

  • Three SQL engines side by side — Postgres, MySQL, SQLite — through one server, one config
  • Read-only by default, two-layer enforcement — SQL-text guard + database-level read-only transactions (and SQLite opened read-only). INSERT, UPDATE, DELETE, DDL all refused.
  • Schema-awarelist_databases, list_tables, describe_table, run_query
  • Row limits + query timeouts — caps results at 100 (max 1000), bounds runtime at 30s
  • Pluggable adapter pattern — adding a new SQL engine is a contained change documented in docs/extending.md

Why this exists

If you use MCP with multiple databases, you've been installing a separate MCP per backend. Different tool names. Different config files. Different docs. This collapses that to one server, one config, one set of tools.

What's next

  • ClickHouse adapter (if there's interest)
  • MongoDB adapter (post-NoSQL feedback)
  • Issues + PRs welcome — see docs/extending.md for the contributor checklist

Links