mcp_server_postgres

mcp_server_postgres

3.2

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.

A Model Context Protocol (MCP) server for PostgreSQL databases with enhanced capabilities for AI agents.

PG-MCP is a server implementation of the Model Context Protocol for PostgreSQL databases. It provides a comprehensive API for AI agents to discover, connect to, query, and understand PostgreSQL databases through MCP's resource-oriented architecture. This implementation builds upon and extends the reference Postgres MCP implementation with several key enhancements, including full server implementation with SSE transport, multi-database support, rich catalog information, extension context, query explanation, and robust connection management.

Features

  • Connection Management: Efficient management of database connections with tools for connecting, disconnecting, and pooling.
  • Query Tools: Includes tools like pg_query for executing read-only SQL queries and pg_explain for analyzing query execution plans.
  • Schema Discovery Resources: Provides detailed schema information including schemas, tables, columns, constraints, and indexes.
  • Data Access Resources: Allows sampling of table data with pagination and provides approximate row counts.
  • Extension Context: Built-in contextual information for PostgreSQL extensions like PostGIS and pgvector.

Tools

  1. connect

    Register a PostgreSQL connection string and get a secure connection ID.

  2. disconnect

    Explicitly close database connections when done.

  3. pg_query

    Execute read-only SQL queries using a connection ID.

  4. pg_explain

    Analyze query execution plans in JSON format.