db-connect-mcp 0.1.2__py3-none-any.whl → 0.1.4__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,13 +1,6 @@
1
1
  """Entry point for running db_connect_mcp as a module."""
2
2
 
3
- import asyncio
4
- import sys
5
-
6
- from db_connect_mcp.server import main
3
+ from db_connect_mcp.server import cli_entry
7
4
 
8
5
  if __name__ == "__main__":
9
- # Windows-specific event loop policy
10
- if sys.platform == "win32":
11
- asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy()) # type: ignore[attr-defined]
12
-
13
- asyncio.run(main())
6
+ cli_entry()
db_connect_mcp/server.py CHANGED
@@ -488,9 +488,25 @@ async def main() -> None:
488
488
  await mcp_server.cleanup()
489
489
 
490
490
 
491
- if __name__ == "__main__":
491
+ def cli_entry() -> None:
492
+ """
493
+ Synchronous entry point for console script.
494
+
495
+ This function is called by the 'db-connect-mcp' console script.
496
+ It sets up the event loop and runs the async main() function.
497
+ """
492
498
  # Windows-specific event loop policy
493
499
  if os.name == "nt":
494
500
  asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy()) # type: ignore[attr-defined]
495
501
 
496
- asyncio.run(main())
502
+ try:
503
+ asyncio.run(main())
504
+ except KeyboardInterrupt:
505
+ logger.info("Server stopped by user")
506
+ except Exception as e:
507
+ logger.error(f"Server error: {e}", exc_info=True)
508
+ raise
509
+
510
+
511
+ if __name__ == "__main__":
512
+ cli_entry()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: db-connect-mcp
3
- Version: 0.1.2
3
+ Version: 0.1.4
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
 
@@ -1,6 +1,6 @@
1
1
  db_connect_mcp/__init__.py,sha256=HBy0IhP1gAQEGVscnMsyBtjLGLGx2Utd4SwOMMQijBw,816
2
- db_connect_mcp/__main__.py,sha256=uUbJtogwzOjQatBlmM6Vf0FLYBrtlN1LB25M0DIp25M,361
3
- db_connect_mcp/server.py,sha256=-k7594K5UeAeIUpuzU5uwLPO793lT8R0L1zwlotbfnQ,17350
2
+ db_connect_mcp/__main__.py,sha256=x-ziUf30cHyn-feL61FJCP_TYJfTQIFRSjlAn3D7_VM,147
3
+ db_connect_mcp/server.py,sha256=SN8fCJ1G8dLTjWbuHkFn0op2BeM2cCW1QoZw4f7f-vc,17780
4
4
  db_connect_mcp/adapters/__init__.py,sha256=f89QV2q4-7iqRyqQEMz7gQ4DbEJcVSzreYF1gUQdf5c,1743
5
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
@@ -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.2.dist-info/METADATA,sha256=pSDE1HrJmdkm_MuSHN7z--PFV_iTZniUQggHNTednAE,18111
22
- db_connect_mcp-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
- db_connect_mcp-0.1.2.dist-info/entry_points.txt,sha256=UoN-St_MnE5kk4ZDEvzMi6dCvNi0CmvsqbPpYNxJOac,62
24
- db_connect_mcp-0.1.2.dist-info/licenses/LICENSE,sha256=c71UYlLh5ubuIlgVlM3EMkFdhWxTIULtUx_a8KOhI8w,1065
25
- db_connect_mcp-0.1.2.dist-info/RECORD,,
21
+ db_connect_mcp-0.1.4.dist-info/METADATA,sha256=son3d_gmNkbxQkG4RERvQGwBBAf_q5FNcywFQ5NQWEA,18351
22
+ db_connect_mcp-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ db_connect_mcp-0.1.4.dist-info/entry_points.txt,sha256=KjyjOdBJEFQutb9nB9Zvjc9XdjQ81O6H88r-Nb9vKGY,67
24
+ db_connect_mcp-0.1.4.dist-info/licenses/LICENSE,sha256=c71UYlLh5ubuIlgVlM3EMkFdhWxTIULtUx_a8KOhI8w,1065
25
+ db_connect_mcp-0.1.4.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ db-connect-mcp = db_connect_mcp.server:cli_entry
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- db-connect-mcp = db_connect_mcp.server:main