PostgreSQL MCP Server
PostgreSQL
提供对 PostgreSQL 数据库的只读访问的模型上下文协议 (MLM) 服务器。该服务器使 LLM 能够检查数据库架构并执行只读查询。
成分
工具
询问
对连接的数据库执行只读 SQL 查询
输入:
sql(字符串):要执行的 SQL 查询所有查询都在只读事务中执行
资源
服务器为数据库中的每个表提供架构信息:
表模式(
postgres://<host>/<table>/schema)每个表的 JSON 架构信息
包括列名和数据类型
从数据库元数据中自动发现
Related MCP server: PostgreSQL MCP Server
与 Claude Desktop 一起使用
要将此服务器与 Claude Desktop 应用程序一起使用,请将以下配置添加到claude_desktop_config.json的“mcpServers”部分:
Docker
在 macos 上运行 docker 时,如果服务器在主机网络上运行(例如 localhost),请使用 host.docker.internal
可以将用户名/密码添加到 postgresql url,格式为
postgresql://user:password@host:port/db-name
{
"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"
]
}
}
}将/mydb替换为您的数据库名称。
建筑
Docker:
docker build -t mcp/postgres -f src/postgres/Dockerfile . 执照
此 MCP 服务器采用 MIT 许可证。这意味着您可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。更多详情,请参阅项目仓库中的 LICENSE 文件。
This server cannot be deployed
Maintenance
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query your Postgres from ChatGPT or Claude without exposing the database or handing over credentials. Run npx boltschema connect next to your database and it dials out over HTTPS — no inbound firewall rule, no open port, works with localhost and VPC-private databases. Read-only is enforced by a SQL guard, a Postgres READ ONLY transaction, and a scoped role generated for you.
Read your Iceberg tables hosted in Europe: find tables, run read-only SQL, view photos.
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Related MCP Servers
- -licenseNot gradedqualityAmaintenanceA Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.122,323 npm91,120MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server providing LLMs read-only access to PostgreSQL databases for inspecting schemas and executing queries.122,323 npm27MIT
- AlicenseNot gradedqualityCmaintenanceA Model Context Protocol server that enables interaction with PostgreSQL databases to list tables, retrieve schemas, and execute read-only SQL queries.9 npmMIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only queries.122,323 npmMIT