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 (31 Tools)
- Polyglot Database Engine: Handles PostgreSQL (
psycopg2) and MySQL (pymysql) transparently side-by-side. - Entity-Relationship Diagrams (
generate_erd): Generates clean GitHub/Mermaid markdown ER diagrams from foreign key metadata. - Row-Level Data Diffing (
diff_data): Compares data across tables, schemas, or connections with column-by-column diffs. - Performance & Lock Auditing (
list_slow_queries,get_locks): Real-time blocking dependency trees and slow query analysis (pg_stat_statements/performance_schema). - Streaming Export & Batch Import (
export_table,import_csv): Streams tables/queries to CSV, JSON, or TSV on disk, and safely batch imports CSVs with transaction dry-run simulation. - Database Health & Schema Diff: Unindexed foreign keys, unused indexes, bloated tables with recommended SQL fixes (
audit_database_health,compare_schemas). - In-Memory Connection Pooling: Fast continuous queries with zero reconnection latency and persistent
use_databasesticky state. - Detailed Diagnostic Error Reporting: Native error codes (e.g. 23503 FK violation, 23505 unique violation), offending constraint names, and suggestions.
- DBA & Management Tools:
create_database,drop_database(with safety guard),clone_database(instant template clone),terminate_connections,dump_database, andrestore_database.
🛠️ Included Tools (31 Tools)
list_connections: Lists all active and configured database connections.use_database: Switches active connection or switches database on current server.list_databases: Lists all databases on the active server.list_schemas: Lists all schemas in the active PostgreSQL database.describe_table: Detailed schema inspection (columns, nullability, PKs, FKs, indexes). Auto-resolves cross-schema tables in PostgreSQL.schema_overview: Compact overview of all user tables and views.compact_schema_overview: Ultra-compact one-liner per table: schema.table (col: type PK, col2: FK->ref).get_table_sample: Returns sample rows and estimated row count with PII masking.search_schema: Case-insensitive regex search for table, view, or column names.get_table_ddl: Complete CREATE TABLE DDL reconstruction.get_database_stats: Table sizes, row estimates, index sizes, and total database size.read_query: Safe SELECT queries returning structured JSON with row counts.execute_query: Executes DML / DDL statements with transaction commit/rollback anddry_runsupport.explain_query: Generates EXPLAIN / EXPLAIN ANALYZE execution plan.list_active_queries: Lists running queries, connection duration, and process IDs.analyze_table_indexes: Table index analysis: PKs, missing FK indexes, unused indexes.compare_schemas: Schema diff between databases/schemas with generated migration SQL.audit_database_health: Unindexed FKs, unused indexes, bloated tables with SQL fixes.generate_erd: Entity-Relationship Diagram in GitHub/Mermaid markdown syntax from foreign keys.diff_data: Row-level data comparison with field-level diffs and key matching.list_slow_queries: Slow query analysis (pg_stat_statements/performance_schema).get_locks: Real-time blocking dependency trees and lock distributions.export_table: Streams table contents or SQL query results directly to CSV, JSON, or TSV on disk.import_csv: Batch imports CSV file into table with transaction safety and dry-run rollback.add_connection: Dynamically adds a new PostgreSQL or MySQL connection string at runtime.create_database: Creates a new database on the active server.drop_database: Safety-guarded DROP DATABASE (requiresconfirmNamematching target name).clone_database: Fast database cloning using PostgreSQL TEMPLATE mechanism.terminate_connections: Terminates active connections to a specific database.dump_database: Dumps database to SQL file using nativepg_dumpormysqldump.restore_database: Restores database from SQL dump file using nativepsqlormysql.
📦 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.
Metadata
Release files for mcp-win-stdio-db 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_win_stdio_db-0.2.5.tar.gz | 37.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_win_stdio_db-0.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.2 kB
Release files / mcp_win_stdio_db-0.2.5.tar.gz
| Download URL | mcp_win_stdio_db-0.2.5.tar.gz |
|---|---|
| Size | 37.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47d0f3f9d00052d2c4b78e9701936be0d50b20f58cceca4bc422d24dd690cd35
|
|
BLAKE2b-256 checksum How to use checksums |
0f716967ce435412656d801085495f1685fa7842b8377ca069a78ad86e54a883
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / mcp_win_stdio_db-0.2.5-py3-none-any.whl
| Download URL | mcp_win_stdio_db-0.2.5-py3-none-any.whl |
|---|---|
| Size | 39.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37cae2ea7c02f4611e037efa9163700a495a2cc4f3812ab53bee3ee56b43a544
|
|
BLAKE2b-256 checksum How to use checksums |
63eb2533cb62e42c6b1c11756eca52c949bfd7053a000fbb05c5b1634909c71d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for mcp-win-stdio-db 0.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.