MCP DB

v1.0.0Databasesstable

MCP Database Server with natural language SQL queries

mcp-dbmcpai-integration
Share:
17
Stars
0
Downloads
0
Weekly
0/5

What is MCP DB?

MCP DB is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp database server with natural language sql queries

MCP Database Server with natural language SQL queries

This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • MCP Database Server with natural language SQL queries

Use Cases

Query databases using natural language SQL.
Souhar-dya

Maintainer

LicenseNOASSERTION
Languagepython
Versionv1.0.0
UpdatedApr 18, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-db

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use MCP DB

mcp-db is a Python MCP server that enables AI assistants to query relational databases using natural language, translating conversational requests into SQL and returning structured results. It supports PostgreSQL, MySQL, and SQLite through async database drivers, and exposes tools to list tables, describe schemas, sample data, and execute natural language queries — making database exploration and reporting accessible without writing SQL manually.

Prerequisites

  • Python 3.11 or higher installed, or Docker for the container-based setup
  • A running PostgreSQL, MySQL, or SQLite database
  • DATABASE_URL connection string or individual DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME variables
  • An MCP-compatible AI client such as Claude Desktop or VS Code with MCP extension
1

Clone the repository

Clone the mcp-db-server repository. Docker Compose is the recommended way to run the server with all dependencies bundled.

git clone https://github.com/Souhar-dya/mcp-db-server.git
cd mcp-db-server
2

Configure the database connection

Set your database connection via the DATABASE_URL environment variable. The server supports PostgreSQL (postgresql+asyncpg://), MySQL (mysql+aiomysql://), and SQLite (sqlite+aiosqlite://).

# PostgreSQL example
export DATABASE_URL="postgresql+asyncpg://user:password@localhost:5432/mydb"

# MySQL example
export DATABASE_URL="mysql+aiomysql://user:password@localhost:3306/mydb"

# SQLite example
export DATABASE_URL="sqlite+aiosqlite:////path/to/database.db"
3

Run with Docker Compose (recommended)

Use Docker Compose to start the server with all dependencies. The container exposes the MCP server on port 8000.

docker-compose up --build
4

Or run locally with Python

For local development without Docker, install dependencies and run the server directly with Python.

pip install -r requirements.txt
python -m app.server
5

Configure VS Code or Claude Desktop to connect

Add the server to your MCP client configuration. The Docker approach uses the published image; adjust DATABASE_URL to point to your database.

{
  "servers": {
    "mcp-db-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "DATABASE_URL=postgresql+asyncpg://user:pass@host:5432/mydb",
        "souhardyak/mcp-db-server:1.3.1"
      ]
    }
  }
}

MCP DB Examples

Client configuration (VS Code / Claude Desktop)

Configuration using the Docker image, passing the DATABASE_URL for your PostgreSQL database.

{
  "servers": {
    "mcp-db-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "DATABASE_URL=postgresql+asyncpg://user:pass@localhost:5432/mydb",
        "souhardyak/mcp-db-server:1.3.1"
      ]
    }
  }
}

Prompts to try

Natural language database queries that the server translates into SQL and executes against your connected database.

- "Show all customers"
- "Count orders by status"
- "Top 5 customers by total order amount"
- "Show recent orders from the last week"
- "List all tables in the database"
- "Describe the schema of the users table"

Troubleshooting MCP DB

Connection refused or cannot reach database host

When running in Docker, the database host 'localhost' inside the container refers to the container itself, not your machine. Use your machine's actual IP or host.docker.internal (on macOS/Windows) in the DATABASE_URL.

Server starts but natural language queries return errors

Verify the database driver in DATABASE_URL matches your database type: postgresql+asyncpg for PostgreSQL, mysql+aiomysql for MySQL, sqlite+aiosqlite for SQLite. Install the matching async driver if running locally.

Health check endpoint returns unhealthy

Access GET /health to see the current status. If the database connection is failing, check that the database is running and accessible at the configured host and port, and that the credentials in DATABASE_URL are correct.

Frequently Asked Questions about MCP DB

What is MCP DB?

MCP DB is a Model Context Protocol (MCP) server that mcp database server with natural language sql queries It connects AI assistants to external tools and data sources through a standardized interface.

How do I install MCP DB?

Follow the installation instructions on the MCP DB GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with MCP DB?

MCP DB works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is MCP DB free to use?

Yes, MCP DB is open source and available under the NOASSERTION license. You can use it freely in both personal and commercial projects.

Browse More Databases MCP Servers

Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "mcp-db": { "command": "npx", "args": ["-y", "mcp-db"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use MCP DB?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides