analyze_databaseLABSCO SUMMARY
The tool count came down on purpose, and it shows.
The consolidation is the interesting design decision: rather than a tool per operation, crud_get and crud_delete take a mode, which keeps the catalog small enough to stay in context without losing capability. The other half worth planning around is that this writes — crud_delete in drop mode destroys a table — so the database role you connect with is the real boundary. Pair transaction_backup_table with anything destructive.
What it is
A PostgreSQL server built around two jobs: working out what an unfamiliar database actually contains, and then operating on it. Schema extraction is deterministic; the explanation layer is optional and runs through a local Ollama model. It carries 27 tools spanning analysis, CRUD, schema modification, query optimisation, import and export, transactions and monitoring.
What you get
- Schema understanding first —
analyze_databasereturns the full structure plus detected junction tables, implicit relationships, join suggestions, PlantUML ER, class and component diagrams and Markdown documentation;get_table_detailsdoes the same for one table;render_database_diagramswrites them out as SVG, PNG or PDF explain_databaseadds a business explanation and quality recommendations through a local LLM, andget_database_infofolds table listing, service status and quick statistics into one call- Reads that consolidate rather than multiply —
crud_queryfor raw parameterised SQL,crud_getwith amodeof records, count, distinct or paginate - Writes with the same shape —
crud_insertdetects single versus batch from the payload,crud_updatecovers single, batch and column updates,crud_deletehandles records, truncate and drop,crud_renamecovers tables and columns - Schema work —
crud_create_table,crud_create_view,crud_create_index, plusmod_column,mod_index,mod_constraint,mod_add_constraintandmod_viewfor listing and dropping - Performance tools —
query_explainfor estimated or actual plans,query_analyze_indexesto suggest missing indexes and find unused ones in the same call - Data movement and search —
data_exportto CSV, JSON or SQL inserts,data_importwith a conflict action,data_searchwith case-insensitive, case-sensitive or fuzzy matching transaction_executeruns several statements atomically with rollback,transaction_backup_tablesnapshots a table and returns the restore SQL, andmonitoring_database_statscovers size, connections, cache hit ratio, slow queries and locks
Requirements
Python 3.11 or higher, uv, and a PostgreSQL database. Connection settings go in a .env as DB_HOST, DB_PORT, DB_NAME, DB_USER and DB_PASSWORD. The AI explanation path is optional and needs an Ollama server, configured through OLLAMA_BASE_URL and OLLAMA_MODEL. Start it with uv run postgresql_server.py. Every operation uses parameterised queries with table and column name validation.
Setup effort
Build from source — git clone https://github.com/prasanna00019/MCP-ToolHub
USE CASES
Making sense of a database nobody documented
Get the structure, the implicit relationships and rendered ER diagrams from one call.
Finding out why a query is slow
Read the actual execution plan, then check whether an index is missing or an existing one is unused.
Changing several rows without leaving a mess
Snapshot the table first, then run the statements atomically so a failure rolls the whole thing back.
Moving data in or out
Export a filtered slice to CSV or JSON, or import a file with a conflict rule you choose.
Checking on a database that feels unwell
Read size, connections, cache hit ratio, slow queries and locks in one place.
27 tools
Listed in project docs. Your client may show a different list.
explain_databaseget_table_detailsget_database_inforender_database_diagramscrud_insertcrud_create_tablecrud_create_viewcrud_create_indexcrud_querycrud_getcrud_updatecrud_renamecrud_deletemod_columnmod_indexmod_constraintmod_add_constraintmod_viewquery_explainquery_analyze_indexesdata_exportdata_importdata_searchtransaction_executetransaction_backup_tablemonitoring_database_statsBEFORE YOU INSTALL
What to know first
Tools you get
27 tools named in the project's documentation.
Requires
- uv
- Python 3.11+
- A PostgreSQL database
- DB_PASSWORD in your environment
INSTALLATION
Connect your client
This one is built from source rather than installed with a single command.
Server setup
git clone https://github.com/prasanna00019/MCP-ToolHub
cd MCP-ToolHub/PostgreSQL-MCP
uv sync
uv run postgresql_server.pyBefore starting it, create a .env in PostgreSQL-MCP with DB_HOST, DB_PORT, DB_NAME, DB_USER and DB_PASSWORD (OLLAMA_BASE_URL and OLLAMA_MODEL only for the optional explanation tool). The README publishes no client configuration: add a stdio server that runs uv run postgresql_server.py from that folder, in your client's own format.