pg-readonly-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| DATABASE_URL | Yes | PostgreSQL connection URL. Required. | |
| PG_MCP_SCHEMAS | No | Comma-separated schemas the assistant may read. | public |
| PG_MCP_MAX_ROWS | No | Hard cap per query. | 200 |
| PG_MCP_REDACT_COLUMNS | No | Regular expression for masked result columns. | password\|passwd\|secret\|token\|api_?key\|ssn\|iban\|credit_?card |
| PG_MCP_STATEMENT_TIMEOUT_MS | No | Per-statement timeout in milliseconds. | 5000 |
| PG_MCP_ALLOW_EXPLAIN_ANALYZE | No | Whether EXPLAIN ANALYZE is allowed. EXPLAIN ANALYZE executes the query. | false |
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 | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_tablesA | Lists tables and views with their kind, approximate row count, total size and comment. |
| describe_tableB | Columns (type, nullability, default, comment), primary key, foreign keys, unique and check constraints, and indexes of one table. |
| run_queryA | Runs one SELECT (WITH, VALUES, UNION allowed) in a read-only transaction with a time limit and returns at most 200 rows. Writes, DDL, locking clauses, system catalogs and side-effecting functions are refused with an explanation. |
| explain_queryA | Shows the PostgreSQL execution plan of a SELECT with a summary (node types, sequential scans, index suggestions). analyze=true executes the query and is only available if the server enables it. |
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 4 tools
Each tool has a clearly distinct purpose: listing relations, describing one relation, executing a read-only SELECT, and explaining a SELECT plan. run_query and explain_query could superficially overlap, but the descriptions make the execution-vs-plan boundary explicit.
All tool names follow a consistent snake_case verb_noun pattern: list_tables, describe_table, run_query, explain_query. The convention is predictable and readable.
Four tools is well-scoped for a read-only PostgreSQL introspection/query server. Each tool earns its place and the surface avoids unnecessary breadth.
The core read-only workflow is covered: discover tables, inspect table structure, run ad-hoc SELECTs, and inspect query plans. Minor gaps exist around listing schemas, functions, or server-level metadata, but agents can work around these with run_query.