PostgreSQL多模式服务器添加福利群:解决AI开发者的「MCP实战痛点」这是一个提供对 PostgreSQL 数据库只读访问的 Model Context Protocol 服务器,增强了多模式支持。此服务器使 LLM 能够检查多个命名空间中的数据库模式并执行只读查询,同时保持模式隔离。
sql (字符串):要执行的 SQL 查询服务器为每个授权模式中的每个表提供模式信息:
postgres://<host>/<db_schema>/<table>/schema)
服务器需要一个数据库 URL,并接受以逗号分隔的要暴露的模式列表:
npx -y mcp-server-postgres-multi-schema <database-url> [schemas]
postgresql://localhost/mydb)# Connect with default public schema
npx -y mcp-server-postgres-multi-schema postgresql://localhost/mydb
# Connect with multiple schemas
npx -y mcp-server-postgres-multi-schema postgresql://localhost/mydb public,analytics,staging

在 claude_desktop_config.json 中配置 "mcpServers" 部分:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"mcp-server-postgres-multi-schema",
"postgresql://localhost/mydb",
"public,audit"
]
}
}
}

此多模式 MCP 服务器根据 MIT 许可证许可。您可以根据 LICENSE 文件中的条款使用、修改和分发该软件。