postgres-schema-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| DATABASE_URL | Yes | Connection string. Point it at the read-only role. | |
| PGSM_MAX_POOL | No | Connection pool size | 4 |
| PGSM_MAX_ROWS | No | Row cap on every result | 200 |
| PGSM_HTTP_HOST | No | Host to bind for HTTP mode. Defaults to 127.0.0.1 | 127.0.0.1 |
| PGSM_HTTP_PORT | No | Port for authenticated HTTP mode | |
| PGSM_MAX_BYTES | No | Size cap on every result, which is the one that protects the agent's context | 100000 |
| PGSM_TOKENS_FILE | No | Path to JSON file containing tokens for HTTP mode | |
| PGSM_REDACT_PATTERN | No | Regular expression matched against column names to redact values in results. Default covers common sensitive column names. | password|secret|token|ssn|credit_card|api_key|private_key |
| PGSM_ALLOWED_SCHEMAS | No | Comma-separated allowlist of schemas. Everything else becomes invisible. | all |
| PGSM_IDLE_TX_TIMEOUT_MS | No | Idle-in-transaction timeout | 15000 |
| PGSM_STATEMENT_TIMEOUT_MS | No | Per-statement timeout | 10000 |
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_schemasA | List the schemas in the database with how many tables and views each holds. Start here when you do not know the shape of the database yet. |
| list_tablesA | List the tables and views in one schema, largest first, with an estimated row count and total on-disk size. Use this to find out what is expensive before you query it. Row counts are planner estimates, not exact counts. |
| describe_tableA | Full description of one table: every column with its type, nullability and default, plus primary keys, foreign keys, unique and check constraints, indexes and any comments. This is the core tool once you know which table you want. |
| find_columnsA | Search for columns by name across every schema, optionally filtered by type. Use this instead of listing tables when the database is large: searching for "customer_id" finds every table that carries it in one call. |
| table_relationshipsA | Follow foreign keys from one table, in both directions, up to a given depth. Outbound keys tell you what a row points at; inbound keys tell you what points at it. Use this to work out how to join instead of guessing from column names. |
| sample_rowsA | Return the first few rows of a table so you can see the shape of the data. Columns whose names look like secrets are masked. Results are capped by row count and by size, and the response says when it truncated. |
| run_selectA | Run one SELECT or WITH statement. Anything else is refused, including stacked statements, DDL, DML and SELECT INTO. The query runs in a read-only transaction with a statement timeout, results are capped and secret-looking columns masked. There is no write mode. |
| explain_queryA | Show the query plan for a SELECT without running it. Pass analyze: true to execute it and get measured timings instead of estimates. Use this to tune a query before running it against a large table. |
| export_data_dictionaryA | Write a Markdown data dictionary for one schema to a file: every table, every column with type and nullability, and every key and constraint. Once written, you can read the schema from disk with no database connection. This is the only tool here that writes anything, and it writes only to the path you give 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 | |
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/eric-patton/postgres-schema-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server