
How to add PGMCP - PostgreSQL Model Context Protocol Server to Windsurf
Query any PostgreSQL database in natural language via MCP, with safe read-only SQL and streaming. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.
Last updated June 14, 2026 · 536★ · http · apikey
Windsurf config for PGMCP - PostgreSQL Model Context Protocol Server
brew tap subnetmarco/homebrew-tap && brew install pgmcp{
"mcpServers": {
"pgmcp---postgresql-model-context-protocol-server": {
"serverUrl": "http://localhost:8080/mcp"
}
}
}Remote server — no local install needed. Restart the client after saving the config.
Setup steps
- 1Open Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
- 2Paste the PGMCP - PostgreSQL Model Context Protocol Server config below.
- 3Fill in placeholder secrets, then save.
- 4Click Refresh in the MCP panel.
- 5PGMCP - PostgreSQL Model Context Protocol Server's tools become available to Cascade.
Before you start
- PostgreSQL database (existing database with your schema)
- OpenAI API key (optional, for AI-powered SQL generation)
What PGMCP - PostgreSQL Model Context Protocol Server can do in Windsurf
askNatural language questions converted to SQL queries with automatic streaming.
searchFree-text search across all database text columns.
streamAdvanced streaming for very large result sets with pagination.
Security
Read-only enforcement blocks write operations (INSERT, UPDATE, DELETE, etc.) and runs all queries in read-only transactions. Query timeouts prevent long-running queries; input validation sanitizes and validates user input. Optional Bearer-token authentication via the AUTH_BEARER environment variable. Natural-language-to-SQL generation sends schema/queries to the OpenAI API when OPENAI_API_KEY is configured.
PGMCP - PostgreSQL Model Context Protocol Server + Windsurf FAQ
Where is the Windsurf config file?
Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_config.json. Paste the PGMCP - PostgreSQL Model Context Protocol Server config there under the "mcpServers" key and restart the client.
Is PGMCP - PostgreSQL Model Context Protocol Server safe to use with Windsurf?
Read-only enforcement blocks write operations (INSERT, UPDATE, DELETE, etc.) and runs all queries in read-only transactions. Query timeouts prevent long-running queries; input validation sanitizes and validates user input. Optional Bearer-token authentication via the AUTH_BEARER environment variable. Natural-language-to-SQL generation sends schema/queries to the OpenAI API when OPENAI_API_KEY is configured.
Is it safe to point this at my production database?
It enforces read-only access, blocking write operations (INSERT, UPDATE, DELETE, etc.) and running all queries in read-only transactions, with query timeouts and input validation. No schema modifications are required.
Do I need an OpenAI API key?
It is optional. OPENAI_API_KEY enables AI-powered natural-language-to-SQL generation; the default model is gpt-4o-mini and can be overridden with OPENAI_MODEL.
How do I connect it to Claude Desktop or Cursor?
Start the server (it listens on http://localhost:8080/mcp by default), then add an mcpServers entry with an http transport pointing to that URL in your client config.