mcp-dbutils 0.8.0__tar.gz → 0.9.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.9.0}/CHANGELOG.md +80 -1
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/PKG-INFO +42 -8
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/README.md +41 -7
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/README_CN.md +41 -7
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/config.yaml.example +1 -1
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/pyproject.toml +1 -1
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/src/mcp_dbutils/__init__.py +9 -9
- mcp_dbutils-0.9.0/src/mcp_dbutils/base.py +610 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/src/mcp_dbutils/config.py +12 -12
- mcp_dbutils-0.9.0/src/mcp_dbutils/postgres/__init__.py +6 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/src/mcp_dbutils/postgres/config.py +16 -16
- mcp_dbutils-0.9.0/src/mcp_dbutils/postgres/handler.py +587 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/src/mcp_dbutils/postgres/server.py +16 -16
- mcp_dbutils-0.9.0/src/mcp_dbutils/sqlite/__init__.py +6 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/src/mcp_dbutils/sqlite/config.py +12 -12
- mcp_dbutils-0.9.0/src/mcp_dbutils/sqlite/handler.py +417 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/src/mcp_dbutils/sqlite/server.py +21 -21
- mcp_dbutils-0.9.0/src/mcp_dbutils/stats.py +194 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/tests/conftest.py +2 -2
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/tests/integration/test_monitoring.py +7 -7
- mcp_dbutils-0.9.0/tests/integration/test_monitoring_enhanced.py +140 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/tests/integration/test_postgres.py +8 -8
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/tests/integration/test_postgres_config.py +26 -26
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/tests/integration/test_prompts.py +3 -3
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/tests/integration/test_sqlite.py +8 -8
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/tests/integration/test_sqlite_config.py +14 -14
- mcp_dbutils-0.9.0/tests/integration/test_tools.py +273 -0
- mcp_dbutils-0.9.0/tests/integration/test_tools_advanced.py +197 -0
- 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/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_tools.py +0 -85
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/.coveragerc +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/.github/workflows/release.yml +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/.github/workflows/test.yml +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/.gitignore +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/Dockerfile +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/LICENSE +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/smithery.yaml +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/src/mcp_dbutils/log.py +0 -0
- {mcp_dbutils-0.8.0 → mcp_dbutils-0.9.0}/tests/unit/test_stats.py +0 -0
@@ -1,12 +1,91 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
3
|
|
4
|
+
## v0.9.0 (2025-03-09)
|
5
|
+
|
6
|
+
### Documentation
|
7
|
+
|
8
|
+
- Update README files to include new tools
|
9
|
+
([`eb796d5`](https://github.com/donghao1393/mcp-dbutils/commit/eb796d54ca517c173e26b8a535bfeb00545fbab0))
|
10
|
+
|
11
|
+
Added documentation for new tools: - dbutils-get-stats - dbutils-list-constraints -
|
12
|
+
dbutils-explain-query
|
13
|
+
|
14
|
+
Both English and Chinese READMEs updated
|
15
|
+
|
16
|
+
- Update README files with new monitoring tools
|
17
|
+
([#18](https://github.com/donghao1393/mcp-dbutils/pull/18),
|
18
|
+
[`4b919fe`](https://github.com/donghao1393/mcp-dbutils/commit/4b919fe348e2f6ed35ea1f16b64a2706a5d875f4))
|
19
|
+
|
20
|
+
- Add dbutils-get-performance tool documentation - Add dbutils-analyze-query tool documentation -
|
21
|
+
Update both English and Chinese READMEs
|
22
|
+
|
23
|
+
- Update tool names with dbutils prefix
|
24
|
+
([`4731021`](https://github.com/donghao1393/mcp-dbutils/commit/4731021ab981ecca305414f34f72c1f8f0577b8e))
|
25
|
+
|
26
|
+
Renamed basic tools in README files: - list_tables -> dbutils-list-tables - query -> dbutils-query
|
27
|
+
|
28
|
+
Both English and Chinese READMEs updated
|
29
|
+
|
30
|
+
### Features
|
31
|
+
|
32
|
+
- Add advanced database tools ([#15](https://github.com/donghao1393/mcp-dbutils/pull/15),
|
33
|
+
[`2c85dc8`](https://github.com/donghao1393/mcp-dbutils/commit/2c85dc8c026bca93571ab8ed5b837518553087d5))
|
34
|
+
|
35
|
+
* Added three new tools:
|
36
|
+
|
37
|
+
1. dbutils-get-stats - Table statistics information - Column level statistics - Adapted for
|
38
|
+
PostgreSQL and SQLite
|
39
|
+
|
40
|
+
2. dbutils-list-constraints - Primary key, foreign key, unique constraints - Constraint definitions
|
41
|
+
and properties - Constraint comments support
|
42
|
+
|
43
|
+
3. dbutils-explain-query - EXPLAIN and EXPLAIN ANALYZE support - Detailed cost and timing estimates
|
44
|
+
- Database-specific optimizations
|
45
|
+
|
46
|
+
Implementation: - Added abstract methods to DatabaseHandler - Implemented in PostgreSQL and SQLite -
|
47
|
+
Added dedicated integration tests - Fixed SQL syntax and parameter issues
|
48
|
+
|
49
|
+
Refs #14
|
50
|
+
|
51
|
+
* fix: check non-SELECT statements in SQLite handler
|
52
|
+
|
53
|
+
- Add more database tools ([#13](https://github.com/donghao1393/mcp-dbutils/pull/13),
|
54
|
+
[`8b8bd1e`](https://github.com/donghao1393/mcp-dbutils/commit/8b8bd1ea04d63e7828c81dc25a9c0cb70df73867))
|
55
|
+
|
56
|
+
* 添加更多数据库工具
|
57
|
+
|
58
|
+
添加三个新的数据库工具: - dbutils-describe-table:获取表的详细信息 - dbutils-get-ddl:获取表的DDL语句 -
|
59
|
+
dbutils-list-indexes:获取表的索引信息
|
60
|
+
|
61
|
+
实现内容: - DatabaseHandler新增三个抽象方法 - PostgreSQL和SQLite分别实现这些方法 - 添加新工具的集成测试 - 所有测试通过
|
62
|
+
|
63
|
+
Fixes #12
|
64
|
+
|
65
|
+
* test: 拆分表信息工具测试
|
66
|
+
|
67
|
+
将test_table_info_tools拆分为三个独立的测试函数: - test_describe_table_tool - test_get_ddl_tool -
|
68
|
+
test_list_indexes_tool
|
69
|
+
|
70
|
+
这样可以更清晰地展示每个工具的测试状态,便于定位问题。
|
71
|
+
|
72
|
+
- Enhance monitoring system with LLM dialog support
|
73
|
+
([#17](https://github.com/donghao1393/mcp-dbutils/pull/17),
|
74
|
+
[`50d8df1`](https://github.com/donghao1393/mcp-dbutils/commit/50d8df1fabbf6513718582e6efe0d3832de9ce5d))
|
75
|
+
|
76
|
+
- Add query duration tracking - Add query type statistics - Add slow query detection - Add memory
|
77
|
+
usage tracking - Add performance statistics formatting - Add new MCP tools:
|
78
|
+
dbutils-get-performance and dbutils-analyze-query - Add tests for new features
|
79
|
+
|
80
|
+
Closes #16
|
81
|
+
|
82
|
+
|
4
83
|
## v0.8.0 (2025-03-09)
|
5
84
|
|
6
85
|
### Features
|
7
86
|
|
8
87
|
- Unify tool names with dbutils prefix ([#11](https://github.com/donghao1393/mcp-dbutils/pull/11),
|
9
|
-
[`
|
88
|
+
[`aa57995`](https://github.com/donghao1393/mcp-dbutils/commit/aa57995dc6cf3ffd33909162d831dffbbbf19bfc))
|
10
89
|
|
11
90
|
给工具名称添加dbutils前缀,使所有工具名称规范统一: - query -> dbutils-run-query - list_tables -> dbutils-list-tables
|
12
91
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-dbutils
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.0
|
4
4
|
Summary: MCP Database Utilities Service
|
5
5
|
Author: Dong Hao
|
6
6
|
License-Expression: MIT
|
@@ -148,7 +148,7 @@ Add to Claude configuration:
|
|
148
148
|
The project requires a YAML configuration file, specified via the `--config` parameter. Configuration example:
|
149
149
|
|
150
150
|
```yaml
|
151
|
-
|
151
|
+
connections:
|
152
152
|
# Standard PostgreSQL configuration example
|
153
153
|
my_postgres:
|
154
154
|
type: postgres
|
@@ -257,7 +257,7 @@ The abstraction layer design is the core architectural concept in MCP Database U
|
|
257
257
|
|
258
258
|
### Basic Query
|
259
259
|
```python
|
260
|
-
# Access through
|
260
|
+
# Access through connection name
|
261
261
|
async with server.get_handler("my_postgres") as handler:
|
262
262
|
# Execute SQL query
|
263
263
|
result = await handler.execute_query("SELECT * FROM users")
|
@@ -275,7 +275,7 @@ schema = await handler.get_schema("users")
|
|
275
275
|
### Error Handling
|
276
276
|
```python
|
277
277
|
try:
|
278
|
-
async with server.get_handler("
|
278
|
+
async with server.get_handler("my_connection") as handler:
|
279
279
|
result = await handler.execute_query("SELECT * FROM users")
|
280
280
|
except ValueError as e:
|
281
281
|
print(f"Configuration error: {e}")
|
@@ -298,19 +298,53 @@ Core server class providing:
|
|
298
298
|
|
299
299
|
### MCP Tools
|
300
300
|
|
301
|
-
####
|
301
|
+
#### dbutils-list-tables
|
302
302
|
Lists all tables in the specified database.
|
303
303
|
- Parameters:
|
304
|
-
*
|
304
|
+
* connection: Database connection name
|
305
305
|
- Returns: Text content with a list of table names
|
306
306
|
|
307
|
-
#### query
|
307
|
+
#### dbutils-run-query
|
308
308
|
Executes a SQL query on the specified database.
|
309
309
|
- Parameters:
|
310
|
-
*
|
310
|
+
* connection: Database connection name
|
311
311
|
* sql: SQL query to execute (SELECT only)
|
312
312
|
- Returns: Query results in a formatted text
|
313
313
|
|
314
|
+
#### dbutils-get-stats
|
315
|
+
Get table statistics information.
|
316
|
+
- Parameters:
|
317
|
+
* connection: Database connection name
|
318
|
+
* table: Table name
|
319
|
+
- Returns: Statistics including row count, size, column stats
|
320
|
+
|
321
|
+
#### dbutils-list-constraints
|
322
|
+
List table constraints (primary key, foreign keys, etc).
|
323
|
+
- Parameters:
|
324
|
+
* connection: Database connection name
|
325
|
+
* table: Table name
|
326
|
+
- Returns: Detailed constraint information
|
327
|
+
|
328
|
+
#### dbutils-explain-query
|
329
|
+
Get query execution plan with cost estimates.
|
330
|
+
- Parameters:
|
331
|
+
* connection: Database connection name
|
332
|
+
* sql: SQL query to explain
|
333
|
+
- Returns: Formatted execution plan
|
334
|
+
|
335
|
+
#### dbutils-get-performance
|
336
|
+
Get database performance statistics.
|
337
|
+
- Parameters:
|
338
|
+
* connection: Database connection name
|
339
|
+
- Returns: Detailed performance statistics including query times, query types, error rates, and resource usage
|
340
|
+
|
341
|
+
#### dbutils-analyze-query
|
342
|
+
Analyze a SQL query for performance and provide optimization suggestions.
|
343
|
+
- Parameters:
|
344
|
+
* connection: Database connection name
|
345
|
+
* sql: SQL query to analyze
|
346
|
+
- Returns: Query analysis with execution plan, timing information, and optimization suggestions
|
347
|
+
|
314
348
|
### DatabaseHandler
|
315
349
|
Abstract base class defining interfaces:
|
316
350
|
- get_tables(): Get table resource list
|
@@ -126,7 +126,7 @@ Add to Claude configuration:
|
|
126
126
|
The project requires a YAML configuration file, specified via the `--config` parameter. Configuration example:
|
127
127
|
|
128
128
|
```yaml
|
129
|
-
|
129
|
+
connections:
|
130
130
|
# Standard PostgreSQL configuration example
|
131
131
|
my_postgres:
|
132
132
|
type: postgres
|
@@ -235,7 +235,7 @@ The abstraction layer design is the core architectural concept in MCP Database U
|
|
235
235
|
|
236
236
|
### Basic Query
|
237
237
|
```python
|
238
|
-
# Access through
|
238
|
+
# Access through connection name
|
239
239
|
async with server.get_handler("my_postgres") as handler:
|
240
240
|
# Execute SQL query
|
241
241
|
result = await handler.execute_query("SELECT * FROM users")
|
@@ -253,7 +253,7 @@ schema = await handler.get_schema("users")
|
|
253
253
|
### Error Handling
|
254
254
|
```python
|
255
255
|
try:
|
256
|
-
async with server.get_handler("
|
256
|
+
async with server.get_handler("my_connection") as handler:
|
257
257
|
result = await handler.execute_query("SELECT * FROM users")
|
258
258
|
except ValueError as e:
|
259
259
|
print(f"Configuration error: {e}")
|
@@ -276,19 +276,53 @@ Core server class providing:
|
|
276
276
|
|
277
277
|
### MCP Tools
|
278
278
|
|
279
|
-
####
|
279
|
+
#### dbutils-list-tables
|
280
280
|
Lists all tables in the specified database.
|
281
281
|
- Parameters:
|
282
|
-
*
|
282
|
+
* connection: Database connection name
|
283
283
|
- Returns: Text content with a list of table names
|
284
284
|
|
285
|
-
#### query
|
285
|
+
#### dbutils-run-query
|
286
286
|
Executes a SQL query on the specified database.
|
287
287
|
- Parameters:
|
288
|
-
*
|
288
|
+
* connection: Database connection name
|
289
289
|
* sql: SQL query to execute (SELECT only)
|
290
290
|
- Returns: Query results in a formatted text
|
291
291
|
|
292
|
+
#### dbutils-get-stats
|
293
|
+
Get table statistics information.
|
294
|
+
- Parameters:
|
295
|
+
* connection: Database connection name
|
296
|
+
* table: Table name
|
297
|
+
- Returns: Statistics including row count, size, column stats
|
298
|
+
|
299
|
+
#### dbutils-list-constraints
|
300
|
+
List table constraints (primary key, foreign keys, etc).
|
301
|
+
- Parameters:
|
302
|
+
* connection: Database connection name
|
303
|
+
* table: Table name
|
304
|
+
- Returns: Detailed constraint information
|
305
|
+
|
306
|
+
#### dbutils-explain-query
|
307
|
+
Get query execution plan with cost estimates.
|
308
|
+
- Parameters:
|
309
|
+
* connection: Database connection name
|
310
|
+
* sql: SQL query to explain
|
311
|
+
- Returns: Formatted execution plan
|
312
|
+
|
313
|
+
#### dbutils-get-performance
|
314
|
+
Get database performance statistics.
|
315
|
+
- Parameters:
|
316
|
+
* connection: Database connection name
|
317
|
+
- Returns: Detailed performance statistics including query times, query types, error rates, and resource usage
|
318
|
+
|
319
|
+
#### dbutils-analyze-query
|
320
|
+
Analyze a SQL query for performance and provide optimization suggestions.
|
321
|
+
- Parameters:
|
322
|
+
* connection: Database connection name
|
323
|
+
* sql: SQL query to analyze
|
324
|
+
- Returns: Query analysis with execution plan, timing information, and optimization suggestions
|
325
|
+
|
292
326
|
### DatabaseHandler
|
293
327
|
Abstract base class defining interfaces:
|
294
328
|
- get_tables(): Get table resource list
|
@@ -110,7 +110,7 @@ docker run -i --rm \
|
|
110
110
|
项目运行需要一个YAML格式的配置文件,通过 `--config` 参数指定路径。配置示例:
|
111
111
|
|
112
112
|
```yaml
|
113
|
-
|
113
|
+
connections:
|
114
114
|
# PostgreSQL标准配置示例
|
115
115
|
my_postgres:
|
116
116
|
type: postgres
|
@@ -219,7 +219,7 @@ graph TD
|
|
219
219
|
|
220
220
|
### 基本查询
|
221
221
|
```python
|
222
|
-
#
|
222
|
+
# 通过连接名称访问
|
223
223
|
async with server.get_handler("my_postgres") as handler:
|
224
224
|
# 执行SQL查询
|
225
225
|
result = await handler.execute_query("SELECT * FROM users")
|
@@ -237,7 +237,7 @@ schema = await handler.get_schema("users")
|
|
237
237
|
### 错误处理
|
238
238
|
```python
|
239
239
|
try:
|
240
|
-
async with server.get_handler("
|
240
|
+
async with server.get_handler("my_connection") as handler:
|
241
241
|
result = await handler.execute_query("SELECT * FROM users")
|
242
242
|
except ValueError as e:
|
243
243
|
print(f"配置错误: {e}")
|
@@ -260,19 +260,53 @@ except Exception as e:
|
|
260
260
|
|
261
261
|
### MCP工具
|
262
262
|
|
263
|
-
####
|
263
|
+
#### dbutils-list-tables
|
264
264
|
列出指定数据库中的所有表。
|
265
265
|
- 参数:
|
266
|
-
*
|
266
|
+
* connection: 数据库连接名称
|
267
267
|
- 返回:包含表名列表的文本内容
|
268
268
|
|
269
|
-
#### query
|
269
|
+
#### dbutils-run-query
|
270
270
|
在指定数据库上执行SQL查询。
|
271
271
|
- 参数:
|
272
|
-
*
|
272
|
+
* connection: 数据库连接名称
|
273
273
|
* sql: 要执行的SQL查询(仅支持SELECT)
|
274
274
|
- 返回:格式化的查询结果文本
|
275
275
|
|
276
|
+
#### dbutils-get-stats
|
277
|
+
获取表的统计信息。
|
278
|
+
- 参数:
|
279
|
+
* connection: 数据库连接名称
|
280
|
+
* table: 表名
|
281
|
+
- 返回:包括行数、大小、列统计等信息
|
282
|
+
|
283
|
+
#### dbutils-list-constraints
|
284
|
+
列出表的约束信息(主键、外键等)。
|
285
|
+
- 参数:
|
286
|
+
* connection: 数据库连接名称
|
287
|
+
* table: 表名
|
288
|
+
- 返回:详细的约束信息
|
289
|
+
|
290
|
+
#### dbutils-explain-query
|
291
|
+
获取查询的执行计划和成本估算。
|
292
|
+
- 参数:
|
293
|
+
* connection: 数据库连接名称
|
294
|
+
* sql: 要分析的SQL查询
|
295
|
+
- 返回:格式化的执行计划
|
296
|
+
|
297
|
+
#### dbutils-get-performance
|
298
|
+
获取数据库性能统计信息。
|
299
|
+
- 参数:
|
300
|
+
* connection: 数据库连接名称
|
301
|
+
- 返回:详细的性能统计信息,包括查询时间、查询类型、错误率和资源使用情况
|
302
|
+
|
303
|
+
#### dbutils-analyze-query
|
304
|
+
分析SQL查询的性能并提供优化建议。
|
305
|
+
- 参数:
|
306
|
+
* connection: 数据库连接名称
|
307
|
+
* sql: 要分析的SQL查询
|
308
|
+
- 返回:查询分析结果,包括执行计划、时间信息和优化建议
|
309
|
+
|
276
310
|
### DatabaseHandler
|
277
311
|
抽象基类,定义接口:
|
278
312
|
- get_tables(): 获取表资源列表
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"""MCP
|
1
|
+
"""MCP Connection Utilities Service"""
|
2
2
|
|
3
3
|
import asyncio
|
4
4
|
import argparse
|
@@ -9,7 +9,7 @@ import yaml
|
|
9
9
|
from importlib.metadata import metadata
|
10
10
|
|
11
11
|
from .log import create_logger
|
12
|
-
from .base import
|
12
|
+
from .base import ConnectionServer
|
13
13
|
|
14
14
|
# 获取包信息
|
15
15
|
pkg_meta = metadata("mcp-dbutils")
|
@@ -19,7 +19,7 @@ log = create_logger(pkg_meta["Name"])
|
|
19
19
|
|
20
20
|
async def run_server():
|
21
21
|
"""服务器运行逻辑"""
|
22
|
-
parser = argparse.ArgumentParser(description='MCP
|
22
|
+
parser = argparse.ArgumentParser(description='MCP Connection Server')
|
23
23
|
parser.add_argument('--config', required=True, help='YAML配置文件路径')
|
24
24
|
parser.add_argument('--local-host', help='本地主机地址')
|
25
25
|
|
@@ -32,7 +32,7 @@ async def run_server():
|
|
32
32
|
global log
|
33
33
|
log = create_logger(pkg_meta["Name"], debug)
|
34
34
|
|
35
|
-
log("info", f"MCP
|
35
|
+
log("info", f"MCP Connection Utilities Service v{pkg_meta['Version']}")
|
36
36
|
if debug:
|
37
37
|
log("debug", "Debug模式已开启")
|
38
38
|
|
@@ -40,11 +40,11 @@ async def run_server():
|
|
40
40
|
try:
|
41
41
|
with open(args.config, 'r') as f:
|
42
42
|
config = yaml.safe_load(f)
|
43
|
-
if not config or '
|
44
|
-
log("error", "配置文件必须包含
|
43
|
+
if not config or 'connections' not in config:
|
44
|
+
log("error", "配置文件必须包含 connections 配置")
|
45
45
|
sys.exit(1)
|
46
|
-
if not config['
|
47
|
-
log("error", "
|
46
|
+
if not config['connections']:
|
47
|
+
log("error", "配置文件必须包含至少一个连接配置")
|
48
48
|
sys.exit(1)
|
49
49
|
except Exception as e:
|
50
50
|
log("error", f"读取配置文件失败: {str(e)}")
|
@@ -52,7 +52,7 @@ async def run_server():
|
|
52
52
|
|
53
53
|
# 创建并运行服务器
|
54
54
|
try:
|
55
|
-
server =
|
55
|
+
server = ConnectionServer(args.config, debug)
|
56
56
|
await server.run()
|
57
57
|
except KeyboardInterrupt:
|
58
58
|
log("info", "服务器已停止")
|