每天了解几个MCP SERVER:PostgreSQL
·
每天了解几个MCP SERVER:PostgreSQL
来源: https://github.com/modelcontextprotocol/servers-archived/tree/main/src/postgres
简介
PostgreSQL MCP Server 提供对 PostgreSQL 数据库的只读访问,让 LLM 可以查看数据库架构并执行只读查询。
能做什么
- 只读查询:执行 SQL 查询(只读事务)
- 架构信息:获取数据库表结构信息
- 表结构查看:自动发现并提供每个表的列名和数据类型
怎么安装
使用 Docker
{
"mcpServers": {
"postgres": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/postgres", "postgresql://host.docker.internal:5432/mydb"]
}
}
}
使用 npx
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
}
}
}
资源
- 表架构 (
postgres:////schema):每个表的 JSON 架构信息
适用场景
- 数据库架构查询
- 数据探索
- SQL 编写辅助
注意事项
- 只读访问,保护数据安全
- 需要有效的数据库连接 URL
- 已被官方归档
相关链接:
- GitHub:https://github.com/modelcontextprotocol/servers-archived/tree/main/src/postgres
更多推荐
所有评论(0)