Get the FREE Ultimate OpenClaw Setup Guide →

db

A powerful multi-database server implementing the Model Context Protocol (MCP) to provide AI assistants with structured access to databases.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio freepeak-db-mcp-server docker run -i freepeak/db-mcp-server

How to use

The DB MCP Server provides a unified interface for AI assistants to interact with multiple databases through the Model Context Protocol (MCP). Built on the FreePeak cortex framework, it exposes dynamic, database-specific MCP tools (such as query, transaction, schema, and performance tools) for each configured database. Once running, an AI agent can discover the generated tools, invoke SQL queries, manage transactions, inspect schemas, and analyze performance across MySQL, PostgreSQL, SQLite, Oracle, and other supported databases, all through a single, consistent MCP surface. The server supports multiple deployment modes (Docker, STDIO, and SSE) and automatically validates database connectivity on startup, making it suitable for local development and production environments alike.

To use it, first configure your database connections in a single config.json, listing each database with its type, host, port, credentials, and any connection options. When the server starts, it will create per-database tools named with the database id (for example, mysql1) and suffixes like query_mysql1, execute_mysql1, transaction_mysql1, schema_mysql1, and performance_mysql1. Your AI agent can then call these tools to run queries, modify data, manage transactions, explore schemas, and monitor performance in a uniform way across all connected databases. The server supports lazy loading to defer connections until first use, which is helpful when managing many databases.

How to install

Prerequisites:

  • Go installed (for building from source) or use Docker to run the prebuilt image
  • Access to a config.json defining your database connections

Option A: Docker (recommended for quick start)

  1. Install Docker on your host.
  2. Pull and run the MCP server image with a mounted configuration:
# Pull the latest image (example)
docker pull freepeak/db-mcp-server:latest

# Run with your config.json mounted and environment variables set as needed
# Ensure the container maps to the host port you want (default 9092 for SSE)
docker run -p 9092:9092 \
  -v $(pwd)/config.json:/app/config.json \
  -e TRANSPORT_MODE=sse \
  -e CONFIG_PATH=/app/config.json \
  freepeak/db-mcp-server
  1. Point your MCP client to http://localhost:9092/sse (or the configured port).

Option B: Source build (Go)

  1. Clone the repository:
git clone https://github.com/FreePeak/db-mcp-server.git
cd db-mcp-server
  1. Build the server binary:
make build
  1. Run the server in SSE mode with your config:
./bin/server -t sse -c config.json
  1. Connect your MCP client to the SSE endpoint (http://localhost:9092/sse).

Option C: STDIO mode (for IDE integration)

  1. Build or download the binary as above.
  2. Run in stdio mode with your config:
./bin/server -t stdio -c config.json

Additional notes

Tips and caveats:

  • Always define a comprehensive config.json with the necessary connection parameters for each database you plan to use.
  • For high-latency networks or many databases, consider enabling lazy-loading to defer connections until first use.
  • Check the startup logs for health checks that validate connectivity to each configured database; failures will be reported and can be addressed by adjusting host/port/auth credentials.
  • If using Docker, ensure the container has network access to the databases and that any required environment variables (like TRANSPORT_MODE or CONFIG_PATH) are correctly set.
  • The server emits MCP-compatible tool names per database (e.g., query_mysql1, schema_mysql1, performance_mysql1). Use these in your MCP client to drive the corresponding database actions.

Related MCP Servers

Sponsor this space

Reach thousands of developers