mcp-postgres-query
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| DATABASE_URL | Yes | PostgreSQL connection string, e.g., postgresql://user:password@localhost:5432/mydb |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| queryB | Execute a SQL query against the PostgreSQL database. Supports parameterized queries for safety. Returns rows and row count. |
| list_tablesA | List all tables in the public schema of the connected database. Returns table names, types (BASE TABLE or VIEW), and the schema they belong to. |
| describe_tableA | Get detailed column information for a table: column name, data type, nullable, default value, character max length, and ordinal position. |
| list_indexesA | List all indexes on a given table, including index name, whether it is unique, and the index definition. |
| explain_queryA | Get the EXPLAIN ANALYZE execution plan for a SQL query. The query runs inside a transaction that is always rolled back, so it never modifies data. |
| get_table_statsA | Get statistics for a table: estimated row count (from pg_stat), live/dead tuples, last vacuum/analyze times, and total disk size. |
| get_db_infoA | Get an overview of the connected database: PostgreSQL version, database name, total size on disk, number of tables, and current connection info (user, host, port). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 7 tools
Each tool has a distinctly different purpose: query executes SQL, list_tables lists tables, describe_table shows columns, list_indexes shows indexes, explain_query shows execution plans, get_table_stats shows table statistics, and get_db_info shows database overview. There is no functional overlap.
Most tools follow a clear verb_object pattern (list_tables, describe_table, get_table_stats) with consistent lowercase snake_case. The sole deviation is 'query', which is a single verb without an explicit object, but it is still understandable and fits the server's purpose.
With 7 tools, the server is well-scoped for its purpose. It covers querying, schema inspection, and database metadata without being bloated or sparse. This is an ideal size for a PostgreSQL query-focused MCP server.
The tool set covers core database operations: executing queries, exploring tables and columns, inspecting indexes, and retrieving performance statistics. Minor gaps exist, such as missing explicit list_schemas or list_functions tools, but these are easily worked around using the query tool, and the overall surface is sufficient for most tasks.