Metadata-Version: 2.4
Name: db-query-mcp
Version: 0.0.1
Summary: Add your description here
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp[cli]>=1.9.0
Requires-Dist: sqlalchemy>=2.0.0
Dynamic: license-file

![image](assets/logo.png)

![Python Version](https://img.shields.io/badge/python-3.10+-aff.svg)
![License](https://img.shields.io/badge/license-Apache%202-dfd.svg)
[![PyPI](https://img.shields.io/pypi/v/db-query-mcp)](https://pypi.org/project/db-query-mcp/)
[![GitHub pull request](https://img.shields.io/badge/PRs-welcome-blue)](https://github.com/Shulin-Zhang/db-query-mcp/pulls)

\[ [中文](README_zh.md) | English \]

# db-query-mcp

## Introduction
db-query-mcp is a versatile Database Query MCP tool with the following core features:

- **Multi-Database Support**: Full compatibility with mainstream relational databases (MySQL, PostgreSQL, Oracle, SQLite, etc.)
- **Secure Access**: Default read-only mode connection ensures data safety
- **Smart Query**: Provides efficient SQL generation and execution capabilities
- **Data Export**: Supports query result export functionality
- Future versions will expand support for Elasticsearch, MongoDB, and graph databases, aiming to become a full-stack database query solution.

## Installation

```bash
pip install db-query-mcp
```

**MySQL requires additional dependencies:**
```bash
pip install pymysql
```

**PostgreSQL requires additional dependencies:**
```bash
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

```json
{
  "mcpServers": {
    "db_query_mcp": {
      "command": "db-query-mcp",
      "args": [
        "--db",
        "mysql+pymysql://user:password@host:port/database"
      ]
    }
  }
}
```
