stucchi avatar

DB MCP Server

stucchi/db-mcp-server

Connects Claude to MySQL, PostgreSQL, MongoDB, and SQLite databases with optional SSH tunneling for secure remote access. Each server instance handles one database and exposes read-only operations by default (query, describe, list tables/collections) with optional read-write mode for INSERT, UPDATE, and DELETE. The SSH tunnel support is especially handy for production databases behind bastion hosts. SQLite over SSH downloads the database file via SFTP and syncs changes back on shutdown. MongoDB gets aggregation pipelines with safety guards against write stages in read-only mode. Install with uvx and configure through environment variables. Run multiple instances to work with different databases simultaneously.

tools
7
auth
Secret needed
transport
STDIO
env vars
13
last updated
Mar 24, 2026

Tools

7 tools

Public tool metadata for what this MCP can expose to an agent.

queryExecute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH).

Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH).

No parameter schema in public metadata yet.

executeExecute write SQL (INSERT, UPDATE, DELETE) — requires DB_MODE=read-write.

Execute write SQL (INSERT, UPDATE, DELETE) — requires DB_MODE=read-write.

No parameter schema in public metadata yet.

describeDescribe table structure.

Describe table structure.

No parameter schema in public metadata yet.

list_tablesList all tables.

List all tables.

No parameter schema in public metadata yet.

statusShow connection info.

Show connection info.

No parameter schema in public metadata yet.

list_collectionsList all collections.

List all collections.

No parameter schema in public metadata yet.

aggregateExecute aggregation pipelines ($out/$merge blocked on read-only).

Execute aggregation pipelines ($out/$merge blocked on read-only).

No parameter schema in public metadata yet.

Sponsors

Configuration

DB_TYPE*

Database type

DB_DATABASE*

Database name

DB_MODEdefault: read-only

Access mode

DB_HOSTdefault: localhost

Database host (MySQL/PostgreSQL)

DB_PORT

Database port (MySQL: 3306, PostgreSQL: 5432)

DB_USER

Database user (MySQL default: root, PostgreSQL default: postgres)

DB_PASSWORDsecret

Database password (MySQL/PostgreSQL, optional)

DB_URLsecret

MongoDB connection URL (required for MongoDB, e.g. mongodb://...)

SSH_HOST

SSH bastion host for tunneling (MySQL/PostgreSQL only)

SSH_PORTdefault: 22

SSH port

SSH_USER

SSH username (default: current OS user)

SSH_KEY

Path to SSH private key (e.g. ~/.ssh/id_rsa)

SSH_PASSWORDsecret

SSH password (if no key provided)

Readme

db-mcp-server

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

Installation

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


View the full README on GitHub

Details

Repository
github.com/stucchi/db-mcp-server
Category
Databases
Package
db-mcp-server
Transport
STDIO
Auth
Required
Registry
MCP registry, active

More from stucchi

Related Databases MCP servers

View all
1amansingh63 avatarDBHub Analyticsamansingh63/dbhub-analyticsMCP server for Databricks, BigQuery, PostgreSQL, MySQL, SQL Server, SQLite, MariaDB0stars
2thinair avatarDataco.thinair/dataPostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.0stars
3shyamolkonwar avatarRivtorshyamolkonwar/rivtor-cliDeploy full-stack apps (frontend, backend, Postgres, Redis) from your agent and get live URLs.0stars
4daedalus avatarMcp Psycopg2daedalus/mcp-psycopg2MCP server exposing psycopg2 PostgreSQL database adapter functionality0stars
5mironovisa avatardatamcp — Hosted Model Context Protocol for Databases, APIs, and Agent Memoryio.github.mironovisa/datamcpPostgreSQL, MySQL, OpenAPI/Swagger, and shared Agent Memory with scoped access.0stars
6mukundakatta avatarSqlfmt Mcpmukundakatta/mcp-stackDeterministic SQL formatting across 19 dialects (postgres, mysql, snowflake, bigquery, etc.).0stars