Skip to main content

image

Python Version License PyPI GitHub pull request

[ 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"
        ]
      }
  }
}

Metadata

Release files for 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)

Source distribution for db-query-mcp 0.0.7
File Size Uploaded
db_query_mcp-0.0.7.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for db-query-mcp 0.0.7
File Interpreter ABI Platform
db_query_mcp-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 27.5 kB

Release files / db_query_mcp-0.0.7.tar.gz

Download URL db_query_mcp-0.0.7.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3a5fee0a27f99d385a252afa895e15b97c804eb632dad77105d444f17c021b9b
BLAKE2b-256 checksum
How to use checksums
5446ecb9cddf5d0f9d15078c93651af6a81cf3605eb7e25bbca59fc1a315f457
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Release files / db_query_mcp-0.0.7-py3-none-any.whl

Download URL db_query_mcp-0.0.7-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
532577e01cb6bb7701f4662ba8ca8f62b6e63816bfe1305d6cd2a698b41bd3e4
BLAKE2b-256 checksum
How to use checksums
09033a2180e982d48c20ff31ff5a92c9755b31687e7696915a35572a3ddf2e64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page