pg-mcp-server

stuzero/pg-mcp-server

4.4

pg-mcp-server is hosted online, so all tools can be tested directly either in theInspector tabor in theOnline Client.

If you are the rightful owner of pg-mcp-server 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.

unknown

Try pg-mcp-server with chat:

Tools

Functions exposed to the LLM to take actions

connect

Register a database connection string and return its connection ID.

Args: connection_string: PostgreSQL connection string (required) ctx: Request context (injected by the framework)

Returns: Dictionary containing the connection ID

disconnect

Close a specific database connection and remove it from the pool.

Args: conn_id: Connection ID to disconnect (required) ctx: Request context (injected by the framework)

Returns: Dictionary indicating success status

pg_query

Execute a read-only SQL query against the PostgreSQL database.

Args: query: The SQL query to execute (must be read-only) conn_id: Connection ID previously obtained from the connect tool params: Parameters for the query (optional)

Returns: Query results as a list of dictionaries

pg_explain

Execute an EXPLAIN (FORMAT JSON) query to get PostgreSQL execution plan.

Args: query: The SQL query to analyze conn_id: Connection ID previously obtained from the connect tool params: Parameters for the query (optional)

Returns: Complete JSON-formatted execution plan

pg_metadata

Analyzes a SQL query and produces visualization metadata.

Args: conn_id: Connection ID previously obtained from the connect tool sql_query: The SQL query to analyze

Returns: JSON metadata about the query results structure

Prompts

Interactive templates invoked by user choice

No prompts

Resources

Contextual data attached and managed by the client

No resources