PostgreSQL MCP Server API Reference¶
Production-ready PostgreSQL MCP server for secure database access with configurable authentication, read-only mode, SSH tunneling, and comprehensive query capabilities using FastMCP and SQLAlchemy
This reference provides detailed information about all available tools and their parameters.
Available Tools¶
list_databases¶
Description: List all databases on the PostgreSQL server
Parameters: No parameters required
Example Usage:
list_schemas¶
Description: List all accessible database schemas for a given database
Parameters:
database(string) (required): Database name to list schemas from
Example Usage:
list_tables¶
Description: List tables in a specific schema
Parameters:
schema(string) (optional): Schema name to list tables from
Example Usage:
describe_table¶
Description: Get detailed schema information for a table
Parameters:
table(string) (required): Table name to describeschema(string) (optional): Schema name containing the table
Example Usage:
list_columns¶
Description: List columns in a specific table
Parameters:
table(string) (required): Table name to list columns fromschema(string) (optional): Schema name containing the table
Example Usage:
execute_query¶
Description: Execute a SQL query against PostgreSQL (subject to read-only restrictions)
Parameters:
query(string) (required): SQL query to executelimit(integer) (optional): Maximum number of rows to return (optional)
Example Usage:
explain_query¶
Description: Get query execution plan for a SQL query
Parameters:
query(string) (required): SQL query to explain
Example Usage:
get_database_info¶
Description: Get information about the PostgreSQL database
Parameters: No parameters required
Example Usage:
get_table_stats¶
Description: Get statistics for a specific table
Parameters:
table(string) (required): Table name to get statistics forschema(string) (optional): Schema name containing the table
Example Usage:
list_indexes¶
Description: List indexes for a specific table
Parameters:
table(string) (required): Table name to list indexes forschema(string) (optional): Schema name containing the table
Example Usage:
list_constraints¶
Description: List constraints for a specific table
Parameters:
table(string) (required): Table name to list constraints forschema(string) (optional): Schema name containing the table
Example Usage:
test_connection¶
Description: Test the database connection
Parameters: No parameters required
Example Usage:
get_connection_info¶
Description: Get information about the current database connection
Parameters: No parameters required
Example Usage:
Integration Examples¶
For more integration examples and usage patterns, see the Usage Guide.
Support¶
For questions and issues related to the PostgreSQL MCP Server, please refer to: - Usage Guide for comprehensive examples - Template Overview for setup and configuration - MCP Platform Documentation for general platform usage