PostgreSQL MCP Server
PostgreSQL database schemas and read-only query execution for AI assistants.
Data last scanned 2 days ago · Reviewed 2 months ago
Overview
This server provides LLMs with the ability to inspect database schemas and execute read-only queries against PostgreSQL instances. It maps table metadata into accessible resources and enables users to interface with database contents directly through natural language prompts. Deployment options include running the server via Docker or using NPX for direct execution. Configuration requires a valid connection string, which the server uses to authenticate with your target database.
Our verdict
With a security score of 0/100, this tool carries a high risk level and is not recommended for new projects. The repository is officially archived, meaning no further updates or vulnerability patches will be released. Additionally, the tool lacks any authentication method, allowing anyone with access to your configuration to interact with the database.
- Supports read-only SQL transaction execution.
- Provides automatic schema discovery from database metadata.
- Includes minimal supply-chain surface with only two direct dependencies.
- Repository is officially archived and unmaintained.
- No built-in authentication for local configuration access.
- Last commit occurred over 400 days ago.
Setup
{
"mcpServers": {
"postgres": {
"args": [
"-y",
"@modelcontextprotocol/server-postgres"
],
"command": "npx"
}
}
}Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows), then restart Claude Desktop. Some servers require API keys or tokens as environment variables — check the project's README and add an "env" object if needed.
- No read-only mode — running this grants full read/write access.
- No built-in authentication — anyone with access to this config can invoke every tool it exposes.
Tools
| Tool | Description | Risk |
|---|---|---|
| query | Execute read-only SQL queries against the connected database | low |
Compatibility
| Client | Local | Docker | Remote | Read-only |
|---|---|---|---|---|
| Claude Desktop | ||||
| Cursor | ||||
| VS Code | ||||
| Windsurf | ||||
| ChatGPT |
Frequently asked questions
›Can I perform write operations like UPDATE or DELETE on my database?
No, all queries are executed within a read-only transaction, providing read-only access to your PostgreSQL database.
›How do I include my database credentials in the configuration?
You can include your username and password directly in the PostgreSQL connection URL using the format postgresql://user:password@host:port/db-name.
›Which hostname should I use when running the server in Docker to access my local database?
When running the server in Docker on macOS, use host.docker.internal instead of localhost to connect to a PostgreSQL instance running on your host machine.
›Does the server provide information about database tables?
Yes, the server automatically discovers database metadata and provides JSON schema information including column names and data types for each table.
Alternatives
Badge
Maintain this server? Add the live badge to your README.