SuperAPI AI Directory

db-mcp-server

MySQL and PostgreSQL access: query execution, transaction management, schema exploration, query building and performance analysis.

Open website

About this tool

Purpose: db-mcp-server is implemented based on the FreePeak/cortex framework and provides the Model Context Protocol (MCP), offering AI assistants a unified interface to access multiple databases simultaneously, enabling SQL query execution, transaction management, schema exploration, and performance analysis.

Main capabilities: supports simultaneous connections to multiple MySQL, PostgreSQL, SQLite, and Oracle databases; automatically generates dedicated tools for each connected database; supports --lazy-loading for deferred connections; provides a unified tool mode (--unified-tools) that registers merged tools such as query, execute, transaction, performance, explain, describe, schema, and filter_tables, suitable for reducing the number of tools and context overhead when connecting to more than 5 databases; automatically registers TimescaleDB-specific tools for PostgreSQL with the timescaledb extension installed.

Usage: after installing from source, create config.json to configure database connections; schema_version: 1 enables strict field validation; credentials are recommended to use environment variable names or mounted secret files rather than being written directly into JSON. Command-line options include -t/-transport (stdio, legacy sse, experimental streamable), -c/-config, -p/-port (default 9092), -h/-host (default 127.0.0.1), --version, -allow-insecure-sse, -api-key, -log-level, -log-dir, -db-config, -lazy-loading, -unified-tools. The update command is db-mcp-server update; -check only checks, and -force reinstalls the current version.

Applicable scenarios and limitations: the safest local integration method is STDIO; HTTP transport is still being hardened and should not be directly exposed to a shared network; legacy SSE has no built-in authentication and is disabled by default, and can only be explicitly enabled behind a trusted private reverse proxy; experimental Streamable HTTP requires DB_MCP_API_KEY and is recommended to be placed behind a privateTLS gateway. Production protections include per-database read_only enforcement, max_rows truncation and per-query timeouts, as well as DB_MCP_AUDIT_LOG audit logging. The Docker image is for development/demo purposes and is not suitable for public deployment.