
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 toolsPublic 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-onlyAccess mode
DB_HOSTdefault: localhostDatabase host (MySQL/PostgreSQL)
DB_PORTDatabase port (MySQL: 3306, PostgreSQL: 5432)
DB_USERDatabase user (MySQL default: root, PostgreSQL default: postgres)
DB_PASSWORDsecretDatabase password (MySQL/PostgreSQL, optional)
DB_URLsecretMongoDB connection URL (required for MongoDB, e.g. mongodb://...)
SSH_HOSTSSH bastion host for tunneling (MySQL/PostgreSQL only)
SSH_PORTdefault: 22SSH port
SSH_USERSSH username (default: current OS user)
SSH_KEYPath to SSH private key (e.g. ~/.ssh/id_rsa)
SSH_PASSWORDsecretSSH 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
| Variable | Required | Default | Description |
|---|---|---|---|
DB_TYPE | Yes | — | mysql |
DB_DATABASE | Yes | — | Database name |
DB_PASSWORD | Yes | — | Password |
DB_HOST | No | localhost | Host |
DB_PORT | No | 3306 | Port |
DB_USER | No | root | User |
DB_MODE | No | read-only | read-only or read-write |
PostgreSQL
| Variable | Required | Default | Description |
|---|---|---|---|
DB_TYPE | Yes | — | postgresql |
DB_DATABASE | Yes | — | Database name |
DB_PASSWORD | Yes | — | Password |
DB_HOST | No | localhost | Host |
DB_PORT | No | 5432 | Port |
DB_USER | No | postgres | User |
DB_MODE | No | read-only | read-only or read-write |
MongoDB
Details
- Repository
- github.com/stucchi/db-mcp-server
- Category
- Databases
- Package
db-mcp-server- Transport
- STDIO
- Auth
- Required
- Registry
- MCP registry, active