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 "Install 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 installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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.Last updated4854MIT
- Alicense-qualityDmaintenanceEnables safe exploration and querying of multiple databases (PostgreSQL, MySQL, SQLite, DB2) with read-only defaults, connection pooling, and parameterized queries for SQL injection prevention.Last updated1MIT
- Flicense-qualityDmaintenanceEnables 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.Last updated1
- Flicense-qualityDmaintenanceA 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.Last updated4
Related MCP Connectors
Run SOQL queries to explore and retrieve Salesforce data. Inspect records, fields, and relationshi…
Explore your Messages SQLite database to browse tables and inspect schemas with ease. Run flexible…
Run SOQL queries to explore and retrieve Salesforce data. Access accounts, contacts, opportunities…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/NewToolAI/db-query-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server