DB MCP Server

io.github.stucchiPublished by GitHub account stucchiv1.2.1Updated Oct 24, 2026

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

VerifiedSTDIODesktop onlyDatabasesDeveloper Tools

Overview

AI-generated overview

Local MCP server that lets an assistant query and, in read-write mode, modify MySQL, PostgreSQL, MongoDB or SQLite databases, optionally through an SSH tunnel.

What you can do
Run read-only SQL queries and inspect results on MySQL, PostgreSQL and SQLite, or find documents in MongoDB collections and run aggregation pipelines with $out/$merge blocked in read-only mode. List tables or collections and describe table structures or collection stats. Show connection status and info. Execute write SQL such as INSERT, UPDATE and DELETE when read-write mode is enabled. Connect through an SSH bastion host for MySQL and PostgreSQL, or download a remote SQLite file over SFTP before querying.
When to use it
Useful when you want an assistant to explore a schema, answer questions from live data, or make controlled changes to a database without a separate client. Suited to local desktop setups, including databases reachable only through a bastion host.
Requirements
Runs locally as a Python package launched with uvx, so a Python/uv runtime is needed. One instance per database. Set DB_TYPE and DB_DATABASE, plus DB_HOST, DB_PORT and DB_USER as needed; MySQL and PostgreSQL need DB_PASSWORD, MongoDB needs DB_URL, SQLite needs DB_PATH. For SSH tunneling set SSH_HOST and provide SSH_KEY or SSH_PASSWORD. Network access to the database or bastion is required.
Before you install
Database credentials are passed as environment variables, including DB_PASSWORD, DB_URL and SSH_PASSWORD, and an SSH private key path via SSH_KEY. Default mode is read-only, but setting DB_MODE to read-write enables INSERT, UPDATE and DELETE through the execute tool, and for SQLite over SSH changes are uploaded back to the remote file on shutdown. Point it at a least-privilege account and avoid production data unless intended.

Installation

In SourceWeft

  1. Open DB MCP Server in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

db-mcp-server

MCP server for MySQL, PostgreSQL, MongoDB, and SQLite databases. One instance per database, no Docker required.

Installation

bash
uvx db-mcp-server

Configuration

Configure via environment variables. Each instance connects to a single database.

MySQL

VariableRequiredDefaultDescription
DB_TYPEYes—mysql
DB_DATABASEYes—Database name
DB_PASSWORDYes—Password
DB_HOSTNolocalhostHost
DB_PORTNo3306Port
DB_USERNorootUser
DB_MODENoread-onlyread-only or read-write

PostgreSQL

VariableRequiredDefaultDescription
DB_TYPEYes—postgresql
DB_DATABASEYes—Database name
DB_PASSWORDYes—Password
DB_HOSTNolocalhostHost
DB_PORTNo5432Port
DB_USERNopostgresUser
DB_MODENoread-onlyread-only or read-write

MongoDB

VariableRequiredDefaultDescription
DB_TYPEYes—mongodb
DB_DATABASEYes—Database name
DB_URLYes—Connection URL (mongodb://...)
DB_MODENoread-onlyread-only or read-write

SQLite

VariableRequiredDefaultDescription
DB_TYPEYes—sqlite
DB_PATHYes—Path to .db file (local or remote with SSH)
DB_DATABASENofilenameDisplay name
DB_MODENoread-onlyread-only or read-write

SSH Tunnel (MySQL / PostgreSQL)

Optionally connect through an SSH bastion host. Set SSH_HOST to activate.

For SQLite over SSH, the remote .db file is downloaded via SFTP before querying. In read-write mode, changes are uploaded back on shutdown.

VariableRequiredDefaultDescription
SSH_HOSTNo—SSH bastion host (activates tunneling)
SSH_PORTNo22SSH port
SSH_USERNoCurrent OS userSSH username
SSH_KEYNo—Path to private key (~/.ssh/id_rsa)
SSH_PASSWORDNo—SSH password (if no key)

At least one of SSH_KEY or SSH_PASSWORD is required when SSH_HOST is set. SSH tunneling is not supported for MongoDB.

Usage in .mcp.json

SQLite (local)

json
{  "mcpServers": {    "db-local": {      "command": "uvx",      "args": ["db-mcp-server"],      "env": {        "DB_TYPE": "sqlite",        "DB_PATH": "/path/to/database.db"      }    }  }}

SQLite over SSH

json
{  "mcpServers": {    "db-remote": {      "command": "uvx",      "args": ["db-mcp-server"],      "env": {        "DB_TYPE": "sqlite",        "DB_PATH": "/remote/path/to/database.db",        "SSH_HOST": "server.example.com",        "SSH_USER": "deploy",        "SSH_KEY": "~/.ssh/id_rsa"      }    }  }}
json
{  "mcpServers": {    "db-prod": {      "command": "uvx",      "args": ["db-mcp-server"],      "env": {        "DB_TYPE": "mysql",        "DB_MODE": "read-only",        "DB_HOST": "db.example.com",        "DB_PORT": "3306",        "DB_USER": "root",        "DB_PASSWORD": "secret",        "DB_DATABASE": "myapp"      }    }  }}

With SSH tunnel

json
{  "mcpServers": {    "db-behind-bastion": {      "command": "uvx",      "args": ["db-mcp-server"],      "env": {        "DB_TYPE": "postgresql",        "DB_HOST": "10.0.0.5",        "DB_PORT": "5432",        "DB_USER": "postgres",        "DB_PASSWORD": "secret",        "DB_DATABASE": "myapp",        "SSH_HOST": "bastion.example.com",        "SSH_USER": "deploy",        "SSH_KEY": "~/.ssh/id_rsa"      }    }  }}

For multiple databases, add multiple instances:

json
{  "mcpServers": {    "db-prod": {      "command": "uvx",      "args": ["db-mcp-server"],      "env": { "DB_TYPE": "mysql", "DB_DATABASE": "prod", "..." : "..." }    },    "db-analytics": {      "command": "uvx",      "args": ["db-mcp-server"],      "env": { "DB_TYPE": "postgresql", "DB_DATABASE": "analytics", "..." : "..." }    },    "db-staging": {      "command": "uvx",      "args": ["db-mcp-server"],      "env": { "DB_TYPE": "mongodb", "DB_DATABASE": "staging", "..." : "..." }    }  }}

Tools

MySQL

  • query — Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)
  • execute — Execute write SQL (INSERT, UPDATE, DELETE) — requires DB_MODE=read-write
  • describe — Describe table structure
  • list_tables — List all tables
  • status — Show connection info

PostgreSQL

  • query — Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)
  • execute — Execute write SQL (INSERT, UPDATE, DELETE) — requires DB_MODE=read-write
  • describe — Describe table structure (column info from information_schema)
  • list_tables — List all tables in the public schema
  • status — Show connection info

SQLite

  • query — Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)
  • execute — Execute write SQL (INSERT, UPDATE, DELETE) — requires DB_MODE=read-write
  • describe — Describe table structure (PRAGMA table_info)
  • list_tables — List all tables
  • status — Show connection info

MongoDB

  • query — Find documents in a collection
  • describe — Collection stats ($collStats)
  • list_collections — List all collections
  • aggregate — Execute aggregation pipelines ($out/$merge blocked on read-only)
  • status — Show connection info

License

MIT

Source: README.md at commit c45f307

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v1.2.1LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts