Skip to main content

db-query-mcp is an MCP tool that enables data querying and export operations across diverse databases.

Project description

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

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

db_query_mcp-0.0.6.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

db_query_mcp-0.0.6-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file db_query_mcp-0.0.6.tar.gz.

File metadata

  • Download URL: db_query_mcp-0.0.6.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for db_query_mcp-0.0.6.tar.gz
Algorithm Hash digest
SHA256 1fc9963cb7c9a61843ccbc3a2cc3ec6206f1d2deadb14b8e4a72cca728e9e3c1
MD5 c8b8e730ec98eaf4e9b11d413f38d283
BLAKE2b-256 94f4b2a1bbbfbd64b51f972fc5fe48f2a706510140e3a7b591d2eec64a6df6e6

See more details on using hashes here.

File details

Details for the file db_query_mcp-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for db_query_mcp-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 feb94d2aafb9b380f2f7bbf9f2a8fd877c087dc1cb67d396d7df2f1ec0fa69fa
MD5 f48292582410e59e237683a55c91f78a
BLAKE2b-256 a87acaa4e1d31811a588c171e7eafd0a919efef7e1046dc049db721e5d01c90b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page