Skip to main content
Glama
amar141989-dev

readonly-postgres-mcp

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PG_SSLNoEnable SSL connectionfalse
PG_HOSTNoPostgreSQL server host
PG_PORTNoPostgreSQL server port5432
PG_DATABASENoDatabase name
PG_MAX_ROWSNoMaximum rows returned by queries10000
PG_PASSWORDNoDatabase password
PG_USERNAMENoDatabase user with readonly access
PG_SEARCH_PATHNoSchema search pathpublic
PG_MCP_ALLOW_ADHOCNoAllow ad-hoc SQL queries (true/false)true
PG_STATEMENT_TIMEOUT_MSNoStatement timeout in milliseconds30000

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
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
pg_query_sqlA

Run a single read-only SQL query against a PostgreSQL database.

Only SELECT, WITH and EXPLAIN are permitted. Writes and DDL (INSERT, UPDATE, DELETE, MERGE, COPY, CREATE, DROP, ALTER, TRUNCATE) are rejected before reaching the database, as are data-modifying CTEs.

Exactly one statement per call — do not send two statements separated by a semicolon. A single trailing semicolon is fine.

Results are capped at 1000 rows and 15s. The response reports "truncated": true when more rows matched than were returned, and "rowCount" is the number of rows returned, not the number matched — use a COUNT(*) query if you need the true total.

Pass literals through "values" as $1, $2 placeholders rather than building them into the SQL string.

bigint and numeric columns are returned as JSON strings, not numbers.

Use pg_describe to discover tables and columns instead of guessing at names.

EXPLAIN ANALYZE is rejected by default because it executes the statement it explains; plain EXPLAIN always works.

pg_describeA

Inspect the database schema.

Call with no arguments to list the tables, views and materialized views in the configured search path, with their estimated row counts and comments. Call with "table" to list that relation's columns, types, nullability, defaults, primary keys and comments.

Prefer this over querying information_schema by hand: it is faster and reports partitioned tables and comments correctly.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4.3/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have completely distinct purposes: pg_query_sql executes read-only queries while pg_describe inspects schema metadata. There is no realistic scenario where an agent would confuse the two, and the descriptions even cross-reference each other (use pg_describe before pg_query_sql).

Naming Consistency4/5

Both names use a consistent 'pg_' prefix and snake_case, which reads well as a set. The second segments differ structurally (query_sql is verb+format while describe is a bare verb), a minor deviation from a strict verb_noun pattern.

Tool Count4/5

Two tools is minimal but justified for a deliberately read-only server whose entire surface is 'run a query' and 'inspect the schema'. It does not feel arbitrarily thin given the narrowly scoped purpose, though there is little room to grow.

Completeness4/5

Query execution plus schema discovery covers the core read-only lifecycle (explore schema, then query it). Minor gaps remain, such as no dedicated pagination/offset helper or multi-statement/session tooling, but row caps and the 'truncated' flag give agents workable paths.

Maintenance

ActivityMaintained
ResponsivenessNo issues