mcp-dbutils 0.11.0__tar.gz → 0.12.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.11.0/.github/workflows/test.yml → mcp_dbutils-0.12.0/.github/workflows/quality-assurance.yml +27 -2
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/CHANGELOG.md +7 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/PKG-INFO +4 -4
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/README.md +3 -3
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/README_CN.md +3 -3
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/pyproject.toml +1 -1
- mcp_dbutils-0.12.0/sonar-project.properties +6 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/__init__.py +3 -3
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/base.py +6 -3
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/mysql/server.py +2 -2
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/postgres/server.py +3 -2
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/sqlite/server.py +2 -2
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/.coveragerc +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/.github/workflows/release.yml +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/.gitignore +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/.releaserc.json +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/Dockerfile +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/LICENSE +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/config.yaml.example +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/smithery.yaml +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/config.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/log.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/mysql/__init__.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/mysql/config.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/mysql/handler.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/postgres/__init__.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/postgres/config.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/postgres/handler.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/sqlite/__init__.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/sqlite/config.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/sqlite/handler.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/src/mcp_dbutils/stats.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/conftest.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/__init__.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/conftest.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/fixtures.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_logging.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_monitoring.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_monitoring_enhanced.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_mysql.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_mysql_config.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_postgres.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_postgres_config.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_prompts.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_sqlite.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_sqlite_config.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_tools.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/integration/test_tools_advanced.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/unit/test_log.py +0 -0
- {mcp_dbutils-0.11.0 → mcp_dbutils-0.12.0}/tests/unit/test_stats.py +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
name:
|
1
|
+
name: Quality Assurance
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
@@ -7,7 +7,7 @@ on:
|
|
7
7
|
branches: [ main ]
|
8
8
|
|
9
9
|
jobs:
|
10
|
-
|
10
|
+
pytest:
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
|
13
13
|
services:
|
@@ -49,8 +49,15 @@ jobs:
|
|
49
49
|
--cov-report=html \
|
50
50
|
--cov-report=term-missing \
|
51
51
|
--cov-report=json:coverage.json \
|
52
|
+
--cov-report=xml:coverage.xml \
|
52
53
|
tests/
|
53
54
|
|
55
|
+
- name: Upload coverage report
|
56
|
+
uses: actions/upload-artifact@v4
|
57
|
+
with:
|
58
|
+
name: coverage-report
|
59
|
+
path: coverage.xml
|
60
|
+
|
54
61
|
- name: Calculate coverage percentage
|
55
62
|
id: calc_coverage
|
56
63
|
run: |
|
@@ -75,3 +82,21 @@ jobs:
|
|
75
82
|
message: "${{ steps.calc_coverage.outputs.percentage }}%"
|
76
83
|
color: "${{ steps.calc_coverage.outputs.color }}"
|
77
84
|
namedLogo: python
|
85
|
+
|
86
|
+
sonarcloud:
|
87
|
+
name: SonarCloud
|
88
|
+
needs: pytest
|
89
|
+
runs-on: ubuntu-latest
|
90
|
+
steps:
|
91
|
+
- uses: actions/checkout@v4
|
92
|
+
with:
|
93
|
+
fetch-depth: 0
|
94
|
+
- name: Download coverage report
|
95
|
+
uses: actions/download-artifact@v4
|
96
|
+
with:
|
97
|
+
name: coverage-report
|
98
|
+
- name: SonarCloud Scan
|
99
|
+
uses: SonarSource/sonarqube-scan-action@v5.0.0
|
100
|
+
env:
|
101
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
102
|
+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
@@ -1,3 +1,10 @@
|
|
1
|
+
# [0.12.0](https://github.com/donghao1393/mcp-dbutils/compare/v0.11.0...v0.12.0) (2025-03-14)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* integrate SonarCloud analysis ([#29](https://github.com/donghao1393/mcp-dbutils/issues/29)) ([67649c5](https://github.com/donghao1393/mcp-dbutils/commit/67649c55cc317c2ee20c69777d1629895863dd86)), closes [#28](https://github.com/donghao1393/mcp-dbutils/issues/28)
|
7
|
+
|
1
8
|
# [0.11.0](https://github.com/donghao1393/mcp-dbutils/compare/v0.10.3...v0.11.0) (2025-03-13)
|
2
9
|
|
3
10
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-dbutils
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.12.0
|
4
4
|
Summary: MCP Database Utilities Service
|
5
5
|
Author: Dong Hao
|
6
6
|
License-Expression: MIT
|
@@ -65,7 +65,7 @@ uvx mcp-dbutils --config /path/to/config.yaml
|
|
65
65
|
Add to Claude configuration:
|
66
66
|
```json
|
67
67
|
"mcpServers": {
|
68
|
-
"
|
68
|
+
"dbutils": {
|
69
69
|
"command": "uvx",
|
70
70
|
"args": [
|
71
71
|
"mcp-dbutils",
|
@@ -87,7 +87,7 @@ pip install mcp-dbutils
|
|
87
87
|
Add to Claude configuration:
|
88
88
|
```json
|
89
89
|
"mcpServers": {
|
90
|
-
"
|
90
|
+
"dbutils": {
|
91
91
|
"command": "python",
|
92
92
|
"args": [
|
93
93
|
"-m",
|
@@ -114,7 +114,7 @@ docker run -i --rm \
|
|
114
114
|
Add to Claude configuration:
|
115
115
|
```json
|
116
116
|
"mcpServers": {
|
117
|
-
"
|
117
|
+
"dbutils": {
|
118
118
|
"command": "docker",
|
119
119
|
"args": [
|
120
120
|
"run",
|
@@ -42,7 +42,7 @@ uvx mcp-dbutils --config /path/to/config.yaml
|
|
42
42
|
Add to Claude configuration:
|
43
43
|
```json
|
44
44
|
"mcpServers": {
|
45
|
-
"
|
45
|
+
"dbutils": {
|
46
46
|
"command": "uvx",
|
47
47
|
"args": [
|
48
48
|
"mcp-dbutils",
|
@@ -64,7 +64,7 @@ pip install mcp-dbutils
|
|
64
64
|
Add to Claude configuration:
|
65
65
|
```json
|
66
66
|
"mcpServers": {
|
67
|
-
"
|
67
|
+
"dbutils": {
|
68
68
|
"command": "python",
|
69
69
|
"args": [
|
70
70
|
"-m",
|
@@ -91,7 +91,7 @@ docker run -i --rm \
|
|
91
91
|
Add to Claude configuration:
|
92
92
|
```json
|
93
93
|
"mcpServers": {
|
94
|
-
"
|
94
|
+
"dbutils": {
|
95
95
|
"command": "docker",
|
96
96
|
"args": [
|
97
97
|
"run",
|
@@ -26,7 +26,7 @@ uvx mcp-dbutils --config /path/to/config.yaml
|
|
26
26
|
添加到 Claude 配置:
|
27
27
|
```json
|
28
28
|
"mcpServers": {
|
29
|
-
"
|
29
|
+
"dbutils": {
|
30
30
|
"command": "uvx",
|
31
31
|
"args": [
|
32
32
|
"mcp-dbutils",
|
@@ -48,7 +48,7 @@ pip install mcp-dbutils
|
|
48
48
|
添加到 Claude 配置:
|
49
49
|
```json
|
50
50
|
"mcpServers": {
|
51
|
-
"
|
51
|
+
"dbutils": {
|
52
52
|
"command": "python",
|
53
53
|
"args": [
|
54
54
|
"-m",
|
@@ -75,7 +75,7 @@ docker run -i --rm \
|
|
75
75
|
添加到 Claude 配置:
|
76
76
|
```json
|
77
77
|
"mcpServers": {
|
78
|
-
"
|
78
|
+
"dbutils": {
|
79
79
|
"command": "docker",
|
80
80
|
"args": [
|
81
81
|
"run",
|
@@ -9,13 +9,13 @@ import yaml
|
|
9
9
|
from importlib.metadata import metadata
|
10
10
|
|
11
11
|
from .log import create_logger
|
12
|
-
from .base import ConnectionServer
|
12
|
+
from .base import ConnectionServer, LOG_NAME
|
13
13
|
|
14
14
|
# 获取包信息
|
15
15
|
pkg_meta = metadata("mcp-dbutils")
|
16
16
|
|
17
17
|
# 创建全局logger
|
18
|
-
log = create_logger(
|
18
|
+
log = create_logger(LOG_NAME)
|
19
19
|
|
20
20
|
async def run_server():
|
21
21
|
"""服务器运行逻辑"""
|
@@ -30,7 +30,7 @@ async def run_server():
|
|
30
30
|
|
31
31
|
# 更新logger的debug状态
|
32
32
|
global log
|
33
|
-
log = create_logger(
|
33
|
+
log = create_logger(LOG_NAME, debug)
|
34
34
|
|
35
35
|
log("info", f"MCP Connection Utilities Service v{pkg_meta['Version']}")
|
36
36
|
if debug:
|
@@ -31,6 +31,9 @@ from .stats import ResourceStats
|
|
31
31
|
# 获取包信息用于日志命名
|
32
32
|
pkg_meta = metadata("mcp-dbutils")
|
33
33
|
|
34
|
+
# 日志名称常量
|
35
|
+
LOG_NAME = "dbutils"
|
36
|
+
|
34
37
|
# MCP日志级别常量
|
35
38
|
LOG_LEVEL_DEBUG = "debug" # 0
|
36
39
|
LOG_LEVEL_INFO = "info" # 1
|
@@ -56,7 +59,7 @@ class ConnectionHandler(ABC):
|
|
56
59
|
self.connection = connection
|
57
60
|
self.debug = debug
|
58
61
|
# 创建stderr日志记录器用于本地调试
|
59
|
-
self.log = create_logger(f"{
|
62
|
+
self.log = create_logger(f"{LOG_NAME}.handler.{connection}", debug)
|
60
63
|
self.stats = ResourceStats()
|
61
64
|
self._session = None
|
62
65
|
|
@@ -246,9 +249,9 @@ class ConnectionServer:
|
|
246
249
|
self.debug = debug
|
247
250
|
# 获取包信息用于服务器配置
|
248
251
|
pkg_meta = metadata("mcp-dbutils")
|
249
|
-
self.logger = create_logger(f"{
|
252
|
+
self.logger = create_logger(f"{LOG_NAME}.server", debug)
|
250
253
|
self.server = Server(
|
251
|
-
name=
|
254
|
+
name=LOG_NAME,
|
252
255
|
version=pkg_meta["Version"]
|
253
256
|
)
|
254
257
|
self._session = None
|
@@ -9,7 +9,7 @@ from ..log import create_logger
|
|
9
9
|
from .config import MySQLConfig
|
10
10
|
|
11
11
|
# 获取包信息用于日志命名
|
12
|
-
|
12
|
+
from ..base import LOG_NAME
|
13
13
|
|
14
14
|
class MySQLServer(ConnectionServer):
|
15
15
|
def __init__(self, config: MySQLConfig, config_path: Optional[str] = None):
|
@@ -21,7 +21,7 @@ class MySQLServer(ConnectionServer):
|
|
21
21
|
super().__init__(config_path, config.debug)
|
22
22
|
self.config = config
|
23
23
|
self.config_path = config_path
|
24
|
-
self.log = create_logger(f"{
|
24
|
+
self.log = create_logger(f"{LOG_NAME}.db.mysql", config.debug)
|
25
25
|
# 创建连接池
|
26
26
|
try:
|
27
27
|
conn_params = config.get_connection_params()
|
@@ -9,7 +9,8 @@ from ..log import create_logger
|
|
9
9
|
from .config import PostgreSQLConfig
|
10
10
|
|
11
11
|
# 获取包信息用于日志命名
|
12
|
-
|
12
|
+
from ..base import LOG_NAME
|
13
|
+
|
13
14
|
class PostgreSQLServer(ConnectionServer):
|
14
15
|
def __init__(self, config: PostgreSQLConfig, config_path: Optional[str] = None):
|
15
16
|
"""初始化PostgreSQL服务器
|
@@ -20,7 +21,7 @@ class PostgreSQLServer(ConnectionServer):
|
|
20
21
|
super().__init__(config_path, config.debug)
|
21
22
|
self.config = config
|
22
23
|
self.config_path = config_path
|
23
|
-
self.log = create_logger(f"{
|
24
|
+
self.log = create_logger(f"{LOG_NAME}.db.postgres", config.debug)
|
24
25
|
# 创建连接池
|
25
26
|
try:
|
26
27
|
conn_params = config.get_connection_params()
|
@@ -12,7 +12,7 @@ from ..log import create_logger
|
|
12
12
|
from .config import SQLiteConfig
|
13
13
|
|
14
14
|
# 获取包信息用于日志命名
|
15
|
-
|
15
|
+
from ..base import LOG_NAME
|
16
16
|
|
17
17
|
class SQLiteServer(ConnectionServer):
|
18
18
|
def __init__(self, config: SQLiteConfig, config_path: Optional[str] = None):
|
@@ -24,7 +24,7 @@ class SQLiteServer(ConnectionServer):
|
|
24
24
|
super().__init__(config_path, config.debug)
|
25
25
|
self.config = config
|
26
26
|
self.config_path = config_path
|
27
|
-
self.log = create_logger(f"{
|
27
|
+
self.log = create_logger(f"{LOG_NAME}.db.sqlite", config.debug)
|
28
28
|
|
29
29
|
# 确保数据库目录存在
|
30
30
|
db_file = Path(self.config.absolute_path)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|