Skip to main content
Glama
hangdo-merkle

postgres-mcp

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
POSTGRES_CONNECTION_STRINGYesPostgreSQL connection string in libpq URI format, e.g. postgresql://user:password@host:5432/dbname

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

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
list_schemasA

List all schemas in the connected PostgreSQL database.

list_tablesA

List all tables (and views) in schema.

Args: schema: PostgreSQL schema name (default: "public").

describe_tableA

Show columns, data types, nullability, defaults, and constraints for a table.

Args: table: Table name. schema: Schema that owns the table (default: "public").

execute_queryA

Execute a read-only SQL query and return results as JSON.

The query must be a SELECT (or WITH … SELECT / EXPLAIN / SHOW / TABLE / VALUES). Mutating statements are rejected before they reach the database.

Args: sql: The SQL query to execute. limit: Maximum number of rows to return (default: 500, max: 5000).

get_table_sampleA

Return the first n rows of a table (ORDER BY primary key if available).

Args: table: Table name. schema: Schema name (default: "public"). n: Number of rows to return (default: 20, max: 500).

explain_queryA

Run EXPLAIN (or EXPLAIN ANALYZE) on a query and return the plan.

Args: sql: The SELECT query to explain. analyze: If True, actually executes the query to get runtime stats (EXPLAIN ANALYZE). Default: False (plan only, no execution).

list_functionsB

List user-defined functions and stored procedures in schema.

Args: schema: Schema name (default: "public").

get_database_infoA

Return general information about the connected PostgreSQL database: version, current database, current user, encoding, timezone, and top-level statistics.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4.1/5.0

Scored across 8 tools

Disambiguation5/5

Each tool targets a distinct aspect of database interaction: metadata discovery (schemas, tables, columns, functions), row retrieval (sample, query), and query analysis (explain, database info). The overlap between get_table_sample and execute_query is minimal because one is a convenience for a specific table while the other accepts arbitrary read-only SQL.

Naming Consistency5/5

All tools follow a consistent verb_noun snake_case convention, with list_* for metadata enumeration, get_* for specific retrievals, and execute_query/explain_query/describe_table for actions. There are no mixed casing styles or vague verbs.

Tool Count5/5

Eight tools is well-scoped for a PostgreSQL introspection and read-only query server. Each tool covers a meaningful capability without redundancy or bloat.

Completeness5/5

The tool surface covers the full read-only lifecycle: discovering schemas, tables, columns, functions, database info, sampling data, running arbitrary SELECTs, and explaining query plans. Since execute_query permits arbitrary read-only SQL, any remaining introspection gaps can be queried directly, so there are no dead ends.

Maintenance

ActivityMaintained
ResponsivenessNo issues