mcp-dbutils 0.9.0__tar.gz → 0.10.2__tar.gz
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-0.9.0 → mcp_dbutils-0.10.2}/.github/workflows/release.yml +16 -14
- mcp_dbutils-0.10.2/.releaserc.json +26 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/CHANGELOG.md +39 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/PKG-INFO +137 -42
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/README.md +135 -41
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/README_CN.md +132 -40
- mcp_dbutils-0.10.2/config.yaml.example +78 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/pyproject.toml +8 -1
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/base.py +69 -12
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/config.py +2 -2
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/log.py +5 -10
- mcp_dbutils-0.10.2/src/mcp_dbutils/mysql/__init__.py +6 -0
- mcp_dbutils-0.10.2/src/mcp_dbutils/mysql/config.py +219 -0
- mcp_dbutils-0.10.2/src/mcp_dbutils/mysql/handler.py +467 -0
- mcp_dbutils-0.10.2/src/mcp_dbutils/mysql/server.py +216 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/postgres/config.py +80 -19
- mcp_dbutils-0.10.2/tests/integration/__init__.py +0 -0
- mcp_dbutils-0.10.2/tests/integration/conftest.py +12 -0
- mcp_dbutils-0.10.2/tests/integration/fixtures.py +226 -0
- mcp_dbutils-0.10.2/tests/integration/test_logging.py +139 -0
- mcp_dbutils-0.10.2/tests/integration/test_mysql.py +89 -0
- mcp_dbutils-0.10.2/tests/integration/test_mysql_config.py +201 -0
- mcp_dbutils-0.10.2/tests/integration/test_postgres_config.py +229 -0
- mcp_dbutils-0.10.2/tests/unit/test_log.py +106 -0
- mcp_dbutils-0.9.0/config.yaml.example +0 -40
- mcp_dbutils-0.9.0/tests/integration/test_postgres_config.py +0 -129
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/.coveragerc +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/.github/workflows/test.yml +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/.gitignore +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/Dockerfile +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/LICENSE +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/smithery.yaml +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/__init__.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/postgres/__init__.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/postgres/handler.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/postgres/server.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/sqlite/__init__.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/sqlite/config.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/sqlite/handler.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/sqlite/server.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/src/mcp_dbutils/stats.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/tests/conftest.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/tests/integration/test_monitoring.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/tests/integration/test_monitoring_enhanced.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/tests/integration/test_postgres.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/tests/integration/test_prompts.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/tests/integration/test_sqlite.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/tests/integration/test_sqlite_config.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/tests/integration/test_tools.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/tests/integration/test_tools_advanced.py +0 -0
- {mcp_dbutils-0.9.0 → mcp_dbutils-0.10.2}/tests/unit/test_stats.py +0 -0
@@ -2,8 +2,7 @@ name: Release
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches:
|
6
|
-
- main
|
5
|
+
branches: [ main ]
|
7
6
|
|
8
7
|
jobs:
|
9
8
|
release:
|
@@ -15,6 +14,8 @@ jobs:
|
|
15
14
|
permissions:
|
16
15
|
id-token: write
|
17
16
|
contents: write
|
17
|
+
issues: write
|
18
|
+
pull-requests: write
|
18
19
|
|
19
20
|
steps:
|
20
21
|
- uses: actions/checkout@v4
|
@@ -26,24 +27,25 @@ jobs:
|
|
26
27
|
with:
|
27
28
|
python-version: '3.10'
|
28
29
|
|
29
|
-
- name: Install
|
30
|
+
- name: Install uv
|
30
31
|
run: |
|
31
32
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
32
33
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
33
34
|
|
34
|
-
- name:
|
35
|
-
|
36
|
-
uses: python-semantic-release/python-semantic-release@master
|
35
|
+
- name: Setup Node.js
|
36
|
+
uses: actions/setup-node@v4
|
37
37
|
with:
|
38
|
-
|
39
|
-
build: false
|
38
|
+
node-version: 'lts/*'
|
40
39
|
|
41
|
-
- name:
|
42
|
-
if: steps.version.outputs.released == 'true'
|
40
|
+
- name: Install semantic-release
|
43
41
|
run: |
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
npm install -g semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/exec
|
43
|
+
|
44
|
+
- name: Release
|
45
|
+
id: semantic-release
|
46
|
+
env:
|
47
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
48
|
+
run: npx semantic-release
|
49
|
+
|
47
50
|
- name: Publish to PyPI
|
48
|
-
if: steps.version.outputs.released == 'true'
|
49
51
|
uses: pypa/gh-action-pypi-publish@release/v1
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"branches": ["main"],
|
3
|
+
"plugins": [
|
4
|
+
"@semantic-release/commit-analyzer",
|
5
|
+
"@semantic-release/release-notes-generator",
|
6
|
+
"@semantic-release/changelog",
|
7
|
+
["@semantic-release/exec", {
|
8
|
+
"verifyConditionsCmd": "uv --version",
|
9
|
+
"prepareCmd": "sed -i.bak 's/version = \".*\"/version = \"${nextRelease.version}\"/g' pyproject.toml && rm -f pyproject.toml.bak",
|
10
|
+
"publishCmd": "uv build"
|
11
|
+
}],
|
12
|
+
["@semantic-release/git", {
|
13
|
+
"assets": [
|
14
|
+
"pyproject.toml",
|
15
|
+
"CHANGELOG.md"
|
16
|
+
],
|
17
|
+
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
|
18
|
+
}],
|
19
|
+
["@semantic-release/github", {
|
20
|
+
"assets": [
|
21
|
+
{"path": "dist/*.whl", "label": "Python Wheel ${nextRelease.version}"},
|
22
|
+
{"path": "dist/*.tar.gz", "label": "Source Distribution ${nextRelease.version}"}
|
23
|
+
]
|
24
|
+
}]
|
25
|
+
]
|
26
|
+
}
|
@@ -1,6 +1,45 @@
|
|
1
|
+
## [0.10.2](https://github.com/donghao1393/mcp-dbutils/compare/v0.10.1...v0.10.2) (2025-03-13)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* remove conditional check for PyPI publishing ([e714ef8](https://github.com/donghao1393/mcp-dbutils/commit/e714ef89db8dc35eca1a5c2f09f240dee94192eb))
|
7
|
+
|
8
|
+
## [0.10.1](https://github.com/donghao1393/mcp-dbutils/compare/v0.10.0...v0.10.1) (2025-03-13)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* update verifyConditionsCmd in semantic-release config ([4271476](https://github.com/donghao1393/mcp-dbutils/commit/42714761d5d8bbbd39b9bae2aa550e1d06aa351c))
|
14
|
+
|
1
15
|
# CHANGELOG
|
2
16
|
|
3
17
|
|
18
|
+
## v0.10.0 (2025-03-12)
|
19
|
+
|
20
|
+
### Features
|
21
|
+
|
22
|
+
- Enhance database configuration with SSL support
|
23
|
+
([#22](https://github.com/donghao1393/mcp-dbutils/pull/22),
|
24
|
+
[`4ea4d0b`](https://github.com/donghao1393/mcp-dbutils/commit/4ea4d0b5deb51b8e9202839bd7a8cd5f71463c88))
|
25
|
+
|
26
|
+
* feat: enhance database configuration with SSL support
|
27
|
+
|
28
|
+
- Replace jdbc_url with url for better clarity - Add dedicated SSL configuration support - Update
|
29
|
+
documentation and examples - Update test cases
|
30
|
+
|
31
|
+
BREAKING CHANGE: Remove jdbc_url support as it was just added and not yet in production use
|
32
|
+
|
33
|
+
* docs: update documentation for SSL support and URL configuration
|
34
|
+
|
35
|
+
- Add SSL configuration examples - Update configuration format examples - Add configuration
|
36
|
+
documentation in both English and Chinese - Remove JDBC related content
|
37
|
+
|
38
|
+
### Breaking Changes
|
39
|
+
|
40
|
+
- Remove jdbc_url support as it was just added and not yet in production use
|
41
|
+
|
42
|
+
|
4
43
|
## v0.9.0 (2025-03-09)
|
5
44
|
|
6
45
|
### Documentation
|
@@ -1,12 +1,13 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-dbutils
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.10.2
|
4
4
|
Summary: MCP Database Utilities Service
|
5
5
|
Author: Dong Hao
|
6
6
|
License-Expression: MIT
|
7
7
|
License-File: LICENSE
|
8
8
|
Requires-Python: >=3.10
|
9
9
|
Requires-Dist: mcp>=1.2.1
|
10
|
+
Requires-Dist: mysql-connector-python>=8.2.0
|
10
11
|
Requires-Dist: psycopg2-binary>=2.9.10
|
11
12
|
Requires-Dist: python-dotenv>=1.0.1
|
12
13
|
Requires-Dist: pyyaml>=6.0.2
|
@@ -32,7 +33,7 @@ Description-Content-Type: text/markdown
|
|
32
33
|
[中文文档](README_CN.md)
|
33
34
|
|
34
35
|
## Overview
|
35
|
-
MCP Database Utilities is a unified database access service that supports multiple database types (PostgreSQL and
|
36
|
+
MCP Database Utilities is a unified database access service that supports multiple database types (PostgreSQL, SQLite, and MySQL). Through its abstraction layer design, it provides a simple and unified database operation interface for MCP servers.
|
36
37
|
|
37
38
|
## Features
|
38
39
|
- Unified database access interface
|
@@ -42,6 +43,7 @@ MCP Database Utilities is a unified database access service that supports multip
|
|
42
43
|
- Database tables listing via MCP tools
|
43
44
|
- Intelligent connection management and resource cleanup
|
44
45
|
- Debug mode support
|
46
|
+
- SSL/TLS connection support for PostgreSQL and MySQL
|
45
47
|
|
46
48
|
## Installation and Configuration
|
47
49
|
|
@@ -143,54 +145,138 @@ Add to Claude configuration:
|
|
143
145
|
- Python 3.10+
|
144
146
|
- PostgreSQL (optional)
|
145
147
|
- SQLite3 (optional)
|
148
|
+
- MySQL (optional)
|
146
149
|
|
147
150
|
### Configuration File
|
148
|
-
The project requires a YAML configuration file, specified via the `--config` parameter. Configuration
|
151
|
+
The project requires a YAML configuration file, specified via the `--config` parameter. Configuration examples:
|
149
152
|
|
150
153
|
```yaml
|
151
154
|
connections:
|
152
|
-
#
|
153
|
-
|
155
|
+
# SQLite configuration examples
|
156
|
+
dev-db:
|
157
|
+
type: sqlite
|
158
|
+
path: /path/to/dev.db
|
159
|
+
# Password is optional
|
160
|
+
password:
|
161
|
+
|
162
|
+
# PostgreSQL standard configuration
|
163
|
+
test-db:
|
154
164
|
type: postgres
|
155
|
-
|
156
|
-
user: postgres
|
157
|
-
password: secret
|
158
|
-
host: host.docker.internal # For Mac/Windows
|
159
|
-
# host: 172.17.0.1 # For Linux (docker0 IP)
|
165
|
+
host: postgres.example.com
|
160
166
|
port: 5432
|
167
|
+
dbname: test_db
|
168
|
+
user: test_user
|
169
|
+
password: test_pass
|
161
170
|
|
162
|
-
# PostgreSQL
|
163
|
-
|
171
|
+
# PostgreSQL URL configuration with SSL
|
172
|
+
prod-db:
|
164
173
|
type: postgres
|
165
|
-
|
166
|
-
user:
|
167
|
-
password:
|
168
|
-
|
169
|
-
#
|
170
|
-
|
171
|
-
type:
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
174
|
+
url: postgresql://postgres.example.com:5432/prod-db?sslmode=verify-full
|
175
|
+
user: prod_user
|
176
|
+
password: prod_pass
|
177
|
+
|
178
|
+
# PostgreSQL full SSL configuration example
|
179
|
+
secure-db:
|
180
|
+
type: postgres
|
181
|
+
host: secure-db.example.com
|
182
|
+
port: 5432
|
183
|
+
dbname: secure_db
|
184
|
+
user: secure_user
|
185
|
+
password: secure_pass
|
186
|
+
ssl:
|
187
|
+
mode: verify-full # disable/require/verify-ca/verify-full
|
188
|
+
cert: /path/to/client-cert.pem
|
189
|
+
key: /path/to/client-key.pem
|
190
|
+
root: /path/to/root.crt
|
191
|
+
|
192
|
+
# MySQL standard configuration
|
193
|
+
sandbox-mysql:
|
194
|
+
type: mysql
|
195
|
+
host: localhost
|
196
|
+
port: 3306
|
197
|
+
database: sandbox_db
|
198
|
+
user: sandbox_user
|
199
|
+
password: sandbox_pass
|
200
|
+
charset: utf8mb4
|
201
|
+
|
202
|
+
# MySQL URL configuration
|
203
|
+
integration-mysql:
|
204
|
+
type: mysql
|
205
|
+
url: mysql://mysql.example.com:3306/integration_db?charset=utf8mb4
|
206
|
+
user: integration_user
|
207
|
+
password: integration_pass
|
208
|
+
|
209
|
+
# MySQL with SSL configuration
|
210
|
+
secure-mysql:
|
211
|
+
type: mysql
|
212
|
+
host: secure-mysql.example.com
|
213
|
+
port: 3306
|
214
|
+
database: secure_db
|
215
|
+
user: secure_user
|
216
|
+
password: secure_pass
|
217
|
+
charset: utf8mb4
|
218
|
+
ssl:
|
219
|
+
mode: verify_identity
|
220
|
+
ca: /path/to/ca.pem
|
221
|
+
cert: /path/to/client-cert.pem
|
222
|
+
key: /path/to/client-key.pem
|
180
223
|
```
|
181
224
|
|
182
|
-
|
183
|
-
|
184
|
-
PostgreSQL:
|
185
|
-
1.
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
225
|
+
Database SSL Configuration Options:
|
226
|
+
|
227
|
+
PostgreSQL SSL Configuration:
|
228
|
+
1. Using URL parameters:
|
229
|
+
```
|
230
|
+
postgresql://host:port/dbname?sslmode=verify-full&sslcert=/path/to/cert.pem
|
231
|
+
```
|
232
|
+
2. Using dedicated SSL configuration section:
|
233
|
+
```yaml
|
234
|
+
ssl:
|
235
|
+
mode: verify-full # SSL verification mode
|
236
|
+
cert: /path/to/cert.pem # Client certificate
|
237
|
+
key: /path/to/key.pem # Client private key
|
238
|
+
root: /path/to/root.crt # CA certificate
|
239
|
+
```
|
240
|
+
|
241
|
+
PostgreSQL SSL Modes:
|
242
|
+
- disable: No SSL
|
243
|
+
- require: Use SSL but no certificate verification
|
244
|
+
- verify-ca: Verify server certificate is signed by trusted CA
|
245
|
+
- verify-full: Verify server certificate and hostname match
|
246
|
+
|
247
|
+
MySQL SSL Configuration:
|
248
|
+
1. Using URL parameters:
|
249
|
+
```
|
250
|
+
mysql://host:port/dbname?ssl-mode=verify_identity&ssl-ca=/path/to/ca.pem
|
251
|
+
```
|
252
|
+
2. Using dedicated SSL configuration section:
|
253
|
+
```yaml
|
254
|
+
ssl:
|
255
|
+
mode: verify_identity # SSL verification mode
|
256
|
+
ca: /path/to/ca.pem # CA certificate
|
257
|
+
cert: /path/to/cert.pem # Client certificate
|
258
|
+
key: /path/to/key.pem # Client private key
|
259
|
+
```
|
260
|
+
|
261
|
+
MySQL SSL Modes:
|
262
|
+
- disabled: No SSL
|
263
|
+
- preferred: Use SSL if available, but allow unencrypted connection
|
264
|
+
- required: Always use SSL, but don't verify server certificate
|
265
|
+
- verify_ca: Verify server certificate is signed by trusted CA
|
266
|
+
- verify_identity: Verify server certificate and hostname match
|
267
|
+
|
268
|
+
SQLite Configuration Options:
|
269
|
+
1. Basic configuration with path:
|
270
|
+
```yaml
|
271
|
+
type: sqlite
|
272
|
+
path: /path/to/db.sqlite
|
273
|
+
password: optional_password # Optional encryption
|
274
|
+
```
|
275
|
+
2. Using URI parameters:
|
276
|
+
```yaml
|
277
|
+
type: sqlite
|
278
|
+
path: /path/to/db.sqlite?mode=ro&cache=shared
|
279
|
+
```
|
194
280
|
|
195
281
|
### Debug Mode
|
196
282
|
Set environment variable `MCP_DEBUG=1` to enable debug mode for detailed logging output.
|
@@ -207,12 +293,15 @@ graph TD
|
|
207
293
|
DatabaseHandler[Database Handler]
|
208
294
|
PostgresHandler[PostgreSQL Handler]
|
209
295
|
SQLiteHandler[SQLite Handler]
|
296
|
+
MySQLHandler[MySQL Handler]
|
210
297
|
DatabaseServer --> DatabaseHandler
|
211
298
|
DatabaseHandler --> PostgresHandler
|
212
299
|
DatabaseHandler --> SQLiteHandler
|
300
|
+
DatabaseHandler --> MySQLHandler
|
213
301
|
end
|
214
302
|
PostgresHandler --> PostgreSQL[(PostgreSQL)]
|
215
303
|
SQLiteHandler --> SQLite[(SQLite)]
|
304
|
+
MySQLHandler --> MySQL[(MySQL)]
|
216
305
|
```
|
217
306
|
|
218
307
|
The abstraction layer design is the core architectural concept in MCP Database Utilities. Just like a universal remote control that works with different devices, users only need to know the basic operations without understanding the underlying complexities.
|
@@ -224,7 +313,7 @@ The abstraction layer design is the core architectural concept in MCP Database U
|
|
224
313
|
|
225
314
|
#### 2. Unified Interface Design
|
226
315
|
- DatabaseHandler abstract class defines unified operation interfaces
|
227
|
-
- All specific database implementations (PostgreSQL/SQLite) follow the same interface
|
316
|
+
- All specific database implementations (PostgreSQL/SQLite/MySQL) follow the same interface
|
228
317
|
- Users interact with different databases in the same way
|
229
318
|
|
230
319
|
#### 3. Configuration and Implementation Separation
|
@@ -241,7 +330,7 @@ The abstraction layer design is the core architectural concept in MCP Database U
|
|
241
330
|
2. DatabaseHandler
|
242
331
|
- Abstract base class defining unified interface
|
243
332
|
- Includes get_tables(), get_schema(), execute_query(), etc.
|
244
|
-
- Implemented by PostgreSQL and
|
333
|
+
- Implemented by PostgreSQL, SQLite, and MySQL handlers
|
245
334
|
|
246
335
|
3. Configuration System
|
247
336
|
- YAML-based configuration file
|
@@ -364,6 +453,13 @@ Provides SQLite-specific features:
|
|
364
453
|
- URI scheme support
|
365
454
|
- Password protection support (optional)
|
366
455
|
|
456
|
+
### MySQL Implementation
|
457
|
+
Provides MySQL-specific features:
|
458
|
+
- Remote connection support
|
459
|
+
- Character set configuration
|
460
|
+
- SSL/TLS secure connection
|
461
|
+
- URL and standard connection methods
|
462
|
+
|
367
463
|
## Contributing
|
368
464
|
Contributions are welcome! Here's how you can help:
|
369
465
|
|
@@ -383,7 +479,6 @@ For detailed guidelines, see [CONTRIBUTING.md](.github/CONTRIBUTING.md)
|
|
383
479
|
- [MCP Servers](https://github.com/modelcontextprotocol/servers) for inspiration and demonstration
|
384
480
|
- AI Editors:
|
385
481
|
* [Claude Desktop](https://claude.ai/download)
|
386
|
-
* [5ire](https://5ire.app/)
|
387
482
|
* [Cline](https://cline.bot)
|
388
483
|
- [Model Context Protocol](https://modelcontextprotocol.io/) for comprehensive interfaces
|
389
484
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
[中文文档](README_CN.md)
|
11
11
|
|
12
12
|
## Overview
|
13
|
-
MCP Database Utilities is a unified database access service that supports multiple database types (PostgreSQL and
|
13
|
+
MCP Database Utilities is a unified database access service that supports multiple database types (PostgreSQL, SQLite, and MySQL). Through its abstraction layer design, it provides a simple and unified database operation interface for MCP servers.
|
14
14
|
|
15
15
|
## Features
|
16
16
|
- Unified database access interface
|
@@ -20,6 +20,7 @@ MCP Database Utilities is a unified database access service that supports multip
|
|
20
20
|
- Database tables listing via MCP tools
|
21
21
|
- Intelligent connection management and resource cleanup
|
22
22
|
- Debug mode support
|
23
|
+
- SSL/TLS connection support for PostgreSQL and MySQL
|
23
24
|
|
24
25
|
## Installation and Configuration
|
25
26
|
|
@@ -121,54 +122,138 @@ Add to Claude configuration:
|
|
121
122
|
- Python 3.10+
|
122
123
|
- PostgreSQL (optional)
|
123
124
|
- SQLite3 (optional)
|
125
|
+
- MySQL (optional)
|
124
126
|
|
125
127
|
### Configuration File
|
126
|
-
The project requires a YAML configuration file, specified via the `--config` parameter. Configuration
|
128
|
+
The project requires a YAML configuration file, specified via the `--config` parameter. Configuration examples:
|
127
129
|
|
128
130
|
```yaml
|
129
131
|
connections:
|
130
|
-
#
|
131
|
-
|
132
|
+
# SQLite configuration examples
|
133
|
+
dev-db:
|
134
|
+
type: sqlite
|
135
|
+
path: /path/to/dev.db
|
136
|
+
# Password is optional
|
137
|
+
password:
|
138
|
+
|
139
|
+
# PostgreSQL standard configuration
|
140
|
+
test-db:
|
132
141
|
type: postgres
|
133
|
-
|
134
|
-
user: postgres
|
135
|
-
password: secret
|
136
|
-
host: host.docker.internal # For Mac/Windows
|
137
|
-
# host: 172.17.0.1 # For Linux (docker0 IP)
|
142
|
+
host: postgres.example.com
|
138
143
|
port: 5432
|
144
|
+
dbname: test_db
|
145
|
+
user: test_user
|
146
|
+
password: test_pass
|
139
147
|
|
140
|
-
# PostgreSQL
|
141
|
-
|
148
|
+
# PostgreSQL URL configuration with SSL
|
149
|
+
prod-db:
|
142
150
|
type: postgres
|
143
|
-
|
144
|
-
user:
|
145
|
-
password:
|
146
|
-
|
147
|
-
#
|
148
|
-
|
149
|
-
type:
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
151
|
+
url: postgresql://postgres.example.com:5432/prod-db?sslmode=verify-full
|
152
|
+
user: prod_user
|
153
|
+
password: prod_pass
|
154
|
+
|
155
|
+
# PostgreSQL full SSL configuration example
|
156
|
+
secure-db:
|
157
|
+
type: postgres
|
158
|
+
host: secure-db.example.com
|
159
|
+
port: 5432
|
160
|
+
dbname: secure_db
|
161
|
+
user: secure_user
|
162
|
+
password: secure_pass
|
163
|
+
ssl:
|
164
|
+
mode: verify-full # disable/require/verify-ca/verify-full
|
165
|
+
cert: /path/to/client-cert.pem
|
166
|
+
key: /path/to/client-key.pem
|
167
|
+
root: /path/to/root.crt
|
168
|
+
|
169
|
+
# MySQL standard configuration
|
170
|
+
sandbox-mysql:
|
171
|
+
type: mysql
|
172
|
+
host: localhost
|
173
|
+
port: 3306
|
174
|
+
database: sandbox_db
|
175
|
+
user: sandbox_user
|
176
|
+
password: sandbox_pass
|
177
|
+
charset: utf8mb4
|
178
|
+
|
179
|
+
# MySQL URL configuration
|
180
|
+
integration-mysql:
|
181
|
+
type: mysql
|
182
|
+
url: mysql://mysql.example.com:3306/integration_db?charset=utf8mb4
|
183
|
+
user: integration_user
|
184
|
+
password: integration_pass
|
185
|
+
|
186
|
+
# MySQL with SSL configuration
|
187
|
+
secure-mysql:
|
188
|
+
type: mysql
|
189
|
+
host: secure-mysql.example.com
|
190
|
+
port: 3306
|
191
|
+
database: secure_db
|
192
|
+
user: secure_user
|
193
|
+
password: secure_pass
|
194
|
+
charset: utf8mb4
|
195
|
+
ssl:
|
196
|
+
mode: verify_identity
|
197
|
+
ca: /path/to/ca.pem
|
198
|
+
cert: /path/to/client-cert.pem
|
199
|
+
key: /path/to/client-key.pem
|
158
200
|
```
|
159
201
|
|
160
|
-
|
161
|
-
|
162
|
-
PostgreSQL:
|
163
|
-
1.
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
202
|
+
Database SSL Configuration Options:
|
203
|
+
|
204
|
+
PostgreSQL SSL Configuration:
|
205
|
+
1. Using URL parameters:
|
206
|
+
```
|
207
|
+
postgresql://host:port/dbname?sslmode=verify-full&sslcert=/path/to/cert.pem
|
208
|
+
```
|
209
|
+
2. Using dedicated SSL configuration section:
|
210
|
+
```yaml
|
211
|
+
ssl:
|
212
|
+
mode: verify-full # SSL verification mode
|
213
|
+
cert: /path/to/cert.pem # Client certificate
|
214
|
+
key: /path/to/key.pem # Client private key
|
215
|
+
root: /path/to/root.crt # CA certificate
|
216
|
+
```
|
217
|
+
|
218
|
+
PostgreSQL SSL Modes:
|
219
|
+
- disable: No SSL
|
220
|
+
- require: Use SSL but no certificate verification
|
221
|
+
- verify-ca: Verify server certificate is signed by trusted CA
|
222
|
+
- verify-full: Verify server certificate and hostname match
|
223
|
+
|
224
|
+
MySQL SSL Configuration:
|
225
|
+
1. Using URL parameters:
|
226
|
+
```
|
227
|
+
mysql://host:port/dbname?ssl-mode=verify_identity&ssl-ca=/path/to/ca.pem
|
228
|
+
```
|
229
|
+
2. Using dedicated SSL configuration section:
|
230
|
+
```yaml
|
231
|
+
ssl:
|
232
|
+
mode: verify_identity # SSL verification mode
|
233
|
+
ca: /path/to/ca.pem # CA certificate
|
234
|
+
cert: /path/to/cert.pem # Client certificate
|
235
|
+
key: /path/to/key.pem # Client private key
|
236
|
+
```
|
237
|
+
|
238
|
+
MySQL SSL Modes:
|
239
|
+
- disabled: No SSL
|
240
|
+
- preferred: Use SSL if available, but allow unencrypted connection
|
241
|
+
- required: Always use SSL, but don't verify server certificate
|
242
|
+
- verify_ca: Verify server certificate is signed by trusted CA
|
243
|
+
- verify_identity: Verify server certificate and hostname match
|
244
|
+
|
245
|
+
SQLite Configuration Options:
|
246
|
+
1. Basic configuration with path:
|
247
|
+
```yaml
|
248
|
+
type: sqlite
|
249
|
+
path: /path/to/db.sqlite
|
250
|
+
password: optional_password # Optional encryption
|
251
|
+
```
|
252
|
+
2. Using URI parameters:
|
253
|
+
```yaml
|
254
|
+
type: sqlite
|
255
|
+
path: /path/to/db.sqlite?mode=ro&cache=shared
|
256
|
+
```
|
172
257
|
|
173
258
|
### Debug Mode
|
174
259
|
Set environment variable `MCP_DEBUG=1` to enable debug mode for detailed logging output.
|
@@ -185,12 +270,15 @@ graph TD
|
|
185
270
|
DatabaseHandler[Database Handler]
|
186
271
|
PostgresHandler[PostgreSQL Handler]
|
187
272
|
SQLiteHandler[SQLite Handler]
|
273
|
+
MySQLHandler[MySQL Handler]
|
188
274
|
DatabaseServer --> DatabaseHandler
|
189
275
|
DatabaseHandler --> PostgresHandler
|
190
276
|
DatabaseHandler --> SQLiteHandler
|
277
|
+
DatabaseHandler --> MySQLHandler
|
191
278
|
end
|
192
279
|
PostgresHandler --> PostgreSQL[(PostgreSQL)]
|
193
280
|
SQLiteHandler --> SQLite[(SQLite)]
|
281
|
+
MySQLHandler --> MySQL[(MySQL)]
|
194
282
|
```
|
195
283
|
|
196
284
|
The abstraction layer design is the core architectural concept in MCP Database Utilities. Just like a universal remote control that works with different devices, users only need to know the basic operations without understanding the underlying complexities.
|
@@ -202,7 +290,7 @@ The abstraction layer design is the core architectural concept in MCP Database U
|
|
202
290
|
|
203
291
|
#### 2. Unified Interface Design
|
204
292
|
- DatabaseHandler abstract class defines unified operation interfaces
|
205
|
-
- All specific database implementations (PostgreSQL/SQLite) follow the same interface
|
293
|
+
- All specific database implementations (PostgreSQL/SQLite/MySQL) follow the same interface
|
206
294
|
- Users interact with different databases in the same way
|
207
295
|
|
208
296
|
#### 3. Configuration and Implementation Separation
|
@@ -219,7 +307,7 @@ The abstraction layer design is the core architectural concept in MCP Database U
|
|
219
307
|
2. DatabaseHandler
|
220
308
|
- Abstract base class defining unified interface
|
221
309
|
- Includes get_tables(), get_schema(), execute_query(), etc.
|
222
|
-
- Implemented by PostgreSQL and
|
310
|
+
- Implemented by PostgreSQL, SQLite, and MySQL handlers
|
223
311
|
|
224
312
|
3. Configuration System
|
225
313
|
- YAML-based configuration file
|
@@ -342,6 +430,13 @@ Provides SQLite-specific features:
|
|
342
430
|
- URI scheme support
|
343
431
|
- Password protection support (optional)
|
344
432
|
|
433
|
+
### MySQL Implementation
|
434
|
+
Provides MySQL-specific features:
|
435
|
+
- Remote connection support
|
436
|
+
- Character set configuration
|
437
|
+
- SSL/TLS secure connection
|
438
|
+
- URL and standard connection methods
|
439
|
+
|
345
440
|
## Contributing
|
346
441
|
Contributions are welcome! Here's how you can help:
|
347
442
|
|
@@ -361,7 +456,6 @@ For detailed guidelines, see [CONTRIBUTING.md](.github/CONTRIBUTING.md)
|
|
361
456
|
- [MCP Servers](https://github.com/modelcontextprotocol/servers) for inspiration and demonstration
|
362
457
|
- AI Editors:
|
363
458
|
* [Claude Desktop](https://claude.ai/download)
|
364
|
-
* [5ire](https://5ire.app/)
|
365
459
|
* [Cline](https://cline.bot)
|
366
460
|
- [Model Context Protocol](https://modelcontextprotocol.io/) for comprehensive interfaces
|
367
461
|
|