Skip to content
MCP server

DB MCP Server

Database MCP server for MySQL, PostgreSQL, MongoDB, and SQLite with SSH tunneling support.

Runs locallyStatus and history
Install
Pricing
Open source
Runs
Locally
Version
1.2.1
Listing updated
4 days ago

About DB MCP Server

DB MCP Server is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.

Install

Run in a terminal

claude mcp add db --env DB_TYPE='<DB_TYPE>' --env DB_DATABASE='<DB_DATABASE>' --env DB_PASSWORD='<DB_PASSWORD>' --env DB_URL='<DB_URL>' --env SSH_PASSWORD='<SSH_PASSWORD>' -- uvx db-mcp-server

Add to claude_desktop_config.json

{
  "mcpServers": {
    "db": {
      "command": "uvx",
      "args": [
        "db-mcp-server"
      ],
      "env": {
        "DB_TYPE": "<DB_TYPE>",
        "DB_DATABASE": "<DB_DATABASE>",
        "DB_PASSWORD": "<DB_PASSWORD>",
        "DB_URL": "<DB_URL>",
        "SSH_PASSWORD": "<SSH_PASSWORD>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "db": {
      "command": "uvx",
      "args": [
        "db-mcp-server"
      ],
      "env": {
        "DB_TYPE": "<DB_TYPE>",
        "DB_DATABASE": "<DB_DATABASE>",
        "DB_PASSWORD": "<DB_PASSWORD>",
        "DB_URL": "<DB_URL>",
        "SSH_PASSWORD": "<SSH_PASSWORD>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "db": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "db-mcp-server"
      ],
      "env": {
        "DB_TYPE": "<DB_TYPE>",
        "DB_DATABASE": "<DB_DATABASE>",
        "DB_PASSWORD": "<DB_PASSWORD>",
        "DB_URL": "<DB_URL>",
        "SSH_PASSWORD": "<SSH_PASSWORD>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "db": {
      "command": "uvx",
      "args": [
        "db-mcp-server"
      ],
      "env": {
        "DB_TYPE": "<DB_TYPE>",
        "DB_DATABASE": "<DB_DATABASE>",
        "DB_PASSWORD": "<DB_PASSWORD>",
        "DB_URL": "<DB_URL>",
        "SSH_PASSWORD": "<SSH_PASSWORD>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "db": {
      "command": "uvx",
      "args": [
        "db-mcp-server"
      ],
      "env": {
        "DB_TYPE": "<DB_TYPE>",
        "DB_DATABASE": "<DB_DATABASE>",
        "DB_PASSWORD": "<DB_PASSWORD>",
        "DB_URL": "<DB_URL>",
        "SSH_PASSWORD": "<SSH_PASSWORD>"
      }
    }
  }
}

Configuration

  • DB_TYPEDatabase typeRequired
  • DB_DATABASEDatabase nameRequired
  • DB_MODEAccess mode
  • DB_HOSTDatabase host (MySQL/PostgreSQL)
  • DB_PORTDatabase port (MySQL: 3306, PostgreSQL: 5432)
  • DB_USERDatabase user (MySQL default: root, PostgreSQL default: postgres)
  • DB_PASSWORDDatabase password (MySQL/PostgreSQL, optional)
  • DB_URLMongoDB connection URL (required for MongoDB, e.g. mongodb://...)
  • SSH_HOSTSSH bastion host for tunneling (MySQL/PostgreSQL only)
  • SSH_PORTSSH port
  • SSH_USERSSH username (default: current OS user)
  • SSH_KEYPath to SSH private key (e.g. ~/.ssh/id_rsa)
  • SSH_PASSWORDSSH password (if no key provided)

Pricing

Open source

DB MCP Server FAQ

Is DB MCP Server free?

Yes. DB MCP Server is open source, so you can use and self-host it for free.

How do I add DB MCP Server to Claude Code?

Run this command in your terminal: claude mcp add db --env DB_TYPE='<DB_TYPE>' --env DB_DATABASE='<DB_DATABASE>' --env DB_PASSWORD='<DB_PASSWORD>' --env DB_URL='<DB_URL>' --env SSH_PASSWORD='<SSH_PASSWORD>' -- uvx db-mcp-server

What are the best alternatives to DB MCP Server?

The closest alternatives to DB MCP Server are Midplane, PlatypusDB, Lorebase, Sovaria and model2data studio.

Alternatives to DB MCP Server

  1. Midplane

    MCP server

    Postgres gateway for AI agents with table grants, column masking and approval for writes

    Runs locally
    • Open source
    • 5 GitHub stars
    • Databases
  2. PlatypusDB

    MCP server

    Gives MCP clients access to your PlatypusDB database connections, scoped per agent

    Runs locally
    • Open source
    • Databases
  3. Lorebase

    MCP server

    Lets agents read and change a governed, versioned Postgres knowledge graph

    Runs locally
    • Open source
    • Knowledge and memory
  4. Sovaria

    MCP server

    Manage a Sovaria backend (Postgres, auth, storage, functions) from an AI assistant

    Not checked yet
    • 4 tools
    • Remote
    • Freemium
    • Databases
  5. Generate realistic connected test data, dbt projects and dashboards from a schema

    • Remote
    • Freemium
    • Databases
  6. semlayer

    MCP server

    Infers a semantic layer from your data warehouse and serves it to agents

    Runs locally
    • Free
    • Databases