[ 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"
]
}
}
}
Metadata
Release files for iflow-mcp_db-query-mcp 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| iflow_mcp_db_query_mcp-0.0.7.tar.gz | 13.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iflow_mcp_db_query_mcp-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.8 kB
Release files / iflow_mcp_db_query_mcp-0.0.7.tar.gz
| Download URL | iflow_mcp_db_query_mcp-0.0.7.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
380ad0c6603f4339fff8b9b2cd49b1eb55b3d0f6681b20f38214702bfcf2e26f
|
|
BLAKE2b-256 checksum How to use checksums |
f94390171a4fae0561a1107ce5fbfbc5a92bac0d1083e88298977be35faf61df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.8
|
Release files / iflow_mcp_db_query_mcp-0.0.7-py3-none-any.whl
| Download URL | iflow_mcp_db_query_mcp-0.0.7-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
133235162763b43f9e47b94b61933606fbbe181e93a51d61dc47285b51a0d2de
|
|
BLAKE2b-256 checksum How to use checksums |
d48b6f45f9eaca9cf8acb08dccd0a754bea451b6461af188319501a3f24c4959
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.8
|