postgres-mcp-readonly
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MAX_ROWS | No | Default maximum rows returned | 500 |
| AUDIT_LOG | No | Set to true to write JSON audit events to stderr | false |
| DATABASE_URL | No | Single PostgreSQL connection string (backward compatible). Example: postgres://user:pass@localhost:5432/dbname | |
| DATABASE_URLS | No | Multiple PostgreSQL URLs as alias=url pairs or JSON. Example: default=postgres://user:pass@localhost:5432/app,analytics=postgres://user:pass@localhost:5432/analytics | |
| MAX_STATEMENTS | No | Maximum semicolon-separated statements per multi-statement tool call | 10 |
| DEFAULT_DATABASE | No | Default alias used when tool input omits database | default |
| STATEMENT_TIMEOUT_MS | No | Query timeout in milliseconds | 5000 |
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
} |
| resources | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| db.databasesA | List configured database aliases and the currently selected default alias. |
| db.schemaB | Inspect database schema. Use mode='summary' for table list or mode='full' for columns and keys. |
| db.queryA | Run one or more read-only SELECT queries with optional row limits. Multi-statement calls are allowed for non-parameterized SELECT/WITH statements; parameterized queries must be single-statement. |
| db.validate_insertA | Validate one or more INSERT statements without executing them. Uses EXPLAIN without ANALYZE, so rows are never inserted. Parameterized validation must be single-statement. |
| db.validate_sqlB | Validate SELECT, INSERT, UPDATE, or DELETE statements without executing them by using EXPLAIN without ANALYZE. |
| db.explainA | Return PostgreSQL EXPLAIN plans for one or more SELECT/WITH statements without executing them. |
| db.table_infoA | Inspect one table's columns, indexes, constraints, foreign-key relationships, and triggers. |
| db.indexesA | List PostgreSQL indexes for all user tables or one table using table or schema.table name. |
| db.constraintsA | List constraints for all user tables or one table, including primary keys, foreign keys, unique constraints, and checks. |
| db.relationshipsA | List foreign-key relationships for all user tables or one table. |
| db.sample_valuesB | Return small distinct non-null sample values for selected columns in a table. |
| db.previewC | Preview rows from a table using table or schema.table name. |
| db.watchA | Fetch one incremental batch where cursorColumn > lastCursor. Repeat client-side for polling. |
| db.countA | Get exact row count for a table. Use table or schema.table name. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| schema-summary | Summary of tables and approximate row counts. |
| schema-full | Full schema including columns, primary keys, and foreign keys. |
TDQS
Scored across 14 tools
Most tools have clearly distinct purposes (querying, counting, previewing, explaining, validating). However, validate_insert is a subset of validate_sql, and table_info can duplicate indexes/constraints/relationships for a single table, creating minor confusion.
All tools use the same 'db.' prefix and snake_case, which is consistent. However, the second part mixes nouns (databases, schema, query) and verbs (validate_insert, explain, watch), so the pattern is not strictly verb_noun but still predictable.
14 tools is well within the ideal range for a dedicated read-only database server. Each tool addresses a distinct need without excessive redundancy, and the count feels appropriate for the scope.
The server covers all typical read-only operations: listing databases, inspecting schema, querying, counting, previewing, sampling, explaining, and validating writes without executing. It also includes incremental polling, making it a comprehensive surface for a read-only Postgres MCP server.