db-connect-mcp 0.1.0__py3-none-any.whl → 0.1.3__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.

Potentially problematic release.


This version of db-connect-mcp might be problematic. Click here for more details.

@@ -1,7 +1,7 @@
1
1
  """Base adapter abstract class for database-specific implementations."""
2
2
 
3
3
  from abc import ABC, abstractmethod
4
- from typing import Any, Optional
4
+ from typing import Any, Optional, Union, TYPE_CHECKING
5
5
 
6
6
  from sqlalchemy.ext.asyncio import AsyncConnection
7
7
 
@@ -10,6 +10,12 @@ from db_connect_mcp.models.database import SchemaInfo
10
10
  from db_connect_mcp.models.statistics import ColumnStats, Distribution
11
11
  from db_connect_mcp.models.table import TableInfo
12
12
 
13
+ if TYPE_CHECKING:
14
+ from db_connect_mcp.core.connection import AsyncConnectionWrapper
15
+
16
+ # Type alias for connection types
17
+ ConnectionType = Union[AsyncConnection, "AsyncConnectionWrapper"]
18
+
13
19
 
14
20
  class BaseAdapter(ABC):
15
21
  """Base adapter defining database-specific interface."""
@@ -22,7 +28,7 @@ class BaseAdapter(ABC):
22
28
 
23
29
  @abstractmethod
24
30
  async def enrich_schema_info(
25
- self, conn: AsyncConnection, schema_info: SchemaInfo
31
+ self, conn: ConnectionType, schema_info: SchemaInfo
26
32
  ) -> SchemaInfo:
27
33
  """
28
34
  Enrich schema info with database-specific metadata.
@@ -38,7 +44,7 @@ class BaseAdapter(ABC):
38
44
 
39
45
  @abstractmethod
40
46
  async def enrich_table_info(
41
- self, conn: AsyncConnection, table_info: TableInfo
47
+ self, conn: ConnectionType, table_info: TableInfo
42
48
  ) -> TableInfo:
43
49
  """
44
50
  Enrich table info with database-specific metadata.
@@ -55,7 +61,7 @@ class BaseAdapter(ABC):
55
61
  @abstractmethod
56
62
  async def get_column_statistics(
57
63
  self,
58
- conn: AsyncConnection,
64
+ conn: ConnectionType,
59
65
  table_name: str,
60
66
  column_name: str,
61
67
  schema: Optional[str],
@@ -77,7 +83,7 @@ class BaseAdapter(ABC):
77
83
  @abstractmethod
78
84
  async def get_value_distribution(
79
85
  self,
80
- conn: AsyncConnection,
86
+ conn: ConnectionType,
81
87
  table_name: str,
82
88
  column_name: str,
83
89
  schema: Optional[str],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: db-connect-mcp
3
- Version: 0.1.0
3
+ Version: 0.1.3
4
4
  Summary: Multi-database MCP server for PostgreSQL, MySQL, and ClickHouse
5
5
  Project-URL: Homepage, https://github.com/yugui923/db-connect-mcp
6
6
  Project-URL: Repository, https://github.com/yugui923/db-connect-mcp
@@ -14,10 +14,13 @@ Classifier: Framework :: AsyncIO
14
14
  Classifier: Intended Audience :: Developers
15
15
  Classifier: License :: OSI Approved :: MIT License
16
16
  Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
17
20
  Classifier: Programming Language :: Python :: 3.13
18
21
  Classifier: Topic :: Database
19
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
- Requires-Python: >=3.13
23
+ Requires-Python: >=3.10
21
24
  Requires-Dist: aiomysql>=0.2.0
22
25
  Requires-Dist: asyncpg>=0.29.0
23
26
  Requires-Dist: clickhouse-connect>=0.7.0
@@ -57,8 +60,7 @@ A read-only MCP (Model Context Protocol) server for exploratory data analysis ac
57
60
  {
58
61
  "mcpServers": {
59
62
  "db-connect": {
60
- "command": "uv",
61
- "args": ["run", "python", "C:/path/to/db-connect-mcp/main.py"],
63
+ "command": "db-connect-mcp",
62
64
  "env": {
63
65
  "DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb"
64
66
  }
@@ -102,7 +104,7 @@ A read-only MCP (Model Context Protocol) server for exploratory data analysis ac
102
104
  ## Installation
103
105
 
104
106
  ### Prerequisites
105
- - Python 3.13 or higher
107
+ - Python 3.10 or higher
106
108
  - One or more of:
107
109
  - PostgreSQL database (9.6+)
108
110
  - MySQL/MariaDB database (5.7+/10.2+)
@@ -270,14 +272,13 @@ If installed from PyPI:
270
272
  db-connect-mcp
271
273
  ```
272
274
 
273
- If running from source:
275
+ If running from source (development):
274
276
  ```bash
275
- python main.py
276
- ```
277
+ # Using module approach (recommended)
278
+ python -m db_connect_mcp
277
279
 
278
- Or with uv:
279
- ```bash
280
- uv run python main.py
280
+ # Or using uv
281
+ uv run db-connect-mcp
281
282
  ```
282
283
 
283
284
  ### Using with Claude Desktop
@@ -299,14 +300,14 @@ Add the server to your Claude Desktop configuration (`claude_desktop_config.json
299
300
  }
300
301
  ```
301
302
 
302
- #### If installed from source:
303
+ #### If running from source (development):
303
304
 
304
305
  ```json
305
306
  {
306
307
  "mcpServers": {
307
308
  "db-connect": {
308
309
  "command": "python",
309
- "args": ["C:/path/to/db-connect-mcp/main.py"],
310
+ "args": ["-m", "db_connect_mcp"],
310
311
  "env": {
311
312
  "DATABASE_URL": "postgresql+asyncpg://user:pass@host:5432/db"
312
313
  }
@@ -315,14 +316,14 @@ Add the server to your Claude Desktop configuration (`claude_desktop_config.json
315
316
  }
316
317
  ```
317
318
 
318
- #### Or using uv (for source installation):
319
+ #### Or using uv (for development with dependencies):
319
320
 
320
321
  ```json
321
322
  {
322
323
  "mcpServers": {
323
324
  "db-connect": {
324
325
  "command": "uv",
325
- "args": ["run", "python", "C:/path/to/db-connect-mcp/main.py"],
326
+ "args": ["--directory", "C:/path/to/db-connect-mcp", "run", "db-connect-mcp"],
326
327
  "env": {
327
328
  "DATABASE_URL": "mysql+aiomysql://user:pass@host:3306/db"
328
329
  }
@@ -336,15 +337,13 @@ You can configure multiple database connections:
336
337
  {
337
338
  "mcpServers": {
338
339
  "postgres-prod": {
339
- "command": "uv",
340
- "args": ["run", "python", "C:/path/to/db-connect-mcp/main.py"],
340
+ "command": "db-connect-mcp",
341
341
  "env": {
342
342
  "DATABASE_URL": "postgresql+asyncpg://user:pass@pg-host:5432/db"
343
343
  }
344
344
  },
345
345
  "mysql-analytics": {
346
- "command": "uv",
347
- "args": ["run", "python", "C:/path/to/db-connect-mcp/main.py"],
346
+ "command": "db-connect-mcp",
348
347
  "env": {
349
348
  "DATABASE_URL": "mysql+aiomysql://user:pass@mysql-host:3306/analytics"
350
349
  }
@@ -470,35 +469,36 @@ Once configured, you can use the server in Claude:
470
469
  ```
471
470
  db-connect-mcp/
472
471
  ├── src/
473
- ├── adapters/ # Database-specific adapters
474
- ├── __init__.py
475
- │ ├── base.py # Base adapter interface
476
- │ ├── postgresql.py # PostgreSQL adapter
477
- │ ├── mysql.py # MySQL adapter
478
- └── clickhouse.py # ClickHouse adapter
479
- ├── core/ # Core functionality
480
- ├── __init__.py
481
- │ ├── connection.py # Database connection management
482
- │ ├── executor.py # Query execution
483
- │ ├── inspector.py # Metadata inspection
484
- └── analyzer.py # Statistical analysis
485
- ├── models/ # Data models
486
- ├── __init__.py
487
- │ ├── capabilities.py # Database capabilities
488
- │ ├── config.py # Configuration models
489
- │ ├── database.py # Database models
490
- │ ├── query.py # Query models
491
- │ ├── statistics.py # Statistics models
492
- └── table.py # Table metadata models
493
- ├── __init__.py
494
- ├── __main__.py
495
- └── server.py # Main MCP server implementation
472
+ └── db_connect_mcp/
473
+ ├── adapters/ # Database-specific adapters
474
+ │ ├── __init__.py
475
+ │ ├── base.py # Base adapter interface
476
+ │ ├── postgresql.py # PostgreSQL adapter
477
+ ├── mysql.py # MySQL adapter
478
+ └── clickhouse.py # ClickHouse adapter
479
+ ├── core/ # Core functionality
480
+ │ ├── __init__.py
481
+ │ ├── connection.py # Database connection management
482
+ │ ├── executor.py # Query execution
483
+ ├── inspector.py # Metadata inspection
484
+ └── analyzer.py # Statistical analysis
485
+ ├── models/ # Data models
486
+ │ ├── __init__.py
487
+ │ ├── capabilities.py # Database capabilities
488
+ │ ├── config.py # Configuration models
489
+ │ ├── database.py # Database models
490
+ │ ├── query.py # Query models
491
+ ├── statistics.py # Statistics models
492
+ └── table.py # Table metadata models
493
+ ├── __init__.py
494
+ ├── __main__.py # Module entry point
495
+ │ └── server.py # Main MCP server implementation
496
496
  ├── tests/
497
497
  │ ├── conftest.py # Test configuration
498
498
  │ └── test_server.py # Integration tests
499
499
  ├── .env.example # Example environment configuration
500
- ├── main.py # Entry point
501
- ├── pyproject.toml # Project dependencies
500
+ ├── main.py # Legacy entry point (optional)
501
+ ├── pyproject.toml # Project dependencies and console scripts
502
502
  └── README.md # This file
503
503
  ```
504
504
 
@@ -2,7 +2,7 @@ db_connect_mcp/__init__.py,sha256=HBy0IhP1gAQEGVscnMsyBtjLGLGx2Utd4SwOMMQijBw,81
2
2
  db_connect_mcp/__main__.py,sha256=uUbJtogwzOjQatBlmM6Vf0FLYBrtlN1LB25M0DIp25M,361
3
3
  db_connect_mcp/server.py,sha256=-k7594K5UeAeIUpuzU5uwLPO793lT8R0L1zwlotbfnQ,17350
4
4
  db_connect_mcp/adapters/__init__.py,sha256=f89QV2q4-7iqRyqQEMz7gQ4DbEJcVSzreYF1gUQdf5c,1743
5
- db_connect_mcp/adapters/base.py,sha256=HVeS-1Pd22ZOGtrA4u2yQT7d6H4zmWTI14bOOjbvBcU,3916
5
+ db_connect_mcp/adapters/base.py,sha256=23dIGmdnPZmGnc-PjJgXLrMUru3MWqTI3-alSyA31A4,4124
6
6
  db_connect_mcp/adapters/clickhouse.py,sha256=BvSbIJGZZtIIrd6FziVxA6Y-vshqb3Xc_WLuehGdKU0,10619
7
7
  db_connect_mcp/adapters/mysql.py,sha256=U-kQ80JiYno5KKXfWgDiXoArine_JqpjHXKHoMq9R_Q,9914
8
8
  db_connect_mcp/adapters/postgresql.py,sha256=cLl8AhAc1hquUg-oduhYut9omE_zEkEjBQZBYqpkPl0,12592
@@ -18,8 +18,8 @@ db_connect_mcp/models/database.py,sha256=MEg5pimkkvMhdre7u2oVWRyuaJToja26Rjro-QC
18
18
  db_connect_mcp/models/query.py,sha256=FazyV6pWEJFUDlYPswOmCGJTUgT14f9xfzQHZhxh9n0,4398
19
19
  db_connect_mcp/models/statistics.py,sha256=ii_UqybC9L5P1DF4KN0XOnG49s4cmYlOdWDAdkVhqUc,6208
20
20
  db_connect_mcp/models/table.py,sha256=v1HhItb2UqS9QpAfMgDoDyU_6xDgvy4r3BlEE7QliSs,8445
21
- db_connect_mcp-0.1.0.dist-info/METADATA,sha256=QqaoYT-xLEdVBeINqV1wxk0SC_fmZi7FAczZq_Bv6-8,18111
22
- db_connect_mcp-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
- db_connect_mcp-0.1.0.dist-info/entry_points.txt,sha256=UoN-St_MnE5kk4ZDEvzMi6dCvNi0CmvsqbPpYNxJOac,62
24
- db_connect_mcp-0.1.0.dist-info/licenses/LICENSE,sha256=c71UYlLh5ubuIlgVlM3EMkFdhWxTIULtUx_a8KOhI8w,1065
25
- db_connect_mcp-0.1.0.dist-info/RECORD,,
21
+ db_connect_mcp-0.1.3.dist-info/METADATA,sha256=0x7lLaw15abY6HfwQglaDBsmGj2KlEZoL0NbFh4ZUDY,18351
22
+ db_connect_mcp-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ db_connect_mcp-0.1.3.dist-info/entry_points.txt,sha256=UoN-St_MnE5kk4ZDEvzMi6dCvNi0CmvsqbPpYNxJOac,62
24
+ db_connect_mcp-0.1.3.dist-info/licenses/LICENSE,sha256=c71UYlLh5ubuIlgVlM3EMkFdhWxTIULtUx_a8KOhI8w,1065
25
+ db_connect_mcp-0.1.3.dist-info/RECORD,,