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. |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mahin1995/postgres-mcp-readonly'
If you have feedback or need assistance with the MCP directory API, please join our Discord server