DB Query
Query and export data from various databases including ElasticSearch, MySQL, PostgreSQL, Oracle, and SQLite.

[ 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
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-mcp
ElasticSearch:
pip install "db-query-mcp[elasticsearch]"
Install from GitHub:
pip install git+https://github.com/NewToolAI/db-query-mcp
MySQL requires additional dependencies:
pip install pymysql
PostgreSQL requires additional dependencies:
pip install psycopg2-binary
For other databases, install their respective connection packages:
| Database | Connection Package | Example Connection String |
|---|---|---|
| SQLite | Built-in Python | sqlite:///example.db |
| MySQL | pymysql or mysql-connector-python | mysql+pymysql://user:password@localhost/dbname |
| PostgreSQL | psycopg2 or psycopg2-binary | postgresql://user:password@localhost:5432/dbname |
| Oracle | cx_Oracle | oracle+cx_oracle://user:password@hostname:1521/sidname |
| SQL Server | pyodbc or pymssql | mssql+pyodbc://user:password@hostname/dbname |
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"
]
}
}
}
Related Servers
NetSuite MCP Server by CData
A read-only MCP server that allows LLMs to query live NetSuite data. Requires the CData JDBC Driver for NetSuite.
DeepMemory
DeepMemory MCP is a small Model Context Protocol (MCP) server that provides long-term memory storage for conversational agents.
Memory-Plus
a lightweight, local RAG memory store to record, retrieve, update, delete, and visualize persistent "memories" across sessions—perfect for developers working with multiple AI coders (like Windsurf, Cursor, or Copilot) or anyone who wants their AI to actually remember them.
Talk with Your Database
Interact with PostgreSQL, MySQL, MariaDB, and SQLite databases using SQLAlchemy.
SAS XPT MCP Server by CData
A Model Context Protocol (MCP) server for SAS XPT files, powered by the CData JDBC Driver.
Alpha Vantage
Provides real-time financial market data using the Alpha Vantage API.
Database
Universal database MCP server supporting multiple database types including PostgreSQL, Redshift, CockroachDB, MySQL, RDS MySQL, Microsoft SQL Server, BigQuery, Oracle DB, and SQLite
MCP Memory Server
An advanced memory system for Claude Desktop that provides persistent memory using MCP. Requires an Azure Cosmos DB account and an OpenAI API key.
CData Bing Ads
A read-only MCP server to query live Bing Ads data using CData's JDBC driver.
BrianKnows
Access BrianKnows' extensive blockchain knowledge base.