Skip to main content

mcp-win-stdio-db

Unified Database Model Context Protocol (MCP) server for PostgreSQL and MySQL with multi-server in-memory pooling, sibling database auto-derivation, cross-schema resolution, and complete DBA operations.

Part of the mcp-win-stdio Windows-optimized suite.


🚀 Features (20 Tools)

  • Polyglot Database Engine: Handles PostgreSQL (psycopg2) and MySQL (pymysql) transparently side-by-side.
  • In-Memory Connection Pooling: Fast continuous queries with zero reconnection latency and persistent use_database sticky state.
  • Detailed Diagnostic Error Reporting: Forwards native PostgreSQL error codes (e.g. 23503 FK violation), offending constraint names, column names, and error details directly to Claude so issues can be diagnosed immediately.
  • Sibling Database Auto-Derivation: On PostgreSQL (localhost:5432), auto-discovers sibling databases (showreel, dsr, location_booking, sap, etc.) on the fly.
  • DBA & Management Tools: create_database, drop_database (with safety guard), clone_database (instant template clone), terminate_connections, list_active_queries, dump_database, and restore_database.
  • Self-Contained SERVERS JSON: Configure multiple database instances in one environment variable without external files.

🛠️ Included Tools (20 Tools)

  1. list_connections: Lists all active and configured database connections.
  2. use_database: Switches active connection or switches database on current server.
  3. list_databases: Lists all databases on the active server.
  4. list_schemas: Lists all schemas in the active PostgreSQL database.
  5. describe_table: Detailed schema inspection (columns, nullability, PKs, FKs, indexes). Auto-resolves cross-schema tables in PostgreSQL.
  6. schema_overview: Compact overview of all user tables and views.
  7. get_table_sample: Returns sample rows and estimated row count.
  8. search_schema: Case-insensitive regex search for table, view, or column names.
  9. read_query: Safe SELECT queries returning structured JSON with row counts.
  10. execute_query: Executes DML / DDL statements with transaction commit/rollback and detailed error forwarding.
  11. explain_query: Generates EXPLAIN query execution plan.
  12. get_database_stats: Table sizes, row estimates, index sizes, and total database size.
  13. add_connection: Dynamically adds a new PostgreSQL or MySQL connection string at runtime.
  14. create_database: Creates a new database on the active server.
  15. drop_database: Safety-guarded DROP DATABASE (requires confirmName matching target name).
  16. clone_database: Fast database cloning using PostgreSQL TEMPLATE mechanism.
  17. terminate_connections: Terminates active connections to a specific database (PostgreSQL only).
  18. list_active_queries: Lists running queries, connection duration, and process IDs.
  19. dump_database: Dumps database to SQL file using native pg_dump or mysqldump.
  20. restore_database: Restores database from SQL dump file using native psql or mysql.

📦 Installation

pip install mcp-win-stdio-db

(Installing this package automatically installs mws CLI orchestrator).


🚀 One-Command Claude Setup

mws setup db
# or:
mws add db

Manual Configuration Example

In %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "db": {
      "command": "python",
      "args": ["-m", "mcp_win_stdio.db"],
      "env": {
        "SERVERS": "{\"postgres\":\"postgresql://postgres:password@localhost:5432/mydb\",\"mysql\":\"mysql://user:pass@localhost:3306/mydb\"}"
      }
    }
  }
}

📖 CLI Commands & Interactive Guide

mws db guide       # Complete tool reference & prompt recipes
mws db doctor      # Verify PostgreSQL/MySQL adapters and native dump tools
mws db setup       # Configure Claude Desktop / Claude Code
mws db run         # Launch server over stdio

📜 License

MIT License. Copyright (c) 2026 Mohan Kumar Indala.

Release files for mcp-win-stdio-db 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-win-stdio-db 0.2.4
File Size Uploaded
mcp_win_stdio_db-0.2.4.tar.gz 26.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-win-stdio-db 0.2.4
File Interpreter ABI Platform
mcp_win_stdio_db-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 55.4 kB

Release files / mcp_win_stdio_db-0.2.4.tar.gz

Download URL mcp_win_stdio_db-0.2.4.tar.gz
Size 26.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b9c7cbdd5b932cfb4543272de723631c62a9ae40805d87337e08a5b5028c599f
BLAKE2b-256 checksum
How to use checksums
c30a980ef5e855cc253917a597b4d518292d3fcdc7b20a0097f329062122f3fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / mcp_win_stdio_db-0.2.4-py3-none-any.whl

Download URL mcp_win_stdio_db-0.2.4-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e89a15d0a90eb766c5c4212892e390e1a9f162e57f6a6e178317257adb321419
BLAKE2b-256 checksum
How to use checksums
b7e48f1546ba0e4bc7ac1577a43f8f4f70afb9ad174dc9c534e35097050fbbf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page