Postgres MCP logo

Postgres MCP

未认领

作者:YawLabs

Read-only-by-default MCP server for PostgreSQL. Query, introspect schemas, explain plans, health checks.

01 / 选择客户端

02 / 连接前的准备

认证方式尚未指定。连接前请查看项目说明。

安装项目所需的运行环境,并确保客户端能够使用它。

项目说明

输入项目说明中的变量名,用逗号分隔。只输入名称,不要输入密钥值。

03 / 添加配置

来源:根据公开安装说明生成

claude mcp add --transport stdio 'yawlabs-postgres-mcp' -- 'npx' '-y' '@yawlabs/postgres-mcp@latest'

替换占位符后在终端中运行。

04 / 在客户端中确认

打开客户端的 MCP 设置,确认服务器已连接并列出工具。复制配置不代表连接成功。

更多Databases服务器

浏览完整目录

未认领列表

这个 MCP 服务器是你的吗?

此列表根据公开信息自动生成。认领后,你可以编辑页面、设置兼容性并解锁增长工具。全程不超两分钟。

认领此服务器

安全概况

已认领和已认证的服务器每周接受一次静态扫描,显示代码能触及的范围(外部服务、环境变量、shell 命令、代理配置目录)以及带有已知公告的依赖。认领此列表即可获得。 安全概况的工作原理

23 个工具中显示 23 个

文档中列出的工具 (23)

内容来自项目文档。服务器握手不会验证每个工具的说明或行为。

pg_advisor

Rolled-up DBA lints in one call: sequence-exhaustion candidates, wraparound risk for both counters (per-database and per-table age(relfrozenxid) against autovacuumfreezemaxage, and mxidage(relminmxid) against autovacuummultixactfreezemaxage -- a lock-heavy workload can exhaust multixacts while xids

pg_describe_table

Kind, columns, PK, outgoing FKs, incoming FKs (referencedby), CHECK / UNIQUE / EXCLUDE constraints, indexes, and partition parent/children for a relation. Generated and identity columns are flagged (generated, identity, generationexpression) so an agent doesn't try to write to them. Constraints carr

pg_explain

EXPLAIN or EXPLAIN ANALYZE for a SQL statement. Text or JSON output. Planner options: buffers (on by default with analyze), settings, verbose, wal, costs, timing, plus genericplan (PG16+, plan a parameterized query with no values) and memory / serialize (PG17+). Optional hypotheticalindexes (require

pg_health

Server version, database size, connections against maxconnections, active queries with wait events and transaction age, pgstatdatabase rollup (deadlocks, temp files, cache hit ratio), table count.

pg_index_advisor

Recommend indexes for a workload and prove each one pays for itself first. Takes statements you pass or the top N from pgstatstatements, harvests candidate columns from what the planner reports as filters / join keys / sort keys (no SQL parser - every token is intersected with the real pgattribute c

pg_inspect_locks

Who is blocking whom right now (blocked PID, blocker PID, lock type, queries).

pg_io_stats

I/O observability: pgstatio read/write/extend/fsync counts, bytes and times per backend type and context (PG16+), plus in-flight async I/O handles from pgaios and the active iomethod (PG18+).

pg_kill

Cancel a running query or terminate a backend connection. Requires ALLOWWRITES=1.

pg_list_extensions

List installed extensions (pgvector, postgis, pgstatstatements, etc.) with versions.

pg_list_functions

List functions, procedures, and aggregates in a schema with signatures and return types.

pg_list_roles

Database roles with login/superuser/createdb flags and group memberships.

pg_list_schemas

List non-system schemas.

pg_list_tables

List tables (and optionally views) in a schema with estimated row counts. Paginated via limit/offset.

pg_list_views

List views and materialized views in a schema, including their SQL definitions.

pg_query

Run a SQL query. Writes gated by the role in DATABASEURL first, ALLOWWRITES second. Supports parameterized queries via params. Result fields include dataTypeName (e.g. int4, jsonb) alongside dataTypeID.

pg_readonly

Run a SQL statement with no persistent data changes - always inside BEGIN READ ONLY, regardless of ALLOWWRITES. The recommended tool for read access, and the one to auto-allow; pair it with a least-privileged role (why).

pg_replication_status

Replication slots, connected replicas, and current WAL position.

pg_search_columns

Find columns by name pattern across all user schemas. Case-insensitive, supports SQL LIKE wildcards.

pg_seq_scan_tables

Tables with heavy sequential scans - missing-index candidates. Returns the statsreset window alongside the rows, since the counters mean nothing without it. lastseqscan / lastidxscan on PG16+.

pg_table_bloat

Tables with high dead-tuple ratios - VACUUM candidates.

pg_table_privileges

Who has SELECT/INSERT/UPDATE/DELETE/etc. on a table or whole schema.

pg_top_queries

Top N queries by total/mean execution time. Requires the pgstatstatements extension. Returns statsreset (from pgstatstatementsinfo, a different clock from the other stats tools) and dealloc on extension 1.9+ - a non-zero dealloc means entries were evicted past pgstatstatements.max, so the ranking is

pg_unused_indexes

Non-unique, non-primary indexes with low scan counts - drop candidates. Also returns statsreset: a recently reset counter makes every index look unused, which is how a load-bearing index gets dropped. lastidxscan on PG16+.

工具变更历史

比较相同配置的完整检查。只列出工具,未调用工具。此处不测量输入结构的变化。

尚无完整工具检查。