db-query-mcp is an MCP tool that enables data querying and export operations across diverse databases.
Project description
[ 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
For some clients, only one db-query-mcp server can be enabled at a time.
{
"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"
]
}
}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file db_query_mcp-0.0.7.tar.gz.
File metadata
- Download URL: db_query_mcp-0.0.7.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a5fee0a27f99d385a252afa895e15b97c804eb632dad77105d444f17c021b9b
|
|
| MD5 |
134ec7f1996ee32917b55b631c06a9ae
|
|
| BLAKE2b-256 |
5446ecb9cddf5d0f9d15078c93651af6a81cf3605eb7e25bbca59fc1a315f457
|
File details
Details for the file db_query_mcp-0.0.7-py3-none-any.whl.
File metadata
- Download URL: db_query_mcp-0.0.7-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
532577e01cb6bb7701f4662ba8ca8f62b6e63816bfe1305d6cd2a698b41bd3e4
|
|
| MD5 |
b4a753deb04bb07923e19e2b4411265d
|
|
| BLAKE2b-256 |
09033a2180e982d48c20ff31ff5a92c9755b31687e7696915a35572a3ddf2e64
|