db-mcp-server
Provides tools for finding documents, describing collection stats, listing collections, executing aggregation pipelines (with restrictions on $out/$merge in read-only mode), and checking connection status for MongoDB databases.
Provides tools for querying, executing write operations (in read-write mode), describing table structure, listing tables, and checking connection status for MySQL databases.
Provides tools for querying, executing write operations (in read-write mode), describing table structure via information_schema, listing tables in the public schema, and checking connection status for PostgreSQL databases.
Provides tools for querying, executing write operations (in read-write mode), describing table structure via PRAGMA table_info, listing tables, and checking connection status for SQLite databases. Supports both local and remote (over SSH) database files.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@db-mcp-server show me the users table schema"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
db-mcp-server
MCP server for MySQL, PostgreSQL, MongoDB, and SQLite databases. One instance per database, no Docker required.
Installation
uvx db-mcp-serverRelated MCP server: MCP Database Server
Configuration
Configure via environment variables. Each instance connects to a single database.
MySQL
Variable | Required | Default | Description |
| Yes | — |
|
| Yes | — | Database name |
| Yes | — | Password |
| No |
| Host |
| No |
| Port |
| No |
| User |
| No |
|
|
PostgreSQL
Variable | Required | Default | Description |
| Yes | — |
|
| Yes | — | Database name |
| Yes | — | Password |
| No |
| Host |
| No |
| Port |
| No |
| User |
| No |
|
|
MongoDB
Variable | Required | Default | Description |
| Yes | — |
|
| Yes | — | Database name |
| Yes | — | Connection URL ( |
| No |
|
|
SQLite
Variable | Required | Default | Description |
| Yes | — |
|
| Yes | — | Path to |
| No | filename | Display name |
| No |
|
|
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.
Variable | Required | Default | Description |
| No | — | SSH bastion host (activates tunneling) |
| No |
| SSH port |
| No | Current OS user | SSH username |
| No | — | Path to private key ( |
| No | — | 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)
{
"mcpServers": {
"db-local": {
"command": "uvx",
"args": ["db-mcp-server"],
"env": {
"DB_TYPE": "sqlite",
"DB_PATH": "/path/to/database.db"
}
}
}
}SQLite over SSH
{
"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"
}
}
}
}{
"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
{
"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:
{
"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-writedescribe — 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-writedescribe — 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-writedescribe — 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
Available Tools
5 toolsdescribeA
Describe the structure of a SQLite table (PRAGMA table_info).
Inputs: table (required). Returns: result
executeB
Execute a write query on the SQLite database. Only works if the database is configured with mode='read-write'.
Inputs: query (required). Returns: result
list_tablesA
List all tables in the SQLite database.
Inputs: no named parameters. Returns: result
queryA
Execute a read-only query on the SQLite database. Only SELECT, SHOW, DESCRIBE, EXPLAIN, WITH are allowed on read-only databases.
Inputs: query (required). Returns: result
statusA
Show connection info: type, host, database, mode, status.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clear and distinct purpose: describe for table structure, execute for write queries, list_tables for listing tables, query for read queries, and status for connection info. No overlap.
All tool names are lowercase, use verbs or verb phrases consistently, and follow a simple pattern (e.g., describe, list_tables). No mixing of conventions.
With 5 tools, the server provides a focused yet complete set for basic SQLite database operations: schema inspection, read/write queries, and status checks. The count feels appropriate for its scope.
The tool set covers essential CRUD operations via generic query and execute tools, but lacks specialized tools for common DDL operations like creating tables. This gap is minor given the generic SQL approach.
Maintenance
Related MCP Connectors
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA modular MCP server that enables interaction with multiple database types including PostgreSQL, MySQL, SQLite, Redis, MongoDB, and LDAP. It provides tools for executing queries, managing SQL commands, and exploring database schemas with configurable read-only security.17 npmMIT
- FlicenseNot gradedqualityDmaintenanceA secure multi-database MCP server supporting MySQL, PostgreSQL, and SQLite with read-only enforcement, SQL injection prevention, and tools for schema analysis, performance optimization, and visualization.4-
- FlicenseNot gradedqualityDmaintenanceA versatile MCP server that connects to multiple relational databases (MySQL, PostgreSQL, Oracle, SQL Server, SQLite) and enables secure read-only SQL query execution and metadata access.4-
- FlicenseNot gradedqualityDmaintenanceA multi-database MCP server supporting PostgreSQL, ClickHouse, and MySQL that enables database exploration and SQL execution through MCP stdio or HTTP API.-