postgres-mcp-js
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| ACCESS_MODE | No | Access mode: restricted (read-only, 30s timeout) or unrestricted (full read/write). Default: restricted | restricted |
| DB_PRIMARY_URL | Yes | PostgreSQL connection URL for the primary database (required). Example: postgresql://user:password@localhost:5432/mydb | |
| DB_REPLICA_URL | No | PostgreSQL connection URL for a secondary database (optional) | |
| DB_PRIMARY_NAME | No | Alias for the primary database (default: primary) | primary |
| DB_REPLICA_NAME | No | Alias for the replica database (default: replica) | replica |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_databasesA | List configured database aliases. Use the returned names in the "database" parameter of other tools. |
| list_schemasA | List all schemas in the database. |
| list_objectsB | List tables, views, sequences, or extensions in a schema. |
| get_object_detailsC | Get columns, constraints, and indexes for a table or view. |
| execute_sqlA | Execute a read-only SQL query (SELECT, EXPLAIN, SHOW, WITH). Write operations are blocked. Max execution time: 30 seconds. |
| explain_queryA | Get the query execution plan. Supports hypothetical index simulation (requires hypopg extension). |
| get_top_queriesB | Report the slowest or most resource-intensive queries using pg_stat_statements. |
| analyze_db_healthB | Run comprehensive database health checks across multiple dimensions. |
| analyze_workload_indexesB | Analyze query workload from pg_stat_statements and recommend missing indexes. |
| analyze_query_indexesA | Analyze specific SQL queries and identify missing indexes. Maximum 10 queries. |
| detect_index_missesB | Detect tables likely suffering from missing indexes: seq-scan dominance, FK columns without indexes, under-indexed hot tables. |
| analyze_locksB | Detect lock contention: blocking chains, long-running queries, idle-in-transaction sessions. |
| analyze_table_bloatB | Detect table and index bloat from dead tuples. Returns vacuum recommendations. |
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
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/shubham4038/postgres-mcp-js'
If you have feedback or need assistance with the MCP directory API, please join our Discord server