edelciomolina avatar

Postgres MCP

edelciomolina/postgres-mcp

A PostgreSQL MCP server that keeps database credentials out of your config files by reading them from .env at runtime. It maps any variable names you want through MCP_KEY_* environment variables, so you can use DATABASE_URL from Supabase or DB_HOST from Railway without changing your existing setup. Ships read-only by default with introspection tools only. Write operations like pg_manage_schema or pg_manage_indexes require explicit opt-in via tool= arguments and a POSTGRES_MCP_ALLOW_WRITE flag. Works via npx without installation, which makes it fast to try against a staging database or add to a team project without package.json changes.

GitHub stars
5
tools
20
transport
STDIO
env vars
6
last updated
Jun 11, 2026

Tools

20 tools

Public tool metadata for what this MCP can expose to an agent.

pg_execute_querySELECT / COUNT / EXISTS with write and multi-statement guards

SELECT / COUNT / EXISTS with write and multi-statement guards

No parameter schema in public metadata yet.

pg_manage_queryEXPLAIN plans, slow query analysis, `pg_stat_statements`

EXPLAIN plans, slow query analysis, `pg_stat_statements`

No parameter schema in public metadata yet.

pg_inspect_schemaSchema info and ENUM types (read-only introspection)

Schema info and ENUM types (read-only introspection)

No parameter schema in public metadata yet.

pg_get_setup_instructionsSetup instructions per platform

Setup instructions per platform

No parameter schema in public metadata yet.

pg_analyze_databasePerformance, configuration, and storage analysis

Performance, configuration, and storage analysis

No parameter schema in public metadata yet.

pg_monitor_databaseReal-time monitoring of connections, queries, locks, and replication

Real-time monitoring of connections, queries, locks, and replication

No parameter schema in public metadata yet.

pg_debug_databaseDiagnose connections, locks, performance, and replication

Diagnose connections, locks, performance, and replication

No parameter schema in public metadata yet.

pg_inspect_database_graphBuild a full knowledge graph of the database: schemas, tables, columns, FKs, indexes, inferred relations, and business domains

Build a full knowledge graph of the database: schemas, tables, columns, FKs, indexes, inferred relations, and business domains

No parameter schema in public metadata yet.

pg_describe_table_semanticsDescribe a table with semantic context: risk level, column roles, sensitive columns, and related tables

Describe a table with semantic context: risk level, column roles, sensitive columns, and related tables

No parameter schema in public metadata yet.

pg_find_related_tablesFind tables related to a given table via explicit FKs and inferred naming patterns, with path explanation

Find tables related to a given table via explicit FKs and inferred naming patterns, with path explanation

No parameter schema in public metadata yet.

pg_classify_query_riskClassify query risk (`safe` / `warning` / `review` / `blocked`) without executing it

Classify query risk (`safe` / `warning` / `review` / `blocked`) without executing it

No parameter schema in public metadata yet.

pg_manage_schemaSchema info, create/alter tables, manage ENUMs

Schema info, create/alter tables, manage ENUMs

No parameter schema in public metadata yet.

pg_manage_indexesList, create, drop, reindex, analyze index usage

List, create, drop, reindex, analyze index usage

No parameter schema in public metadata yet.

pg_manage_constraintsList, create, and drop constraints and foreign keys

List, create, and drop constraints and foreign keys

No parameter schema in public metadata yet.

pg_manage_functionsList, create, and drop functions and procedures

List, create, and drop functions and procedures

No parameter schema in public metadata yet.

pg_manage_triggersList, create, drop, enable/disable triggers

List, create, drop, enable/disable triggers

No parameter schema in public metadata yet.

pg_manage_rlsRow-Level Security policies

Row-Level Security policies

No parameter schema in public metadata yet.

pg_manage_usersUser permissions, create/drop/alter users, grant/revoke

User permissions, create/drop/alter users, grant/revoke

No parameter schema in public metadata yet.

pg_execute_mutationINSERT / UPDATE / DELETE / UPSERT with parameterized queries

INSERT / UPDATE / DELETE / UPSERT with parameterized queries

No parameter schema in public metadata yet.

pg_execute_sqlArbitrary SQL execution with optional transaction support

Arbitrary SQL execution with optional transaction support

No parameter schema in public metadata yet.

Sponsors

Configuration

MCP_KEY_HOST

Name of the .env variable that holds the database host

MCP_KEY_PORT

Name of the .env variable that holds the database port

MCP_KEY_NAME

Name of the .env variable that holds the database name

MCP_KEY_USER

Name of the .env variable that holds the database user

MCP_KEY_PASS

Name of the .env variable that holds the database password

MCP_KEY_SSLMODE

Name of the .env variable that holds the SSL mode (e.g. require)

Readme

English | 🌐 Português

Postgres MCP Icon

Postgres MCP

🔌 Native MCP server for PostgreSQL - reads credentials from .env at runtime with flexible key mapping, configurable tool selection, and read-only mode by default.

npm version license CI

✨ What it does


View the full README on GitHub

Details

Repository
github.com/edelciomolina/postgres-mcp
Category
Databases
Package
@edelciomolina/postgres-mcp
Transport
STDIO
Registry
MCP registry, active

Related Databases MCP servers

View all
1planetscale avatarPlanetScaleplanetscale/mcp-serverConnect to PlanetScale databases, branches, schema, query insights, and execute SQL0stars
2bluwork avatarPostgres Scout Mcpbluwork/postgres-scout-mcpScout your PostgreSQL databases with AI - safety features, monitoring, and data quality0stars
3daedalus avatarMcp Mysql Connectordaedalus/mcp-mysql-connectorMCP server exposing MySQL database functionalities as tools0stars
4itunified-io avatarPostgreSQL MCP Serveritunified-io/mcp-postgresPostgreSQL MCP Server — 27 tools for queries, schema, CRUD, DBA, HA & server management0stars
5rog0x avatarDatabaserog0x/mcp-database-toolsSQL formatting, schema visualization, migration generation0stars
6musaddiq-dev avatarPostgreSQL MCP Servermusaddiq-dev/postgresql-mcp-serverPython MCP server for PostgreSQL database inspection and querying0stars