DB MCP Server
It lets an MCP editor inspect and modify SQL and NoSQL data through named database sessions.
Connect/disconnect named sessions and view active sessions/status.
Work with PostgreSQL, MySQL, MariaDB, SQLite, Oracle, SQL Server, MongoDB, Redis, and Elasticsearch.
Run SQL reads, list tables, describe columns, and query with parameter binds and result limits.
Insert, update, delete, and execute SQL writes with safeguards: required
WHEREclauses,confirm=truefor destructive actions, and read-only mode viaDB_ALLOW_WRITE=false.Manage MongoDB databases/collections and find, insert, update, or delete documents with non-empty filters and confirmation for deletes.
Read, set, delete, and list Redis keys.
Search, index, and delete Elasticsearch documents with confirmation for deletes.
Provides tools for searching, indexing, and deleting documents in Elasticsearch.
Provides tools for querying, inserting, updating, and deleting data in MariaDB databases, including listing and describing tables.
Provides tools for finding, inserting, updating, and deleting documents, and for listing databases and collections in MongoDB.
Provides tools for querying, inserting, updating, and deleting data in MySQL databases, including listing and describing tables.
Provides tools for querying, inserting, updating, and deleting data in PostgreSQL databases, including listing and describing tables.
Provides tools for getting, setting, deleting, and listing keys in Redis.
Provides tools for querying, inserting, updating, and deleting data in SQLite databases, including listing and describing tables.
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 List all tables in the orders database and describe the customers table."
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
Open-source MCP server owned by Pawan Gunjkar (pawangunjkar@gmail.com · GitHub). MIT licensed.
Developers ask the editor to inspect and change data without opening a SQL client, Mongo shell, redis-cli, or Kibana. The server speaks MCP over stdio, keeps named sessions, and routes each session to the right engine.
Sibling servers: github-mcp, jenkins-mcp, linux-ssh-mcp, observability-mcp, k8s-mcp.
Project information
Item | Value |
Package |
|
Runtime | Python 3.10+, FastMCP, stdio |
SQL | PostgreSQL, MySQL, MariaDB, SQLite, Oracle, SQL Server |
NoSQL | MongoDB, Redis, Elasticsearch |
Safety |
|
Related MCP server: Polyglot DB MCP
Architecture
flowchart TB
subgraph L1["Layer 1 — Editor"]
IDE["Cursor or Claude Desktop"]
end
subgraph L2["Layer 2 — MCP"]
SRV["db-mcp FastMCP server"]
HUB["DbHub named sessions"]
end
subgraph L3["Layer 3 — Drivers"]
SA["SQLAlchemy"]
MG["PyMongo"]
RD["redis-py"]
ES["HTTP client"]
end
subgraph L4["Layer 4 — Databases"]
PG["PostgreSQL / MySQL / SQLite"]
OR["Oracle / SQL Server"]
MO["MongoDB"]
RE["Redis"]
EL["Elasticsearch"]
end
IDE -->|"db_query / db_insert / mongo_find"| SRV
SRV --> HUB
HUB --> SA
HUB --> MG
HUB --> RD
HUB --> ES
SA --> PG
SA --> OR
MG --> MO
RD --> RE
ES --> ELA chat message becomes one tool call. The hub picks the session, the driver binds parameters, and the database returns rows or a write count. The editor never opens a second window.
flowchart LR
Q["db_connect"] --> S["Session"]
S --> R["db_query / db_describe_table"]
S --> W["db_insert / db_update"]
W --> C{"confirm or WHERE?"}
C -->|yes| DB[("Database")]
C -->|no| STOP["Refused"]
R --> DBEngines
Kind | Engine | URL example |
SQL |
|
|
SQL |
|
|
SQL |
|
|
SQL |
|
|
SQL |
|
|
NoSQL |
|
|
NoSQL |
|
|
NoSQL |
|
|
Oracle uses the python-oracledb thin mode, so the Instant Client is not required. CockroachDB and Amazon Aurora PostgreSQL use the postgresql engine.
Read tools
db_query, db_list_tables, db_describe_table, mongo_find, mongo_list_databases, mongo_list_collections, redis_get, redis_keys, es_search
Write tools
db_insert, db_update, db_delete, db_execute, mongo_insert, mongo_update, mongo_delete, redis_set, redis_delete, es_index_document, es_delete_document
UPDATE and DELETE require a WHERE clause. DROP, TRUNCATE, ALTER, Mongo deletes, and Elasticsearch deletes require confirm=true. Set DB_ALLOW_WRITE=false to make a session read-only.
Cursor
{
"mcpServers": {
"db": {
"command": "uv",
"args": ["run", "--directory", "C:/AI_Workspaces/Anti_Workspace/db-mcp", "server.py"],
"env": {
"DB_ENGINE": "postgresql",
"DB_URL": "postgresql+psycopg://ecs:ecs_secret@localhost:5432/ecs_oms",
"DB_ALLOW_WRITE": "true"
}
}
}
}Available Tools
23 toolsdb_connectC
Connect a named session. engine is postgresql, mysql, mariadb, sqlite, oracle, sqlserver, mongodb, redis, or elasticsearch.
Inputs: url (required), engine (required), allow_write, session_name. Returns: result
db_deleteB
Delete rows matching where_sql. confirm=true is required.
Inputs: table (required), where_sql (required), schema, confirm, +2 more. Returns: result
db_describe_tableB
Describe columns of a SQL table.
Inputs: table (required), schema, session_name. Returns: result
db_disconnectC
Disconnect a database session.
Inputs: session_name. Returns: result
db_executeB
Run a write statement. DROP, TRUNCATE, and ALTER require confirm=true.
Inputs: sql (required), confirm, params_json, session_name. Returns: result
db_insertC
Insert one row. values_json is a JSON object of column to value.
Inputs: table (required), values_json (required), schema, session_name. Returns: result
db_list_tablesA
List tables in a SQL schema. Oracle schema is the owner. Postgres schema is usually public.
Inputs: schema, session_name. Returns: result
db_queryA
Run a read statement. Use :name binds in params_json. Results are capped by limit (max 500).
Inputs: sql (required), limit, params_json, session_name. Returns: result
db_statusA
List active database sessions and supported engines.
Inputs: no named parameters. Returns: result
db_updateC
Update rows. where_sql is required, for example id = :id.
Inputs: table (required), where_sql (required), values_json (required), schema, +2 more. Returns: result
es_delete_documentA
Delete one Elasticsearch document. confirm=true is required.
Inputs: index (required), doc_id (required), confirm, session_name. Returns: result
es_index_documentB
Index one Elasticsearch document. Omit doc_id to let Elasticsearch assign one.
Inputs: index (required), document_json (required), doc_id, session_name. Returns: result
es_searchC
Search an Elasticsearch index.
Inputs: index (required), query_json, session_name. Returns: result
mongo_deleteB
Delete MongoDB documents matching a non-empty filter. confirm=true is required.
Inputs: database (required), collection (required), filter_json (required), confirm, +1 more. Returns: result
mongo_findD
Find MongoDB documents.
Inputs: database (required), collection (required), limit, filter_json, +1 more. Returns: result
mongo_insertC
Insert one MongoDB document.
Inputs: database (required), collection (required), document_json (required), session_name. Returns: result
mongo_list_collectionsC
List collections in a MongoDB database.
Inputs: database (required), session_name. Returns: result
mongo_list_databasesB
List MongoDB database names.
Inputs: session_name. Returns: result
mongo_updateC
Update MongoDB documents. update_json should include operators such as $set. Empty filters are refused.
Inputs: database (required), collection (required), filter_json (required), update_json (required), +1 more. Returns: result
redis_deleteC
DEL a Redis key.
Inputs: key (required), session_name. Returns: result
redis_getC
GET a Redis key.
Inputs: key (required), session_name. Returns: result
redis_keysC
List Redis keys matching a pattern, capped at 200.
Inputs: pattern, session_name. Returns: result
redis_setC
SET a Redis key.
Inputs: key (required), value (required), session_name. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 23 tools
Every tool is namespaced by engine (db_, mongo_, redis_, es_) and action, making read, write, and administrative operations easy to separate. Even db_execute vs db_insert/update/delete is clear because execute is for arbitrary SQL statements while the specialized tools target row-level operations.
Tool names follow a mostly consistent <engine>_<operation> pattern, with clear prefixes like db_, mongo_, redis_, and es_. Minor inconsistency exists between verb-only names like db_query, db_execute, and mongo_find versus verb-noun names like db_list_tables and mongo_list_databases.
23 tools is slightly above the typical sweet spot, but the server covers four different database engines, so the breadth is justified. Each tool represents a distinct operation and none feel redundant or purely decorative.
SQL, MongoDB, and Redis have solid CRUD and inspection coverage, and Elasticsearch covers search, indexing, and deletion. Minor gaps exist, such as no ES update/get-by-id, no explicit transaction control, and no SQL database listing, but agents can often work around these with db_execute or search queries.
Maintenance
Related MCP Connectors
Query, explore, and manage your databases through natural conversation.
Ask questions in plain language, get answers from your business database. No SQL required.
Work with your database from AI tools: ask, export, approved changes, and scheduled jobs.
Ask your databases questions in plain English, run read-only SQL and set up data alerts.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI to query and manage PostgreSQL and MongoDB databases through natural language. Supports automatic schema discovery, safe data operations, and network-wide database access with zero-configuration deployment.-
- -licenseNot gradedqualityNot gradedmaintenanceEnables interaction with 20+ databases (PostgreSQL, MongoDB, Neo4j, Elasticsearch, Redis, and more) through a single unified interface, allowing cross-database queries and operations via natural language.1-
- AlicenseAqualityDmaintenanceEnables AI assistants to connect to and interact with PostgreSQL, MySQL, SQLite, and MongoDB databases through natural language, supporting schema exploration, query execution, data export, and more.13MIT
- AlicenseAqualityDmaintenanceEnables executing SQL queries, schema introspection, and data management for PostgreSQL and MySQL databases via natural language, supporting local, SSH, and AWS RDS connections.869 npmMIT