# pgEdge Postgres MCP — Read-Only by Default + Web UI > pgEdge Postgres MCP is a Go MCP server for Postgres with read-only defaults, optional HTTP auth, and a web UI for database exploration and diagnostics. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use 1. Build the binary: ```bash git clone https://github.com/pgEdge/pgedge-postgres-mcp.git cd pgedge-postgres-mcp make build ``` 2. Add to Claude Desktop config: ```json { "mcpServers": { "pgedge": { "command": "/ABS/PATH/bin/pgedge-postgres-mcp", "env": { "PGHOST": "localhost", "PGPORT": "5432", "PGDATABASE": "mydb", "PGUSER": "myuser", "PGPASSWORD": "mypass" } } } } ``` 3. Verify: ask Claude to run `query_database` for `SELECT 1` and then `get_schema_info` for one table. ## Intro pgEdge Postgres MCP is a Go MCP server for Postgres with read-only defaults, optional HTTP auth, and a web UI for database exploration and diagnostics. - **Best for:** teams that want a Postgres MCP server with explicit read-only defaults and optional HTTP/Web UI surfaces - **Works with:** PostgreSQL 14+, Go 1.21+ (to build), MCP clients (Claude Desktop, Cursor), optional HTTP mode - **Setup time:** 20-45 minutes ## Practical Notes - Quant: the docs show a YAML config format and multiple transports (stdio/HTTP), so you can standardize across local and shared deployments. - Quant: treat read-only as the default baseline; enable writes only with a config change (`allow_writes`) and a human approval rule. ## Why it matters This is a good fit when your agent needs both database query tools and an operator-friendly surface (web UI / HTTP mode) without giving up read-only safety. - Clear client matrix (Claude Desktop, Cursor, Windsurf, etc.) and configuration guides reduce integration time. - Read-only defaults are documented, which matches production expectations for agent-driven DB access. - The project positions schema tools, explain, and search as part of the server instead of relying on ad-hoc prompts. ## Rollout pattern - Start in stdio mode from a developer laptop, validate core tools, then graduate to HTTP mode for shared access. - Create a dedicated DB user and keep permissions minimal; rely on the server’s explicit write-enable switch. - Add audit logging and a trace file before you let multiple teammates point agents at the same server. ## Watchouts If you enable HTTP mode for shared use, treat it like a real service: auth on, TLS when possible, and least-privilege DB credentials. ### FAQ **Q: Do I need the web UI?** A: No. You can run it purely as an MCP server over stdio for local development and keep the surface area small. **Q: How do writes work?** A: The server is read-only by default. Writes require explicitly enabling them via configuration (for example `allow_writes`). **Q: What is the simplest first test?** A: Run `SELECT 1` via the query tool, then inspect one table schema to confirm connectivity and metadata access. ## Source & Thanks > Source: https://github.com/pgEdge/pgedge-postgres-mcp > License: PostgreSQL > GitHub stars: 158 · forks: 14 --- ## 快速使用 1. 编译: ```bash git clone https://github.com/pgEdge/pgedge-postgres-mcp.git cd pgedge-postgres-mcp make build ``` 2. 配置 Claude Desktop: ```json { "mcpServers": { "pgedge": { "command": "/ABS/PATH/bin/pgedge-postgres-mcp", "env": { "PGHOST": "localhost", "PGPORT": "5432", "PGDATABASE": "mydb", "PGUSER": "myuser", "PGPASSWORD": "mypass" } } } } ``` 3. 验证:让 Claude 先用 `query_database` 跑 `SELECT 1`,再对一个表用 `get_schema_info`。 ## 简介 pgEdge Postgres MCP 是 Go 编写的 Postgres MCP Server,默认只读执行查询,支持可选的 HTTP 鉴权与 Web UI,适合把“查库/诊断”变成可复用的 Agent 工具面板。 - **适合谁:** 希望 MCP Server 默认只读、同时还能提供 HTTP/Web UI 运维面板的团队 - **可搭配:** PostgreSQL 14+、Go 1.21+(编译用)、MCP 客户端(Claude Desktop / Cursor),可选 HTTP 模式 - **准备时间:** 20-45 分钟 ## 实战建议 - 量化信息:文档提供 YAML 配置与多种 transport(stdio/HTTP),便于本地与共享环境统一标准。 - 量化信息:默认只读作为基线;写权限通过配置项(如 `allow_writes`)显式开启,并配合人工审批规则。 ## 为什么值得收录 当你的 Agent 不仅要查库,还希望有更“运维友好”的界面(Web UI/HTTP),同时又必须保持默认只读安全边界时,这类实现会特别合适。 - 覆盖多客户端的配置指南,集成成本更低。 - 默认只读在文档中明确说明,更贴近生产期望。 - 把 schema/explain/搜索等工具能力做进服务端,而不是只靠提示词堆出来。 ## 落地路径 - 先从个人电脑用 stdio 跑通核心工具,再升级到 HTTP 模式提供共享访问。 - 准备专用 DB 用户并最小权限;写权限通过服务端显式开关控制。 - 多人共用前先加审计日志/trace 文件,保证每次查询都有证据链。 ## 注意事项 如果开启 HTTP 供多人使用,就要当成真正的服务:开启鉴权、尽量上 TLS,并保持最小权限连接凭证。 ### FAQ **一定要用 Web UI 吗?** 答:不需要。本地开发可只用 stdio 作为 MCP server,减少暴露面。 **写操作怎么控制?** 答:默认只读;写操作需要通过配置显式开启(例如 `allow_writes`)。 **最简单的连通性测试?** 答:先跑 `SELECT 1`,再查看一个表的 schema,确认查询与元数据都可用。 ## 来源与感谢 > Source: https://github.com/pgEdge/pgedge-postgres-mcp > License: PostgreSQL > GitHub stars: 158 · forks: 14 --- Source: https://tokrepo.com/en/workflows/pgedge-postgres-mcp-read-only-by-default-web-ui Author: MCP Hub