postgres-mcp-server

postgres-mcp-server

3.5
Certified
databases

A Model Context Protocol (MCP) server implementation for PostgreSQL database exploration and querying.

This project provides a Model Context Protocol (MCP) server that connects to a PostgreSQL database and exposes various data discovery and querying capabilities as MCP tools. These tools allow you to explore database structure, query data, and get database statistics through a standardized interface.

Features

  • Connect to any PostgreSQL database using a standard connection string
  • Execute custom SELECT queries with results returned in a structured format
  • List all tables in the connected database
  • Get detailed schema information for any table
  • Filter database records with simple equality conditions
  • Get database statistics including size, table count, and largest tables

Tools

  1. execute_query

    Execute a custom SELECT SQL query and return the results.

  2. list_tables

    List all tables in the current PostgreSQL database.

  3. get_table_schema

    Get the schema definition for a specified table.

  4. filter_instances

    Filter database records based on specified criteria.

  5. get_database_stats

    Get general statistics and metadata about the PostgreSQL database.