What tables exist in my database?
Common usage pattern for this MCP server
Ask Claude: "What tables exist in my database?"Official MCP server providing read-only access to PostgreSQL databases with schema inspection and query capabilities
The official PostgreSQL MCP Server from Anthropic provides read-only access to PostgreSQL databases, enabling Claude to inspect schemas and execute safe queries.~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://localhost/mydb"
]
}
}
}{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://localhost/mydb"
]
}
}
}Connection refused or database not accessible
Verify PostgreSQL is running with pg_isready command. Check connection string format: postgresql://user:password@host:port/database. Test with psql command first. Verify firewall allows connections on port 5432.
SSL connection error - wrong version number or verify failed
Add sslmode parameter: postgresql://host/db?sslmode=require. Verify PostgreSQL supports TLS version (check pg_config --configure). Use sslmode=disable for local dev only. Check certificate matches CA in ssl_ca_file.
Authentication failed for user or password rejected
Verify username/password in connection string exact match. Check pg_hba.conf allows connection method (md5, scram-sha-256). Ensure user exists with GRANT SELECT permissions. Test auth with psql -U username -d database.
Certificate authentication failed - CN mismatch
Verify certificate CN matches PostgreSQL username exactly. Configure pg_ident.conf for username mapping if needed. Check ssl_cert_file and ssl_key_file permissions (owned by postgres user). Ensure client cert trusted by server CA.
Permission denied on table or schema access error
Grant SELECT permissions: GRANT SELECT ON ALL TABLES IN SCHEMA public TO username. Verify read-only user has pg_read_all_data role. Check schema permissions with \dp command in psql. Ensure user connected to correct database.
Common usage pattern for this MCP server
Ask Claude: "What tables exist in my database?"Common usage pattern for this MCP server
Ask Claude: "Describe the structure of the users table"Common usage pattern for this MCP server
Ask Claude: "How many records are in each table?"Common usage pattern for this MCP server
Ask Claude: "Write a query to find active users from last month"Common usage pattern for this MCP server
Ask Claude: "Generate documentation for my database schema"Loading reviews...
Join our community of Claude power users. No spam, unsubscribe anytime.
Required