mcp-dbutils 0.8.0__tar.gz → 0.10.0__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.8.0 → mcp_dbutils-0.10.0}/CHANGELOG.md +105 -1
- mcp_dbutils-0.10.0/PKG-INFO +227 -0
- mcp_dbutils-0.10.0/README.md +205 -0
- mcp_dbutils-0.10.0/README_CN.md +189 -0
- mcp_dbutils-0.10.0/config.yaml.example +44 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/pyproject.toml +1 -1
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/src/mcp_dbutils/__init__.py +9 -9
- mcp_dbutils-0.10.0/src/mcp_dbutils/base.py +610 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/src/mcp_dbutils/config.py +12 -12
- mcp_dbutils-0.10.0/src/mcp_dbutils/postgres/__init__.py +6 -0
- mcp_dbutils-0.10.0/src/mcp_dbutils/postgres/config.py +211 -0
- mcp_dbutils-0.10.0/src/mcp_dbutils/postgres/handler.py +587 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/src/mcp_dbutils/postgres/server.py +16 -16
- mcp_dbutils-0.10.0/src/mcp_dbutils/sqlite/__init__.py +6 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/src/mcp_dbutils/sqlite/config.py +12 -12
- mcp_dbutils-0.10.0/src/mcp_dbutils/sqlite/handler.py +417 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/src/mcp_dbutils/sqlite/server.py +21 -21
- mcp_dbutils-0.10.0/src/mcp_dbutils/stats.py +194 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/tests/conftest.py +2 -2
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/tests/integration/test_monitoring.py +7 -7
- mcp_dbutils-0.10.0/tests/integration/test_monitoring_enhanced.py +140 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/tests/integration/test_postgres.py +8 -8
- mcp_dbutils-0.10.0/tests/integration/test_postgres_config.py +229 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/tests/integration/test_prompts.py +3 -3
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/tests/integration/test_sqlite.py +8 -8
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/tests/integration/test_sqlite_config.py +14 -14
- mcp_dbutils-0.10.0/tests/integration/test_tools.py +273 -0
- mcp_dbutils-0.10.0/tests/integration/test_tools_advanced.py +197 -0
- mcp_dbutils-0.8.0/PKG-INFO +0 -358
- mcp_dbutils-0.8.0/README.md +0 -336
- mcp_dbutils-0.8.0/README_CN.md +0 -316
- mcp_dbutils-0.8.0/config.yaml.example +0 -40
- mcp_dbutils-0.8.0/src/mcp_dbutils/base.py +0 -285
- mcp_dbutils-0.8.0/src/mcp_dbutils/postgres/__init__.py +0 -6
- mcp_dbutils-0.8.0/src/mcp_dbutils/postgres/config.py +0 -150
- mcp_dbutils-0.8.0/src/mcp_dbutils/postgres/handler.py +0 -155
- mcp_dbutils-0.8.0/src/mcp_dbutils/sqlite/__init__.py +0 -6
- mcp_dbutils-0.8.0/src/mcp_dbutils/sqlite/handler.py +0 -133
- mcp_dbutils-0.8.0/src/mcp_dbutils/stats.py +0 -85
- mcp_dbutils-0.8.0/tests/integration/test_postgres_config.py +0 -129
- mcp_dbutils-0.8.0/tests/integration/test_tools.py +0 -85
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/.coveragerc +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/.github/workflows/release.yml +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/.github/workflows/test.yml +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/.gitignore +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/Dockerfile +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/LICENSE +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/smithery.yaml +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/src/mcp_dbutils/log.py +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.10.0}/tests/unit/test_stats.py +0 -0
@@ -1,12 +1,116 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
3
|
|
4
|
+
## v0.10.0 (2025-03-12)
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
- Enhance database configuration with SSL support
|
9
|
+
([#22](https://github.com/donghao1393/mcp-dbutils/pull/22),
|
10
|
+
[`4ea4d0b`](https://github.com/donghao1393/mcp-dbutils/commit/4ea4d0b5deb51b8e9202839bd7a8cd5f71463c88))
|
11
|
+
|
12
|
+
* feat: enhance database configuration with SSL support
|
13
|
+
|
14
|
+
- Replace jdbc_url with url for better clarity - Add dedicated SSL configuration support - Update
|
15
|
+
documentation and examples - Update test cases
|
16
|
+
|
17
|
+
BREAKING CHANGE: Remove jdbc_url support as it was just added and not yet in production use
|
18
|
+
|
19
|
+
* docs: update documentation for SSL support and URL configuration
|
20
|
+
|
21
|
+
- Add SSL configuration examples - Update configuration format examples - Add configuration
|
22
|
+
documentation in both English and Chinese - Remove JDBC related content
|
23
|
+
|
24
|
+
### Breaking Changes
|
25
|
+
|
26
|
+
- Remove jdbc_url support as it was just added and not yet in production use
|
27
|
+
|
28
|
+
|
29
|
+
## v0.9.0 (2025-03-09)
|
30
|
+
|
31
|
+
### Documentation
|
32
|
+
|
33
|
+
- Update README files to include new tools
|
34
|
+
([`eb796d5`](https://github.com/donghao1393/mcp-dbutils/commit/eb796d54ca517c173e26b8a535bfeb00545fbab0))
|
35
|
+
|
36
|
+
Added documentation for new tools: - dbutils-get-stats - dbutils-list-constraints -
|
37
|
+
dbutils-explain-query
|
38
|
+
|
39
|
+
Both English and Chinese READMEs updated
|
40
|
+
|
41
|
+
- Update README files with new monitoring tools
|
42
|
+
([#18](https://github.com/donghao1393/mcp-dbutils/pull/18),
|
43
|
+
[`4b919fe`](https://github.com/donghao1393/mcp-dbutils/commit/4b919fe348e2f6ed35ea1f16b64a2706a5d875f4))
|
44
|
+
|
45
|
+
- Add dbutils-get-performance tool documentation - Add dbutils-analyze-query tool documentation -
|
46
|
+
Update both English and Chinese READMEs
|
47
|
+
|
48
|
+
- Update tool names with dbutils prefix
|
49
|
+
([`4731021`](https://github.com/donghao1393/mcp-dbutils/commit/4731021ab981ecca305414f34f72c1f8f0577b8e))
|
50
|
+
|
51
|
+
Renamed basic tools in README files: - list_tables -> dbutils-list-tables - query -> dbutils-query
|
52
|
+
|
53
|
+
Both English and Chinese READMEs updated
|
54
|
+
|
55
|
+
### Features
|
56
|
+
|
57
|
+
- Add advanced database tools ([#15](https://github.com/donghao1393/mcp-dbutils/pull/15),
|
58
|
+
[`2c85dc8`](https://github.com/donghao1393/mcp-dbutils/commit/2c85dc8c026bca93571ab8ed5b837518553087d5))
|
59
|
+
|
60
|
+
* Added three new tools:
|
61
|
+
|
62
|
+
1. dbutils-get-stats - Table statistics information - Column level statistics - Adapted for
|
63
|
+
PostgreSQL and SQLite
|
64
|
+
|
65
|
+
2. dbutils-list-constraints - Primary key, foreign key, unique constraints - Constraint definitions
|
66
|
+
and properties - Constraint comments support
|
67
|
+
|
68
|
+
3. dbutils-explain-query - EXPLAIN and EXPLAIN ANALYZE support - Detailed cost and timing estimates
|
69
|
+
- Database-specific optimizations
|
70
|
+
|
71
|
+
Implementation: - Added abstract methods to DatabaseHandler - Implemented in PostgreSQL and SQLite -
|
72
|
+
Added dedicated integration tests - Fixed SQL syntax and parameter issues
|
73
|
+
|
74
|
+
Refs #14
|
75
|
+
|
76
|
+
* fix: check non-SELECT statements in SQLite handler
|
77
|
+
|
78
|
+
- Add more database tools ([#13](https://github.com/donghao1393/mcp-dbutils/pull/13),
|
79
|
+
[`8b8bd1e`](https://github.com/donghao1393/mcp-dbutils/commit/8b8bd1ea04d63e7828c81dc25a9c0cb70df73867))
|
80
|
+
|
81
|
+
* 添加更多数据库工具
|
82
|
+
|
83
|
+
添加三个新的数据库工具: - dbutils-describe-table:获取表的详细信息 - dbutils-get-ddl:获取表的DDL语句 -
|
84
|
+
dbutils-list-indexes:获取表的索引信息
|
85
|
+
|
86
|
+
实现内容: - DatabaseHandler新增三个抽象方法 - PostgreSQL和SQLite分别实现这些方法 - 添加新工具的集成测试 - 所有测试通过
|
87
|
+
|
88
|
+
Fixes #12
|
89
|
+
|
90
|
+
* test: 拆分表信息工具测试
|
91
|
+
|
92
|
+
将test_table_info_tools拆分为三个独立的测试函数: - test_describe_table_tool - test_get_ddl_tool -
|
93
|
+
test_list_indexes_tool
|
94
|
+
|
95
|
+
这样可以更清晰地展示每个工具的测试状态,便于定位问题。
|
96
|
+
|
97
|
+
- Enhance monitoring system with LLM dialog support
|
98
|
+
([#17](https://github.com/donghao1393/mcp-dbutils/pull/17),
|
99
|
+
[`50d8df1`](https://github.com/donghao1393/mcp-dbutils/commit/50d8df1fabbf6513718582e6efe0d3832de9ce5d))
|
100
|
+
|
101
|
+
- Add query duration tracking - Add query type statistics - Add slow query detection - Add memory
|
102
|
+
usage tracking - Add performance statistics formatting - Add new MCP tools:
|
103
|
+
dbutils-get-performance and dbutils-analyze-query - Add tests for new features
|
104
|
+
|
105
|
+
Closes #16
|
106
|
+
|
107
|
+
|
4
108
|
## v0.8.0 (2025-03-09)
|
5
109
|
|
6
110
|
### Features
|
7
111
|
|
8
112
|
- Unify tool names with dbutils prefix ([#11](https://github.com/donghao1393/mcp-dbutils/pull/11),
|
9
|
-
[`
|
113
|
+
[`aa57995`](https://github.com/donghao1393/mcp-dbutils/commit/aa57995dc6cf3ffd33909162d831dffbbbf19bfc))
|
10
114
|
|
11
115
|
给工具名称添加dbutils前缀,使所有工具名称规范统一: - query -> dbutils-run-query - list_tables -> dbutils-list-tables
|
12
116
|
|
@@ -0,0 +1,227 @@
|
|
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...]
|
@@ -0,0 +1,205 @@
|
|
1
|
+
# MCP Database Utilities
|
2
|
+
|
3
|
+

|
4
|
+

|
5
|
+
[](https://github.com/donghao1393/mcp-dbutils/actions)
|
6
|
+

|
7
|
+

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