{"$schema":"https://wellknown.network/schemas/agent-record-v1.json","schemaVersion":"1","id":"ag_f43z2u8ss4bp","handle":"postgresql-mcp-server-2","url":"https://wellknown.network/agents/postgresql-mcp-server-2","links":{"self":"https://wellknown.network/agents/postgresql-mcp-server-2/record.json","html":"https://wellknown.network/agents/postgresql-mcp-server-2","markdown":"https://wellknown.network/agents/postgresql-mcp-server-2/record.md","api":"https://wellknown.network/api/v1/agents/postgresql-mcp-server-2","status":"https://wellknown.network/api/v1/agents/postgresql-mcp-server-2/status","claim":"https://wellknown.network/agents/postgresql-mcp-server-2/claim","claimApi":"https://wellknown.network/api/v1/claims","claimDescriptor":"https://wellknown.network/agents/postgresql-mcp-server-2/claim.json","badge":"https://wellknown.network/agents/postgresql-mcp-server-2/badge.svg","openapi":"https://wellknown.network/openapi.json"},"ard":{"identifier":"urn:air::server:postgresql-mcp-server-2","type":"application/mcp-server-card+json"},"kind":"mcp_server","declared":{"name":"postgresql-mcp-server","summary":"PostgreSQL Model Context Protocol (MCP) server","description":"# PostgreSQL MCP Server \n \n[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/) \n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) \n[![uv](https://img.shields.io/badge/managed%20by-uv-5C2D91.svg)](https://github.com/astral-sh/uv) \n[![MCP](https://img.shields.io/badge/MCP-FastMCP-green.svg)](https://modelcontextprotocol.io/) \n \n一个面向 PostgreSQL 的 Model Context Protocol (MCP) 服务。它基于 FastMCP 和 psycopg 构建，通过环境变量连接 PostgreSQL server，并以 **database + schema 双层白名单** 控制 MCP 客户端可以访问的范围。 \n \nPostgreSQL 的访问层级是： \n \n```text \nPostgreSQL server / cluster \n└── database \n    └── schema \n        └── table / view / index / function ... \n``` \n \n因此本服务的当前上下文也是： \n \n```text \ncurrent_database + current_schema \n``` \n \n切换 database 时会重新建立连接；切换 schema 时会在当前 database 内设置 `search_path`。 \n \n## 功能特性 \n \n- 🚀 **面向 PostgreSQL server 的多 database 访问**：允许在配置白名单内切换 database。 \n- 🗂️ **database + schema 双层白名单**：每个 database 都有独立的 schema 白名单。 \n- 🔐 **安全的 search_path 设置**：使用 psycopg 的 `Identifier` 处理 schema 名，避免手写拼接风险。 \n- 🧰 **清晰的 MCP 工具前缀**：所有工具均以 `pg_` 开头，便于和其他 MCP 服务共存。 \n- 👁️ **只读模式**：设置 `POSTGRES_READ_ONLY=true` 后，仅允许 `SELECT`、`WITH`、`EXPLAIN`、`SHOW`。 \n- 🛡️ **SQL 安全审计**：阻止多语句、注释注入、跨 schema 访问、权限变更、函数/过程/触发器/扩展等高风险操作。 \n- 📚 **常用元数据工具**：支持列出 database、schema、表，描述表结构，统计表数量。 \n- 📄 **分页查询**：`pg_execute_sql` 对 `SELECT/WITH` 支持 `limit` 和 `offset`。 \n \n## 工具列表 \n \n| 工具 | 说明 | \n| :-- | :-- | \n| `pg_test_connection` | 测试当前 database + schema 上下文是否可连接。 | \n| `pg_get_current_context` | 返回当前 database、schema、允许的 database、当前 database 下允许的 schema。 | \n| `pg_list_databases` | 列出配置允许访问的 database，并标记当前 database。 | \n| `pg_switch_database` | 切换当前 database，可选同时切换目标 database 下的 schema。 | \n| `pg_list_schemas` | 列出指定 database 或当前 database 中可见的非系统 schema。 | \n| `pg_switch_schema` | 在当前 database 内切换当前 schema。 | \n| `pg_execute_sql` | 在当前上下文执行 SQL。查询返回 `data` 和 `count`，写入返回 `affected_rows`。 | \n| `pg_list_tables` | 列出指定 database/schema 或当前上下文下的表和视图。 | \n| `pg_d…","publisher":null,"homepage":null,"repository":null,"version":"1.1.1","license":null,"protocols":["mcp"],"tags":["postgresql","postgres","database","mcp","model-context-protocol"],"pricing":null,"endpoints":[{"url":"pypi:postgresql-mcp-server","type":"package_pypi","auth":null,"probeable":false}],"skills":null,"tools":null,"extra":null,"attribution":{"kind":"pypi","name":"pypi","summary":"pypi","version":"pypi","description":"pypi"}},"derived":{"capabilities":[{"slug":"data.database","name":"Databases","confidence":1,"provenance":"declared"}],"categories":["data"],"language":"fr"},"observed":{"status":"unknown","statusReason":"Distributed as a package to run locally; no network endpoint to check.","lastOkAt":null,"lastProbedAt":null,"statusComputedAt":null,"reliability30d":null,"latestObservations":[],"tools":null,"package":{"name":"postgresql-mcp-server","registry":"pypi","observedAt":"2026-09-10T10:25:31.952Z","publishedAt":"2026-07-31T16:14:53.287229Z","latestVersion":"1.1.1"}},"verification":{"claimed":false,"claimedAt":null,"proofs":[]},"provenance":{"sources":[{"source":"pypi","key":"postgresql-mcp-server","url":"https://pypi.org/project/postgresql-mcp-server/","firstSeenAt":"2026-09-10T10:23:38.560Z","fetchedAt":"2026-09-10T10:23:38.560Z","normalizedAt":"2026-09-10T10:23:38.560Z"}]},"firstSeenAt":"2026-09-10T10:23:38.560Z","updatedAt":"2026-09-10T10:25:31.952Z"}