Database Query MCP
Planned future support for querying Elasticsearch databases
Planned future support for connecting to and querying MongoDB databases
Supports querying MySQL databases with read-only access, enabling SQL generation and execution with data export capabilities
Enables connection to PostgreSQL databases for executing queries and exporting results with default read-only mode for data safety
Provides functionality to connect to and query SQLite databases with read-only access and data export features
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., "@Database Query MCPshow me the top 10 customers by total purchase amount"
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.

[ English | 中文 ]
db-query-mcp
Introduction
db-query-mcp is a mcp tool supporting diverse database querying and exporting, featuring:
Multi-DB Support: Full compatibility with mainstream databases (ElasticSearch, MySQL, PostgreSQL, Oracle, SQLite, etc.)
Secure Access: Default read-only mode for data protection
Smart Query: Natural language to SQL conversion with query optimization
Data Export: CSV / Json export capabilities
Roadmap: Expanding support for MongoDB and GraphDatabase to become full-stack DB query MCP
Related MCP server: Common Database MCP Server
Demo
https://github.com/user-attachments/assets/60771cda-8b52-41bd-90e3-523c836f6366
Changelog
2025-06-02: Added support for ElasticSearch database queries
Installation
pip install db-query-mcpElasticSearch:
pip install "db-query-mcp[elasticsearch]"Install from GitHub:
pip install git+https://github.com/NewToolAI/db-query-mcpMySQL requires additional dependencies:
pip install pymysqlPostgreSQL requires additional dependencies:
pip install psycopg2-binaryFor other databases, install their respective connection packages:
Database | Connection Package | Example Connection String |
SQLite | Built-in Python |
|
MySQL |
|
|
PostgreSQL |
|
|
Oracle |
|
|
SQL Server |
|
|
Configuration
Note: For certain clients, such as Cursor, only one db-query-mcp server can run at a time.
Run using uvx
{
"mcpServers": {
"sqlite_db_mcp": {
"command": "uvx",
"args": [
"db-query-mcp",
"--db",
"sqlite",
"--uri",
"sqlite:///sqlite_company.db"
]
}
}
}{
"mcpServers": {
"es_db_mcp": {
"command": "uvx",
"args": [
"db-query-mcp",
"--db",
"elasticsearch",
"--uri",
"https://user:password@localhost:9200?index=test_data_index&ca_certs=/home/user/http_ca.crt"
]
}
}
}Run Using command
{
"mcpServers": {
"sqlite_db_mcp": {
"command": "db-query-mcp",
"args": [
"--db",
"sqlite",
"--uri",
"sqlite:///sqlite_company.db"
]
}
}
}{
"mcpServers": {
"es_db_mcp": {
"command": "db-query-mcp",
"args": [
"--db",
"elasticsearch",
"--uri",
"https://user:password@localhost:9200?index=test_data_index&ca_certs=/home/user/http_ca.crt"
]
}
}
}This server cannot be deployed
Maintenance
Related MCP Connectors
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Generate, fix, explain and run read-only SQL on PostgreSQL, MySQL and SQL Server
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides secure, read-only access to MariaDB/MySQL databases, allowing users to list databases, explore table schemas, and execute SQL queries with built-in security measures.440 npm4MIT
- AlicenseNot gradedqualityDmaintenanceEnables safe exploration and querying of multiple databases (PostgreSQL, MySQL, SQLite, DB2) with read-only defaults, connection pooling, and parameterized queries for SQL injection prevention.1MIT
- FlicenseNot gradedqualityDmaintenanceEnables safe interaction with MySQL databases through SELECT queries, table structure inspection, and database schema exploration. Provides read-only access to query data and examine database metadata.1-
- FlicenseNot gradedqualityCmaintenanceEnables secure SQL query execution on MySQL databases with authentication and permission control, allowing users to explore database tables and run read-only queries.-