{"id":18534,"library":"mcp-postgres-server","title":"MCP PostgreSQL Server","description":"A Model Context Protocol (MCP) server that enables AI models, particularly Claude, to interact with PostgreSQL databases through standardized tools like query, execute, list_schemas, list_tables, and describe_table. Version 0.1.3 is the latest stable release, currently in early development with active updates. It supports both PostgreSQL-style ($1, $2) and MySQL-style (?) parameter placeholders for prepared statements, multi-schema operations, and TypeScript types. Unlike generic database MCP servers, it is purpose-built for PostgreSQL, offering secure connection handling via environment variables and automatic cleanup. It is designed for use with MCP-compatible hosts (e.g., Claude Desktop) and should not be confused with direct database client libraries.","status":"active","version":"0.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/antonorlov/mcp-postgres-server","tags":["javascript","mcp","model-context-protocol","postgres","postgresql","database","claude","anthropic"],"install":[{"cmd":"npm install mcp-postgres-server","lang":"bash","label":"npm"},{"cmd":"yarn add mcp-postgres-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add mcp-postgres-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to implement the MCP server interface and communicate with MCP clients.","package":"@modelcontextprotocol/sdk","optional":false},{"reason":"Native PostgreSQL client for Node.js used for database connections and queries.","package":"pg","optional":false}],"imports":[{"note":"Package exports a single default MCP server instance, not a class. Use ESM import.","wrong":"const server = require('mcp-postgres-server')","symbol":"default","correct":"import server from 'mcp-postgres-server'"},{"note":"Named export Server allows creating custom instances, but most users will use the default export.","wrong":"import Server from 'mcp-postgres-server'","symbol":"Server","correct":"import { Server } from 'mcp-postgres-server'"}],"quickstart":{"code":"npx mcp-postgres-server\n\n# Then configure in your MCP client (e.g., Claude Desktop):\n# {\n#   \"mcpServers\": {\n#     \"postgres\": {\n#       \"type\": \"stdio\",\n#       \"command\": \"npx\",\n#       \"args\": [\"-y\", \"mcp-postgres-server\"],\n#       \"env\": {\n#         \"PG_HOST\": process.env.PG_HOST ?? 'localhost',\n#         \"PG_PORT\": process.env.PG_PORT ?? '5432',\n#         \"PG_USER\": process.env.PG_USER ?? 'postgres',\n#         \"PG_PASSWORD\": process.env.PG_PASSWORD ?? '',\n#         \"PG_DATABASE\": process.env.PG_DATABASE ?? 'mydb'\n#       }\n#     }\n#   }\n# }","lang":"typescript","description":"Runs the MCP PostgreSQL server via npx and shows the required environment variable configuration for MCP client integration."},"warnings":[{"fix":"Set PG_HOST, PG_PORT, PG_USER, PG_PASSWORD, PG_DATABASE in the environment or MCP client config.","message":"Environment variables must be set before starting the server or the connection will fail.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Use connection pooling externally or consider alternative MCP servers for high-throughput scenarios.","message":"The package does not support connection pooling; each tool call opens a new connection, which can be slow.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Avoid using the connect_db tool unless you need to override connection parameters per request.","message":"The 'connect_db' tool is redundant; the server auto-connects using environment variables. Calling connect_db may conflict.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install mcp-postgres-server' globally or use 'npx -y mcp-postgres-server'.","cause":"Package not installed or npx not used correctly.","error":"Error: Cannot find module 'mcp-postgres-server'"},{"fix":"Ensure PG_HOST is set to a valid PostgreSQL hostname or IP address in the environment.","cause":"The PG_HOST environment variable is not set or points to an unreachable host.","error":"Error: getaddrinfo ENOTFOUND your_host"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}