MCP-Server-postgres
If you are the rightful owner of MCP-Server-postgres and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The MCP PostgreSQL server provides a structured way to manage and interact with PostgreSQL databases using a model context protocol.
The MCP PostgreSQL server is designed to facilitate seamless interaction with PostgreSQL databases through a structured protocol. It includes a database connection class, auxiliary functions for data serialization, and primary database functions for listing tables, retrieving table information, querying tables, and executing custom SQL queries. The server also exposes these functionalities through MCP tools, allowing for easy API integration and usage.
Features
- Database Connection Management: Provides a class to manage connections to a PostgreSQL database, including methods to open and close connections.
- JSON Serialization: Includes a function to serialize special data types like datetime and Decimal to JSON format.
- Singleton Database Connection: Implements a singleton pattern to ensure a single global instance of the database connection.
- Comprehensive Table Information: Offers detailed information about database tables, including column details, primary keys, and row counts.
- Custom SQL Query Execution: Allows execution of custom SQL queries with optional parameters, returning results or affected row counts.
Tools
list_tables_tool
API entry point for listing available tables in the database.
get_table_info_tool
API entry point for retrieving detailed information about a specific table.
query_table_tool
API entry point for querying data from a specified table with an optional limit on the number of rows returned.
execute_query_tool
API entry point for executing custom SQL queries with optional parameters.