Planned future support for querying Elasticsearch databases
Planned future support for connecting to and querying MongoDB databases
Supports querying MySQL databases with read-only access, enabling SQL generation and execution with data export capabilities
Enables connection to PostgreSQL databases for executing queries and exporting results with default read-only mode for data safety
Provides functionality to connect to and query SQLite databases with read-only access and data export features
[ 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
ElasticSearch:
Install from GitHub:
MySQL requires additional dependencies:
PostgreSQL requires additional dependencies:
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
Run Using command
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A versatile tool that enables querying and exporting data from multiple relational databases (MySQL, PostgreSQL, Oracle, SQLite, etc.) in read-only mode for data safety.
Related MCP Servers
- -securityFlicense-qualityA tool that provides simple API to execute SQL queries and manage MySQL databases, designed to integrate with Cursor IDE for AI assistants to directly perform database operations.Last updated -Python
- AsecurityAlicenseAqualityA server that connects to PostgreSQL databases and provides tools for safely exploring schemas, running read-only SQL queries, and performing data analysis with pre-built templates.Last updated -56931JavaScriptMIT License
- AsecurityAlicenseAqualityProvides secure, read-only access to MariaDB/MySQL databases, allowing users to list databases, explore table schemas, and execute SQL queries with built-in security measures.Last updated -41143JavaScriptMIT License
- -securityFlicense-qualityProvides Claude Desktop with secure access to multiple database connections, allowing users to query MySQL, PostgreSQL, SQLite, and SQL Server databases directly through natural language.Last updated -