DB MCP Server logo

DB MCP Server

by FreePeak

Connect AI assistants to multiple SQL databases with generated tools for queries, transactions, schemas, and performance analysis.

Install DB MCP Server

Run the project’s own setup commands, in order.

Setup steps from the project

FreePeak/db-mcp-server installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    make build
    
  2. 2. Start the server
    ./bin/server -t stdio -c /absolute/path/to/config.local.json
    
  3. 3. Start the server
    ./bin/server -t sse -h 127.0.0.1 -p 9092 \
      -allow-insecure-sse -c /absolute/path/to/config.local.json
    
  4. 4. Install
    docker build -t db-mcp-server:local .
    
  5. 5. Start the server
    docker run --rm -p 127.0.0.1:9092:9092 \
      -p 127.0.0.1:9093:9093 \
      -v "$(pwd)/config.local.json:/app/config.json:ro" \
      db-mcp-server:local
    
  6. 6. Install
    git clone https://github.com/FreePeak/db-mcp-server.git
    

Overview

FreePeak/db-mcp-server exposes multiple database connections through MCP, with generated tools for each configured database. It supports MySQL, PostgreSQL, SQLite, Oracle, and TimescaleDB, including SQL execution, transactions, schema inspection, and performance analysis. Use it when an agent needs a consistent interface across several databases, especially with read-only controls, result limits, query timeouts, or data masking. Local STDIO is the recommended transport, while HTTP transports remain under hardening.

Use cases

  • Query several MySQL and PostgreSQL databases from one agent session
  • Inspect schemas before generating SQL
  • Restrict an agent to read-only database access
  • Cap result sizes and enforce query timeouts
  • Mask sensitive values in query results

Key features

  • Multi-database connections
  • Generated tools per database connection
  • SQL queries, statements, and transactions
  • Schema and performance inspection
  • Read-only, row-limit, and timeout guardrails
  • Column and content-based data masking

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

34/34 checks healthy over the last 112d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars487Stargazers on the source repository.
Last commit2d agoMost recent push to the default branch.
Directory activity15 viewsConfig copies, upvotes, and views on AllMCPs.

How DB MCP Server works

What FreePeak/db-mcp-server does

FreePeak/db-mcp-server gives MCP-compatible AI assistants structured access to multiple databases through one server. A configuration can contain several connections, each with its own identifier and database type. Supported systems include MySQL, PostgreSQL, SQLite, Oracle, and TimescaleDB.

Each connection receives a separate set of generated tools. The tool names incorporate the connection ID, allowing an agent to distinguish operations such as query_mysql1 and query_postgres1 when working with more than one database.

The server covers common database workflows: running SQL queries, executing data-modifying statements, managing transactions, inspecting schemas, and analyzing query performance. It is implemented in Go and follows a layered architecture separating domain logic, repositories, use cases, and MCP delivery.

How it works

Connections are declared with database-specific settings such as an ID, type, host, port, database name, username, and password. SQLite connections can use file-based or in-memory databases, with SQLCipher support. Oracle connections support service names, RAC, cloud wallets, and TNS configurations.

At startup, the server validates database connectivity and creates tools for each configured connection. Lazy loading can defer connection establishment until a database is first used, which is useful for configurations containing many databases. The safest local deployment uses STDIO. HTTP transports are still being hardened and should not be exposed directly to a shared network.

Setup and configuration

Configure one or more database entries in the server configuration. A connection can include a read_only policy, max_rows result cap, query_timeout, masking rules, and PII masking. The --lazy-loading option enables deferred connections.

read_only blocks writes through both query and execute tools. PostgreSQL and MySQL also receive read-only engine settings, while SQLite opens in read-only mode. Oracle relies on the application classifier and database privileges. Query timeouts apply across queries, statements, transactions, explain operations, and schema inspection; the default is 30 seconds, and -1 disables the timeout.

Set QUERY_TIMEOUT_SECONDS to provide a timeout for connections without an explicit JSON value. DB_MCP_AUDIT_LOG enables JSONL auditing for executed statements and rejected read-only attempts. Audit records include the operation, database, statement, duration, timestamp, and error when applicable.

Tools and capabilities

Generated tools include:

  • query_<connection> for SQL queries and result retrieval
  • execute_<connection> for data-modifying statements
  • transaction_<connection> for transaction operations
  • schema_<connection> for schema exploration
  • performance_<connection> for query-performance analysis

Result controls can cap returned rows and add a truncation notice. Masking rules can replace, null, or partially reveal values in columns matching configured regular expressions. Optional PII masking detects emails, phone numbers, credit-card numbers, SSNs, IP addresses, and long numeric identifiers by content shape, including values in free-text results.

Limitations and notes

NoSQL support is planned rather than part of the listed database support. Oracle result limits are applied client-side, unlike the database-side limit optimization available for PostgreSQL, MySQL, and SQLite in applicable single-query cases. HTTP deployment should be treated cautiously; STDIO is the preferred local transport. Database users should still follow least-privilege practices even when server-side read-only protections are enabled.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about DB MCP Server

FreePeak/db-mcp-server is an MCP server that connects AI assistants to multiple MySQL, PostgreSQL, SQLite, Oracle, and TimescaleDB databases. Its generated database-specific tools support SQL queries, data-modifying statements, transactions, schema inspection, and performance analysis through a consistent MCP interface.

FreePeak/db-mcp-server supports MySQL, PostgreSQL, SQLite, Oracle, and TimescaleDB. PostgreSQL support covers versions 9.6 through 17, and Oracle support covers versions 10g through 23c.

Configure multiple connection entries, each with an ID, database type, and connection details such as host, port, database name, username, and password. The server then creates a separate set of database-specific tools for every connection.

Yes, FreePeak/db-mcp-server supports Cursor integration. Use its STDIO deployment for local MCP connectivity and configure the server with the database connections that Cursor should access.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewDB MCP Server AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/freepeak-db-mcp-server?style=directory)](https://allmcps.com/mcp/freepeak-db-mcp-server)
HTML Embed
<a href="https://allmcps.com/mcp/freepeak-db-mcp-server"><img src="https://allmcps.com/api/badge/freepeak-db-mcp-server?style=directory" alt="DB MCP Server on AllMCPs" /></a>