mcp-dbutils 0.20.0__py3-none-any.whl → 0.21.0__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 CHANGED
@@ -444,7 +444,7 @@ class ConnectionServer:
444
444
  return [
445
445
  types.Tool(
446
446
  name="dbutils-list-connections",
447
- description="List all available database connections defined in the configuration",
447
+ description="Lists all available database connections defined in the configuration with detailed information including database type, host, port, and database name, while hiding sensitive information like passwords. The optional check_status parameter allows verifying if each connection is available, though this may increase response time. Use this tool when you need to understand available database resources or diagnose connection issues.",
448
448
  inputSchema={
449
449
  "type": "object",
450
450
  "properties": {
@@ -459,7 +459,7 @@ class ConnectionServer:
459
459
  ),
460
460
  types.Tool(
461
461
  name="dbutils-run-query",
462
- description="Execute read-only SQL query on database connection",
462
+ description="Executes read-only SQL queries on the specified database connection. For security, only SELECT statements are supported. Returns structured results with column names and data rows. Supports complex queries including JOINs, GROUP BY, ORDER BY, and aggregate functions. Use this tool when you need to analyze data, validate hypotheses, or extract specific information. Query execution is protected by resource limits and timeouts to prevent system resource overuse.",
463
463
  inputSchema={
464
464
  "type": "object",
465
465
  "properties": {
@@ -477,7 +477,7 @@ class ConnectionServer:
477
477
  ),
478
478
  types.Tool(
479
479
  name="dbutils-list-tables",
480
- description="List all available tables in the specified database connection",
480
+ description="Lists all tables in the specified database connection. Results include table names, URIs, and available table descriptions. Results are grouped by database type and clearly labeled for easy identification. Use this tool when you need to understand database structure or locate specific tables. Only works within the allowed connection scope.",
481
481
  inputSchema={
482
482
  "type": "object",
483
483
  "properties": {
@@ -491,7 +491,7 @@ class ConnectionServer:
491
491
  ),
492
492
  types.Tool(
493
493
  name="dbutils-describe-table",
494
- description="Get detailed information about a table's structure",
494
+ description="Provides detailed information about a table's structure, including column names, data types, nullability, default values, and comments. Results are formatted as an easy-to-read hierarchy that clearly displays all column attributes. Use this tool when you need to understand table structure in depth, analyze data models, or prepare queries. Supports all major database types with consistent output format.",
495
495
  inputSchema={
496
496
  "type": "object",
497
497
  "properties": {
@@ -509,7 +509,7 @@ class ConnectionServer:
509
509
  ),
510
510
  types.Tool(
511
511
  name="dbutils-get-ddl",
512
- description="Get DDL statement for creating the table",
512
+ description="Retrieves the complete DDL (Data Definition Language) statement for creating the specified table. Returns the original CREATE TABLE statement including all column definitions, constraints, indexes, and table options. This tool is valuable when you need to understand the complete table structure, replicate table structure, or perform database migrations. Note that DDL statement format varies by database type.",
513
513
  inputSchema={
514
514
  "type": "object",
515
515
  "properties": {
@@ -527,7 +527,7 @@ class ConnectionServer:
527
527
  ),
528
528
  types.Tool(
529
529
  name="dbutils-list-indexes",
530
- description="List all indexes on the specified table",
530
+ description="Lists all indexes on the specified table, including index names, types (unique/non-unique), index methods (e.g., B-tree), and included columns. Results are grouped by index name, clearly showing the structure of multi-column indexes. Use this tool when you need to optimize query performance, understand table access patterns, or diagnose performance issues.",
531
531
  inputSchema={
532
532
  "type": "object",
533
533
  "properties": {
@@ -545,7 +545,7 @@ class ConnectionServer:
545
545
  ),
546
546
  types.Tool(
547
547
  name="dbutils-get-stats",
548
- description="Get table statistics like row count and size",
548
+ description="Retrieves statistical information about the table, including estimated row count, average row length, data size, index size, and column information. These statistics are valuable for understanding table size, growth trends, and storage characteristics. Use this tool when you need to perform capacity planning, performance optimization, or database maintenance. Note that the precision and availability of statistics may vary by database type.",
549
549
  inputSchema={
550
550
  "type": "object",
551
551
  "properties": {
@@ -563,7 +563,7 @@ class ConnectionServer:
563
563
  ),
564
564
  types.Tool(
565
565
  name="dbutils-list-constraints",
566
- description="List all constraints (primary key, foreign keys, etc) on the table",
566
+ description="Lists all constraints on the table, including primary keys, foreign keys, unique constraints, and check constraints. Results are grouped by constraint type, clearly showing constraint names and involved columns. For foreign key constraints, referenced tables and columns are also displayed. Use this tool when you need to understand data integrity rules, table relationships, or data validation logic.",
567
567
  inputSchema={
568
568
  "type": "object",
569
569
  "properties": {
@@ -581,7 +581,7 @@ class ConnectionServer:
581
581
  ),
582
582
  types.Tool(
583
583
  name="dbutils-explain-query",
584
- description="Get execution plan for a SQL query",
584
+ description="Provides the execution plan for a SQL query, showing how the database engine will process the query. Returns detailed execution plan including access methods, join types, sort operations, and estimated costs. Also provides actual execution statistics where available. Use this tool when you need to optimize query performance, understand complex query behavior, or diagnose slow queries. Note that execution plan format varies by database type.",
585
585
  inputSchema={
586
586
  "type": "object",
587
587
  "properties": {
@@ -599,7 +599,7 @@ class ConnectionServer:
599
599
  ),
600
600
  types.Tool(
601
601
  name="dbutils-get-performance",
602
- description="Get database performance statistics",
602
+ description="Retrieves performance metrics for the database connection, including query count, average execution time, memory usage, and error statistics. These metrics reflect the resource usage of the current session and help monitor and optimize database operations. Use this tool when you need to evaluate query efficiency, identify performance bottlenecks, or monitor resource usage.",
603
603
  inputSchema={
604
604
  "type": "object",
605
605
  "properties": {
@@ -613,7 +613,7 @@ class ConnectionServer:
613
613
  ),
614
614
  types.Tool(
615
615
  name="dbutils-analyze-query",
616
- description="Analyze a SQL query for performance",
616
+ description="Analyzes the performance characteristics of a SQL query, providing execution plan, actual execution time, and optimization suggestions. The tool executes the query (SELECT statements only) and measures performance, then provides specific optimization recommendations based on the results, such as adding indexes, restructuring join conditions, or adjusting query structure. Use this tool when you need to improve query performance, understand performance bottlenecks, or learn query optimization techniques.",
617
617
  inputSchema={
618
618
  "type": "object",
619
619
  "properties": {
@@ -62,6 +62,7 @@ class MySQLHandler(ConnectionHandler):
62
62
 
63
63
  async def get_tables(self) -> list[types.Resource]:
64
64
  """Get all table resources"""
65
+ conn = None
65
66
  try:
66
67
  conn_params = self.config.get_connection_params()
67
68
  conn = mysql.connector.connect(**conn_params)
@@ -92,6 +93,7 @@ class MySQLHandler(ConnectionHandler):
92
93
 
93
94
  async def get_schema(self, table_name: str) -> str:
94
95
  """Get table schema information"""
96
+ conn = None
95
97
  try:
96
98
  conn_params = self.config.get_connection_params()
97
99
  conn = mysql.connector.connect(**conn_params)
@@ -33,6 +33,7 @@ class PostgreSQLHandler(ConnectionHandler):
33
33
 
34
34
  async def get_tables(self) -> list[types.Resource]:
35
35
  """Get all table resources"""
36
+ conn = None
36
37
  try:
37
38
  conn_params = self.config.get_connection_params()
38
39
  conn = psycopg2.connect(**conn_params)
@@ -66,6 +67,7 @@ class PostgreSQLHandler(ConnectionHandler):
66
67
 
67
68
  async def get_schema(self, table_name: str) -> str:
68
69
  """Get table schema information"""
70
+ conn = None
69
71
  try:
70
72
  conn_params = self.config.get_connection_params()
71
73
  conn = psycopg2.connect(**conn_params)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-dbutils
3
- Version: 0.20.0
3
+ Version: 0.21.0
4
4
  Summary: MCP Database Utilities Service
5
5
  Author: Dong Hao
6
6
  License-Expression: MIT
@@ -125,14 +125,17 @@ MCP Database Utilities 是一个多功能的 MCP 服务,它使您的 AI 能够
125
125
 
126
126
  MCP 数据库工具提供了多种工具,使 AI 能够与您的数据库交互:
127
127
 
128
- - **dbutils-list-connections**:列出配置中的所有可用数据库连接
129
- - **dbutils-list-tables**:列出数据库中的所有表
130
- - **dbutils-run-query**:执行 SQL 查询(仅 SELECT)
131
- - **dbutils-get-stats**:获取表统计信息
132
- - **dbutils-list-constraints**:列出表约束
133
- - **dbutils-explain-query**:获取查询执行计划
134
- - **dbutils-get-performance**:获取数据库性能指标
135
- - **dbutils-analyze-query**:分析查询以进行优化
128
+ - **dbutils-list-connections**:列出配置中的所有可用数据库连接,包括数据库类型、主机、端口和数据库名称等详细信息,同时隐藏密码等敏感信息。
129
+ - **dbutils-list-tables**:列出指定数据库连接中的所有表,包括表名、URI和可用的表描述,按数据库类型分组以便于识别。
130
+ - **dbutils-run-query**:执行只读SQL查询(仅SELECT),支持包括JOIN、GROUP BY和聚合函数在内的复杂查询,返回包含列名和数据行的结构化结果。
131
+ - **dbutils-describe-table**:提供表结构的详细信息,包括列名、数据类型、是否可为空、默认值和注释,以易于阅读的格式呈现。
132
+ - **dbutils-get-ddl**:获取创建指定表的完整DDL(数据定义语言)语句,包括所有列定义、约束和索引。
133
+ - **dbutils-list-indexes**:列出指定表上的所有索引,包括索引名称、类型(唯一/非唯一)、索引方法和包含的列,按索引名称分组。
134
+ - **dbutils-get-stats**:获取表的统计信息,包括估计行数、平均行长度、数据大小和索引大小。
135
+ - **dbutils-list-constraints**:列出表上的所有约束,包括主键、外键、唯一约束和检查约束,对于外键约束还显示引用的表和列。
136
+ - **dbutils-explain-query**:获取SQL查询的执行计划,显示数据库引擎将如何处理查询,包括访问方法、连接类型和估计成本。
137
+ - **dbutils-get-performance**:获取数据库连接的性能指标,包括查询计数、平均执行时间、内存使用情况和错误统计。
138
+ - **dbutils-analyze-query**:分析SQL查询的性能特性,提供执行计划、实际执行时间和具体的优化建议。
136
139
 
137
140
  有关这些工具的详细说明和使用示例,请参阅[使用指南](docs/zh/usage.md)。
138
141
 
@@ -1,22 +1,22 @@
1
1
  mcp_dbutils/__init__.py,sha256=6LLccQv7je2L4IpY_I3OzSJZcK32VUDJv2IY31y6eYg,1900
2
- mcp_dbutils/base.py,sha256=ptQfJwzYKteGokOrrkIcG3QIlz-f1Afk_XxyEHYcFLI,35957
2
+ mcp_dbutils/base.py,sha256=7UCw9gBZdzS_LnW3_QflWPfEV00eUFpUMDoaQJCN2aA,40012
3
3
  mcp_dbutils/config.py,sha256=bmXpOd1fyYfoyUS75I035ChT6t3wP5AyEnJ06e2ZS2o,1848
4
4
  mcp_dbutils/log.py,sha256=mqxi6I_IL-MF1F_pxBtnYZQKOHbGBJ74gsvZHVelr1w,823
5
5
  mcp_dbutils/stats.py,sha256=wMqWPfGnEOg9v5YBtTsARV-1YsFUMM_pKdzitzSU9x4,7137
6
6
  mcp_dbutils/mysql/__init__.py,sha256=gNhoHaxK1qhvMAH5AVl1vfV1rUpcbV9KZWUQb41aaQk,129
7
7
  mcp_dbutils/mysql/config.py,sha256=BTPPFqlhoTp7EBFIeLJZh8x6bCn3q9NivHYz9yZHziw,9820
8
- mcp_dbutils/mysql/handler.py,sha256=L2COmWts8WNQaI7wZSPtQ-BqKnpYL7DRnNk7Yw3UsxU,22285
8
+ mcp_dbutils/mysql/handler.py,sha256=Nu2YySImnYKOSLYe04ipHYWW1kNndFKiP-gdX5L5wpU,22325
9
9
  mcp_dbutils/mysql/server.py,sha256=1bWAu7qHYXVeTZu4wdEpS6gSVB0RoXKI3Smy_ix-y8A,8586
10
10
  mcp_dbutils/postgres/__init__.py,sha256=-2zYuEJEQ2AMvmGhH5Z_umerSvt7S4xOa_XV4wgvGfI,154
11
11
  mcp_dbutils/postgres/config.py,sha256=NyQOVhkXJ1S-JD0w-ePNjTKI1Ja-aZQkDUdHi6U7Vl4,7752
12
- mcp_dbutils/postgres/handler.py,sha256=JKnh3QsF5oQ4nS-OdhMC1nWtTp235PArFncFN4pmDZ8,24670
12
+ mcp_dbutils/postgres/handler.py,sha256=rHSvgz93UXIfnVzHFOTGhgnMMZy-s2tB6nR40p2G26Q,24710
13
13
  mcp_dbutils/postgres/server.py,sha256=_CiJC9PitpI1NB99Q1Bcs5TYADNgDpYMwv88fRHQunE,8640
14
14
  mcp_dbutils/sqlite/__init__.py,sha256=fK_3-WylCBYpBAzwuopi8hlwoIGJm2TPAlwcPWG46I0,134
15
15
  mcp_dbutils/sqlite/config.py,sha256=j67TJ8mQJ2D886MthSa-zYMtvUUYyyxYLMlNxkYoqZE,4509
16
16
  mcp_dbutils/sqlite/handler.py,sha256=nCgBeBp3zjpE2HNohMbh3Jpz5tNeMczt5K87JOhVWzY,19320
17
17
  mcp_dbutils/sqlite/server.py,sha256=jqpE8d9vJETMs5xYGB7P0tvNDPes6Yn5ZM_iCCF7Tv4,7181
18
- mcp_dbutils-0.20.0.dist-info/METADATA,sha256=MJm2Q5uHi6RtX4jdaioloUWcginbBkQv33xBjSju6-I,7146
19
- mcp_dbutils-0.20.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
- mcp_dbutils-0.20.0.dist-info/entry_points.txt,sha256=XTjt0QmYRgKOJQT6skR9bp1EMUfIrgpHeZJPZ3CJffs,49
21
- mcp_dbutils-0.20.0.dist-info/licenses/LICENSE,sha256=1A_CwpWVlbjrKdVEYO77vYfnXlW7oxcilZ8FpA_BzCI,1065
22
- mcp_dbutils-0.20.0.dist-info/RECORD,,
18
+ mcp_dbutils-0.21.0.dist-info/METADATA,sha256=0ZPTcDD34ecEh38aATtkvhGRj4Z1GNwX1Dp2cE9dSMY,8413
19
+ mcp_dbutils-0.21.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
+ mcp_dbutils-0.21.0.dist-info/entry_points.txt,sha256=XTjt0QmYRgKOJQT6skR9bp1EMUfIrgpHeZJPZ3CJffs,49
21
+ mcp_dbutils-0.21.0.dist-info/licenses/LICENSE,sha256=1A_CwpWVlbjrKdVEYO77vYfnXlW7oxcilZ8FpA_BzCI,1065
22
+ mcp_dbutils-0.21.0.dist-info/RECORD,,