postgres-mcp-server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PGHOST | No | Database host (used if not using DATABASE_URL) | |
| PGPORT | No | Database port (used if not using DATABASE_URL) | |
| PGUSER | No | Database user (used if not using DATABASE_URL) | |
| PGDATABASE | No | Database name (used if not using DATABASE_URL) | |
| PGPASSWORD | No | Database password (used if not using DATABASE_URL) | |
| DATABASE_URL | No | PostgreSQL connection string, e.g. postgresql://postgres:password@localhost:5432/mydb | |
| ALLOW_WRITE_QUERIES | No | Set to 'true' to enable write queries via execute_query. Defaults to false. | 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 | List all tables, views, and schemas in the PostgreSQL database along with estimated row counts and table sizes. |
| describe_tableA | Get detailed schema breakdown for a specific table or view, including column names, data types, constraints, primary keys, foreign keys, and indexes. |
| read_queryA | Execute a read-only SQL query (SELECT, WITH, etc.). Strictly executed inside a DB-level READ ONLY transaction for safety. |
| explain_queryA | Execute EXPLAIN on a SQL query to inspect query planner cost estimates, join strategies, and index usage. |
| get_db_statsA | Retrieve database health & performance metrics: database size, top tables by disk usage, active connections, and cache hit ratio. |
| execute_queryA | Execute data modification statements (INSERT, UPDATE, DELETE, DDL). Requires ALLOW_WRITE_QUERIES=true in environment. |
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/rajath002/postgres-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server