postgres-readonly-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PGHOST | No | Database host. | |
| PGPORT | No | Database port (default 5432). | 5432 |
| PGUSER | No | Database user. | |
| PGSSLMODE | No | TLS mode: disable | require | verify-full. Defaults to disable. | disable |
| PGDATABASE | No | Database name. | |
| PGPASSWORD | No | Database password. | |
| DATABASE_URL | No | A single postgres://user:password@host:port/db connection string. Takes precedence over discrete fields. | |
| DB_DEFAULT_ENV | No | Which environment a tool call uses when it doesn't pass env explicitly. Required if more than one environment is configured and you want an implicit default. | |
| DB_ENVIRONMENTS | No | Comma-separated list of environment names for multiple databases. When set, per-environment variables DB_ENV_<NAME>_URL or DB_ENV_<NAME>_HOST/_PORT/_DATABASE/_USER/_PASSWORD/_SSLMODE must be provided for each environment. | |
| DB_MCP_LOG_LEVEL | No | Diagnostic log verbosity: debug | info | warn | error (default info). | info |
| PG_MAX_ROW_LIMIT | No | Maximum rows returned by run_query (default 500). | 500 |
| PG_MAX_CELL_LENGTH | No | Long text/jsonb cell values are truncated to this many characters (default 2000). | 2000 |
| PG_DEFAULT_ROW_LIMIT | No | Default rows returned by run_query (default 100). | 100 |
| PG_CONNECT_TIMEOUT_MS | No | Client-side connection timeout in milliseconds (default 10000). | 10000 |
| PG_STATEMENT_TIMEOUT_MS | No | Server-side statement timeout in milliseconds (default 15000). | 15000 |
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_environmentsA | List configured database environments (name and non-secret connection info, never credentials). Use the returned names as the |
| run_queryA | Run a read-only SQL query (SELECT, or WITH ... SELECT) against the database and return compact rows. Results are capped by PG_MAX_ROW_LIMIT. Any INSERT/UPDATE/DELETE/DDL/etc. is rejected before it reaches the database - this server is read-only. |
| list_schemasA | List schemas in the database. Excludes system schemas by default. Read-only. |
| list_tablesA | List tables and views in a schema (default: public). Read-only. |
| describe_tableA | Describe a table's columns (name, type, nullable, default, primary key) in a schema (default: public). Read-only. |
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 5 tools
Each tool has a clearly distinct purpose: listing environments, running queries, listing schemas, listing tables, and describing a table. There is no overlap in their intended use, and descriptions reinforce the boundaries.
All tool names follow a consistent snake_case verb_noun pattern: list_environments, run_query, list_schemas, list_tables, describe_table. The slight variation in verbs (list, run, describe) is appropriate and predictable.
Five tools are well-scoped for a read-only PostgreSQL server, covering environment discovery, query execution, and schema introspection without bloat or omission of core operations.
The surface covers essential read-only operations: environment listing, ad-hoc queries, schema/table listing, and column description. Minor gaps exist for more granular introspection (e.g., indexes, foreign keys, constraints), but agents can work around them with run_query.