postgres

v1.0.8
io.github.marcelo-ochoa/postgres Checked 1 day ago Published 8 months ago

MCP server for interacting with PostgreSQL databases

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

pg-query

This tool executes SQL queries in a READ ONLY session connected to a PostgreSQL database. If no active connection exists, it uses MCP server registration argument and environment variables PG_USER and PG_PASSWORD. You should: Execute the provided SQL query. Return the results in Toon format. Args: sql: The SQL query to execute. The `model` argument should specify only the name and version of the LLM (Large Language Model) you are using, with no additional information. The `mcp_client` argument should specify only the name of the MCP (Model Context Protocol) client you are using, with…

ParameterTypeDescription
mcp_client *stringSpecify the name and version of the MCP client implementation being used (e.g. Copilot, Claude, Cline...)
model *stringThe name (and version) of the language model being used by the MCP client to process requests (e.g. gpt-4.1, claude-sonnet-4, llama4...)
sql *stringThe SQL query to execute

pg-stats

Get comprehensive statistics for a specific PostgreSQL table. This tool retrieves detailed information including row counts, table size, index information, column statistics, and other metadata that can help optimize queries and understand data distribution. Args: name: The name of the table to get statistics for. The `model` argument should specify only the name and version of the LLM (Large Language Model) you are using, with no additional information. The `mcp_client` argument should specify only the name of the MCP (Model Context Protocol) client you are using, with no additional info…

ParameterTypeDescription
name *stringThe name of the table to get statistics for
mcp_clientstringSpecify the name and version of the MCP client implementation being used (e.g. Copilot, Claude, Cline...)
modelstringThe name (and version) of the language model being used by the MCP client to process requests (e.g. gpt-4.1, claude-sonnet-4, llama4...)

pg-explain

Generate and display the execution plan for a given SQL query using PostgreSQL's EXPLAIN command. This tool helps you understand how PostgreSQL will execute your query, including information about table scans, joins, indexes used, and estimated costs. Args: sql: The SQL query to explain. The `model` argument should specify only the name and version of the LLM (Large Language Model) you are using, with no additional information. The `mcp_client` argument should specify only the name of the MCP (Model Context Protocol) client you are using, with no additional information. Returns: Detail…

ParameterTypeDescription
mcp_client *stringSpecify the name and version of the MCP client implementation being used (e.g. Copilot, Claude, Cline...)
model *stringThe name (and version) of the language model being used by the MCP client to process requests (e.g. gpt-4.1, claude-sonnet-4, llama4...)
sql *stringThe SQL query to explain

pg-connect

Provides an interface to connect to a specified PostgreSQL database. If a database connection is already active, the tool will close the existing connection before establishing a new one. This tool accepts three required parameters: connectionString: The PostgreSQL connection string without embedded credentials (e.g., postgresql://host:port/dbname or host:port/dbname). To enable encryption (SSL), append ?sslmode=require to the connection string. user: The PostgreSQL username password: The PostgreSQL password The credentials are stored in environment variables PG_USER and PG_PASSWORD for…

ParameterTypeDescription
connectionString *stringThe PostgreSQL connection string (e.g. postgresql://host:port/dbname or host:port/dbname)
password *stringThe PostgreSQL password
user *stringThe PostgreSQL user (e.g. postgres)
mcp_clientstringSpecify the name and version of the MCP client implementation being used (e.g. Copilot, Claude, Cline...)
modelstringThe name (and version) of the language model being used by the MCP client to process requests (e.g. gpt-4.1, claude-sonnet-4, llama4...)

pg-awr

Generate a PostgreSQL performance report similar to Oracle AWR. Includes database statistics, top queries (requires pg_stat_statements extension), table/index statistics, connection info, and optimization recommendations.

ParameterTypeDescription
mcp_clientstringSpecify the name and version of the MCP client implementation being used (e.g. Copilot, Claude, Cline...)
modelstringThe name (and version) of the language model being used by the MCP client to process requests (e.g. gpt-4.1, claude-sonnet-4, llama4...)