mcp-dbutils 0.10.0__py3-none-any.whl → 0.10.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_dbutils/base.py +69 -12
- mcp_dbutils/config.py +2 -2
- mcp_dbutils/log.py +5 -10
- mcp_dbutils/mysql/__init__.py +6 -0
- mcp_dbutils/mysql/config.py +219 -0
- mcp_dbutils/mysql/handler.py +467 -0
- mcp_dbutils/mysql/server.py +216 -0
- mcp_dbutils-0.10.3.dist-info/METADATA +487 -0
- {mcp_dbutils-0.10.0.dist-info → mcp_dbutils-0.10.3.dist-info}/RECORD +12 -8
- mcp_dbutils-0.10.0.dist-info/METADATA +0 -227
- {mcp_dbutils-0.10.0.dist-info → mcp_dbutils-0.10.3.dist-info}/WHEEL +0 -0
- {mcp_dbutils-0.10.0.dist-info → mcp_dbutils-0.10.3.dist-info}/entry_points.txt +0 -0
- {mcp_dbutils-0.10.0.dist-info → mcp_dbutils-0.10.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,227 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: mcp-dbutils
|
3
|
-
Version: 0.10.0
|
4
|
-
Summary: MCP Database Utilities Service
|
5
|
-
Author: Dong Hao
|
6
|
-
License-Expression: MIT
|
7
|
-
License-File: LICENSE
|
8
|
-
Requires-Python: >=3.10
|
9
|
-
Requires-Dist: mcp>=1.2.1
|
10
|
-
Requires-Dist: psycopg2-binary>=2.9.10
|
11
|
-
Requires-Dist: python-dotenv>=1.0.1
|
12
|
-
Requires-Dist: pyyaml>=6.0.2
|
13
|
-
Provides-Extra: test
|
14
|
-
Requires-Dist: aiosqlite>=0.19.0; extra == 'test'
|
15
|
-
Requires-Dist: docker>=7.0.0; extra == 'test'
|
16
|
-
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'test'
|
17
|
-
Requires-Dist: pytest-cov>=4.1.0; extra == 'test'
|
18
|
-
Requires-Dist: pytest-docker>=2.0.0; extra == 'test'
|
19
|
-
Requires-Dist: pytest>=7.0.0; extra == 'test'
|
20
|
-
Requires-Dist: testcontainers>=3.7.0; extra == 'test'
|
21
|
-
Description-Content-Type: text/markdown
|
22
|
-
|
23
|
-
# MCP Database Utilities
|
24
|
-
|
25
|
-

|
26
|
-

|
27
|
-
[](https://github.com/donghao1393/mcp-dbutils/actions)
|
28
|
-

|
29
|
-

|
30
|
-
[](https://smithery.ai/server/@donghao1393/mcp-dbutils)
|
31
|
-
|
32
|
-
[中文文档](README_CN.md)
|
33
|
-
|
34
|
-
## Overview
|
35
|
-
MCP Database Utilities is a unified database access service that supports multiple database types (PostgreSQL and SQLite). Through its abstraction layer design, it provides a simple and unified database operation interface for MCP servers.
|
36
|
-
|
37
|
-
## Features
|
38
|
-
- Unified database access interface
|
39
|
-
- Support for multiple database configurations
|
40
|
-
- Secure read-only query execution
|
41
|
-
- Table structure and schema information retrieval
|
42
|
-
- Database tables listing via MCP tools
|
43
|
-
- Intelligent connection management and resource cleanup
|
44
|
-
- Debug mode support
|
45
|
-
- SSL/TLS connection support for PostgreSQL
|
46
|
-
|
47
|
-
## Installation and Configuration
|
48
|
-
|
49
|
-
### Installation Methods
|
50
|
-
#### Installing via Smithery
|
51
|
-
|
52
|
-
To install Database Utilities for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@donghao1393/mcp-dbutils):
|
53
|
-
|
54
|
-
```bash
|
55
|
-
npx -y @smithery/cli install @donghao1393/mcp-dbutils --client claude
|
56
|
-
```
|
57
|
-
|
58
|
-
#### Using uvx (Recommended)
|
59
|
-
No installation required, run directly using `uvx`:
|
60
|
-
```bash
|
61
|
-
uvx mcp-dbutils --config /path/to/config.yaml
|
62
|
-
```
|
63
|
-
|
64
|
-
Add to Claude configuration:
|
65
|
-
```json
|
66
|
-
"mcpServers": {
|
67
|
-
"mcp-dbutils": {
|
68
|
-
"command": "uvx",
|
69
|
-
"args": [
|
70
|
-
"mcp-dbutils",
|
71
|
-
"--config",
|
72
|
-
"/path/to/config.yaml"
|
73
|
-
],
|
74
|
-
"env": {
|
75
|
-
"MCP_DEBUG": "1" // Optional: Enable debug mode
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
```
|
80
|
-
|
81
|
-
#### Using pip
|
82
|
-
```bash
|
83
|
-
pip install mcp-dbutils
|
84
|
-
```
|
85
|
-
|
86
|
-
Add to Claude configuration:
|
87
|
-
```json
|
88
|
-
"mcpServers": {
|
89
|
-
"mcp-dbutils": {
|
90
|
-
"command": "python",
|
91
|
-
"args": [
|
92
|
-
"-m",
|
93
|
-
"mcp_dbutils",
|
94
|
-
"--config",
|
95
|
-
"/path/to/config.yaml"
|
96
|
-
],
|
97
|
-
"env": {
|
98
|
-
"MCP_DEBUG": "1" // Optional: Enable debug mode
|
99
|
-
}
|
100
|
-
}
|
101
|
-
}
|
102
|
-
```
|
103
|
-
|
104
|
-
#### Using Docker
|
105
|
-
```bash
|
106
|
-
docker run -i --rm \
|
107
|
-
-v /path/to/config.yaml:/app/config.yaml \
|
108
|
-
-v /path/to/sqlite.db:/app/sqlite.db \ # Optional: for SQLite database
|
109
|
-
-e MCP_DEBUG=1 \ # Optional: Enable debug mode
|
110
|
-
mcp/dbutils --config /app/config.yaml
|
111
|
-
```
|
112
|
-
|
113
|
-
Add to Claude configuration:
|
114
|
-
```json
|
115
|
-
"mcpServers": {
|
116
|
-
"mcp-dbutils": {
|
117
|
-
"command": "docker",
|
118
|
-
"args": [
|
119
|
-
"run",
|
120
|
-
"-i",
|
121
|
-
"--rm",
|
122
|
-
"-v",
|
123
|
-
"/path/to/config.yaml:/app/config.yaml",
|
124
|
-
"-v",
|
125
|
-
"/path/to/sqlite.db:/app/sqlite.db", // Optional: for SQLite database
|
126
|
-
"mcp/dbutils",
|
127
|
-
"--config",
|
128
|
-
"/app/config.yaml"
|
129
|
-
],
|
130
|
-
"env": {
|
131
|
-
"MCP_DEBUG": "1" // Optional: Enable debug mode
|
132
|
-
}
|
133
|
-
}
|
134
|
-
}
|
135
|
-
```
|
136
|
-
|
137
|
-
> **Note for Docker database connections:**
|
138
|
-
> - For SQLite: Mount your database file using `-v /path/to/sqlite.db:/app/sqlite.db`
|
139
|
-
> - For PostgreSQL running on host:
|
140
|
-
> - On Mac/Windows: Use `host.docker.internal` as host in config
|
141
|
-
> - On Linux: Use `172.17.0.1` (docker0 IP) or run with `--network="host"`
|
142
|
-
|
143
|
-
### Requirements
|
144
|
-
- Python 3.10+
|
145
|
-
- PostgreSQL (optional)
|
146
|
-
- SQLite3 (optional)
|
147
|
-
|
148
|
-
### Configuration File
|
149
|
-
The project requires a YAML configuration file, specified via the `--config` parameter. Configuration examples:
|
150
|
-
|
151
|
-
```yaml
|
152
|
-
connections:
|
153
|
-
# SQLite configuration examples
|
154
|
-
dev-db:
|
155
|
-
type: sqlite
|
156
|
-
path: /path/to/dev.db
|
157
|
-
# Password is optional
|
158
|
-
password:
|
159
|
-
|
160
|
-
# PostgreSQL standard configuration
|
161
|
-
test-db:
|
162
|
-
type: postgres
|
163
|
-
host: postgres.example.com
|
164
|
-
port: 5432
|
165
|
-
dbname: test_db
|
166
|
-
user: test_user
|
167
|
-
password: test_pass
|
168
|
-
|
169
|
-
# PostgreSQL URL configuration with SSL
|
170
|
-
prod-db:
|
171
|
-
type: postgres
|
172
|
-
url: postgresql://postgres.example.com:5432/prod-db?sslmode=verify-full
|
173
|
-
user: prod_user
|
174
|
-
password: prod_pass
|
175
|
-
|
176
|
-
# PostgreSQL full SSL configuration example
|
177
|
-
secure-db:
|
178
|
-
type: postgres
|
179
|
-
host: secure-db.example.com
|
180
|
-
port: 5432
|
181
|
-
dbname: secure_db
|
182
|
-
user: secure_user
|
183
|
-
password: secure_pass
|
184
|
-
ssl:
|
185
|
-
mode: verify-full # disable/require/verify-ca/verify-full
|
186
|
-
cert: /path/to/client-cert.pem
|
187
|
-
key: /path/to/client-key.pem
|
188
|
-
root: /path/to/root.crt
|
189
|
-
```
|
190
|
-
|
191
|
-
PostgreSQL SSL Configuration Options:
|
192
|
-
1. Using URL parameters:
|
193
|
-
```
|
194
|
-
postgresql://host:port/dbname?sslmode=verify-full&sslcert=/path/to/cert.pem
|
195
|
-
```
|
196
|
-
2. Using dedicated SSL configuration section:
|
197
|
-
```yaml
|
198
|
-
ssl:
|
199
|
-
mode: verify-full # SSL verification mode
|
200
|
-
cert: /path/to/cert.pem # Client certificate
|
201
|
-
key: /path/to/key.pem # Client private key
|
202
|
-
root: /path/to/root.crt # CA certificate
|
203
|
-
```
|
204
|
-
|
205
|
-
SSL Modes:
|
206
|
-
- disable: No SSL
|
207
|
-
- require: Use SSL but no certificate verification
|
208
|
-
- verify-ca: Verify server certificate is signed by trusted CA
|
209
|
-
- verify-full: Verify server certificate and hostname match
|
210
|
-
|
211
|
-
SQLite Configuration Options:
|
212
|
-
1. Basic configuration with path:
|
213
|
-
```yaml
|
214
|
-
type: sqlite
|
215
|
-
path: /path/to/db.sqlite
|
216
|
-
password: optional_password # Optional encryption
|
217
|
-
```
|
218
|
-
2. Using URI parameters:
|
219
|
-
```yaml
|
220
|
-
type: sqlite
|
221
|
-
path: /path/to/db.sqlite?mode=ro&cache=shared
|
222
|
-
```
|
223
|
-
|
224
|
-
### Debug Mode
|
225
|
-
Set environment variable `MCP_DEBUG=1` to enable debug mode for detailed logging output.
|
226
|
-
|
227
|
-
[Rest of the README content remains unchanged...]
|
File without changes
|
File without changes
|
File without changes
|