这是一个提供对PostgreSQL数据库只读访问的Model Context Protocol服务器。此服务器使LLMs能够检查数据库模式并执行只读查询。
sql(字符串):要执行的SQL查询该服务器为数据库中的每个表提供模式信息:
postgres://<host>/<table>/schema)
要在Claude Desktop应用程序中使用此服务器,请在您的claude_desktop_config.json文件的“mcpServers”部分添加以下配置:
host.docker.internalpostgresql://user:password@host:port/db-name{
"mcpServers": {
"postgres": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp/postgres",
"postgresql://host.docker.internal:5432/mydb"]
}
}
}
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://localhost/mydb"
]
}
}
}
将/mydb替换为您自己的数据库名称。
Docker:
docker build -t mcp/postgres -f src/postgres/Dockerfile .
此MCP服务器采用MIT许可证。这意味着您可以自由地使用、修改和分发软件,但需遵守MIT许可证的条款和条件。如需更多详情,请参阅项目存储库中的LICENSE文件。