db-query-mcp

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

8

GitHub Stars

python

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "newtoolai-db-query-mcp": {
      "command": "uvx",
      "args": [
        "db-query-mcp",
        "--db",
        "sqlite",
        "--uri",
        "sqlite:///sqlite_company.db"
      ]
    }
  }
}

db-query-mcp is a Python-based MCP tool that enables querying and exporting across multiple databases with secure, read-only defaults, natural-language query support, and easy data export options. It is useful for building a unified querying layer over your data sources while protecting data integrity and simplifying access for analysts and applications.

How to use

You run the db-query-mcp server as an MCP server, then connect your MCP client to it to perform queries across supported databases. You can start separate MCP instances for different databases and point your client at the appropriate instance. Use the universal query interface to ask for data, and choose export formats such as CSV or JSON when you need to download results.

To query an attached database, start one of the configured MCP servers, then by your client select the corresponding server name (for example sqlite_db_mcp or es_db_mcp) and issue your query in the client’s standard MCP workflow. The server will enforce a safe, read-only mode by default to protect your data.

If you need to query Elasticsearch, ensure the Elasticsearch MCP server is running with its URI configured. You can then send natural language or structured queries to retrieve results, and export them as CSV or JSON if needed.

How to install

Prerequisites: you will need Python and pip installed on your system. You may also install optional Elasticsearch support if you plan to query an Elasticsearch database.

Install the core package with pip:

pip install db-query-mcp

To add Elasticsearch support, install the Elasticsearch extras:

pip install "db-query-mcp[elasticsearch]"

Install optional dependencies for common databases as needed, such as PyMySQL for MySQL or psycopg2-binary for PostgreSQL.

pip install pymysql
pip install psycopg2-binary

If you prefer to install directly from the project source, you can install from GitHub using pip:

pip install git+https://github.com/NewToolAI/db-query-mcp

Additional sections

Configuration notes: you can run multiple MCP servers, for example one per database. Each server is configured with a dedicated command and arguments. The examples below show two standard configurations using uvx as the runtime and the npm-like startup flow is not required for these parts.

Security: by default, the server runs in read-only mode to protect your data. Review access controls in your MCP client to ensure only authorized users can run queries and export data.

Available tools

export_csv_json

Export query results to CSV or JSON formats for external analysis or sharing.

smart_query

Convert natural language queries into optimized SQL-like queries to retrieve data from multiple databases.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational