How to fix Postgres MCP error: no pg_hba.conf entry for host ... SSL off
When using the Postgres MCP server with Claude Desktop on macOS, connecting to Azure Database for PostgreSQL Flexible Server with private access/VNet integration fails with: MCP error -32603: no pg_hba.conf entry for host "172.16.27.130", user "read", database "my-database", SSL off. The same database is reachable from DBeaver and Django on the same network. What does this error mean and how do I fix it?
Originally asked on GitHub: https://github.com/modelcontextprotocol/servers/issues/600
6 answers
This issue was closed as not planned and the Postgres MCP server has been archived in modelcontextprotocol/servers-archived, so there is no official fix coming. Commenters did find working workarounds: the error message shows Postgres rejected the connection with "SSL off", and adding an SSL parameter to the connection string in
~/Library/Application Support/Claude/claude_desktop_config.jsonresolved it for several people.- For Azure Database for PostgreSQL Flexible Server with a private endpoint: append
sslmode=enableto the end of the connection string. One user confirmed this resolved the exact error. - For AWS RDS Postgres: download the RDS combined CA bundle and append
?sslmode=verify-full&sslrootcert=$(pwd)/rds-combined-ca-bundle.pemto the connection string. This also resolved the same error. - For local connections only:
sslmode=disablewas reported to work, but it disables encryption.
The
mcp-server-postgres.logproduced no output for this failure. Since the server is no longer actively maintained, the maintainers recommend checking the alternatives listed in the servers Readme.General advice: the connection string in
claude_desktop_config.jsoncontains credentials, so keep that file's permissions restricted.Did this work for you?- For Azure Database for PostgreSQL Flexible Server with a private endpoint: append
What @mayorblock tried on GitHub (Worked)
For Azure PostgreSQL Flexible Server with a private endpoint, appending
sslmode=enableto the end of the connection string resolved the pg_hba.conf error.Did this work for you?What @minrightsai tried on GitHub (Worked)
For AWS RDS Postgres, appending
?sslmode=verify-full&sslrootcert=$(pwd)/rds-combined-ca-bundle.pemafter downloading the RDS CA bundle resolved the same error.Did this work for you?What @nathanbowang tried on GitHub (Worked)
Reported that appending
sslmode=disableto the connection string worked for a local connection.Did this work for you?What @Amresh5824 tried on GitHub (Didn't work)
Could access the same database from DBeaver and Django, but the MCP server still failed with the exact same pg_hba.conf error.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Connected from macOS over an IKEv2 VPN to Azure Flexible Server with private access, configured the Postgres URL in the Claude Desktop config, and received the pg_hba.conf error with no output in mcp-server-postgres.log.
Source: https://github.com/modelcontextprotocol/servers/issues/600 (opens external site)
Did this work for you?
Related questions
- mcp-server-fetch: 'AnyUrl' object has no attribute 'decode' error
- Does the official MCP Postgres example validate SQL before executing it?
- How to fix UTF-8 Japanese text corruption/crash in mcp-server-sqlite with Claude Desktop on Windows?
- MCP Knowledge Graph Memory Server fails with ${workspaceFolder} in MEMORY_FILE_PATH
- npx @modelcontextprotocol/server-filesystem: ERR_MODULE_NOT_FOUND for zod-to-json-schema