# PostgreSQL MCP Server [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/neverinfamous/postgresql-mcp.git  
**GitHub Stars:** 12  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/postgresql-mcp-server-3

## Description
PostgreSQL MCP server with 203 tools, connection pooling, HTTP/SSE, OAuth 2.1, and tool filtering

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/neverinfamous/postgresql-mcp.git), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
docker pull writenotenow/postgres-mcp:latest
```

2. Install:

```sh
npm install -g @neverinfamous/postgres-mcp
```

3. Start the server:

```sh
postgres-mcp --transport stdio --postgres postgres://user:password@localhost:5432/database
```

4. Install:

```sh
git clone https://github.com/neverinfamous/postgres-mcp.git
```

5. Run:

```sh
cd postgres-mcp
```

6. Install:

```sh
npm install
```

## Documentation

## What PostgreSQL MCP Server MCP server does

PostgreSQL MCP Server MCP server exposes PostgreSQL capabilities through the Model Context Protocol. It is intended for agents that need to work with a PostgreSQL 12–18 database while keeping database operations available through MCP rather than custom application code.

The toolset includes support for citext, ltree, pgcrypto, pg_cron, pg_stat_kcache, pgvector, PostGIS, and HypoPG. The project also provides audit logging, schema snapshots before mutations, semantic row-level diffing, and translated database errors intended to give agents clearer recovery information.

## How it works

Agents can connect over stdio for local desktop usage or use HTTP/SSE transports for networked deployments. The server maintains a PostgreSQL connection pool and can restrict the exposed toolset with filtering, including distinct tool groups and a Code Mode configuration.

Code Mode executes multi-step database work inside a V8 isolate implemented with Node.js worker threads. Instead of sending every intermediate operation as a separate model tool call, an agent can perform a sequence within the isolated environment. Responses include token-estimate metadata, and the `postgres://audit` resource can be used to inspect session-level token consumption.

OAuth 2.1 and granular scopes are available for deployments that need authentication and tool-level access control.

## Setup and configuration

PostgreSQL MCP Server MCP server requires PostgreSQL 12–18. Docker is the recommended runtime; Node.js 24 or later can also be used. The Docker setup passes `POSTGRES_HOST`, `POSTGRES_PORT`, `POSTGRES_USER`, `POSTGRES_PASSWORD`, and `POSTGRES_DATABASE` into the container. When PostgreSQL runs on the host machine, the example uses `host.docker.internal` as the Docker host value.

The npm package can be installed globally with `@neverinfamous/postgres-mcp`. A local source installation uses the repository, `npm install`, `npm run build`, and the compiled CLI. The CLI accepts a PostgreSQL connection URI, such as `postgres://user:password@localhost:5432/database`, and can be started with the stdio transport. Docker examples also show `--tool-filter codemode` and an audit-log path.

## Tools and capabilities

Available functionality includes:

- SQL and database operations exposed as specialized MCP tools.
- Schema introspection and migration-history tracking.
- Health, performance, and replication information through resources.
- Built-in prompts for workflows such as query tuning and schema design.
- Tool filtering to limit the server to selected groups.
- Connection pooling and deterministic translation of database errors.
- Extension-oriented APIs for vector, geospatial, scheduling, cryptographic, and other PostgreSQL features.

## Limitations and notes

The number of exposed tools depends on the selected tool filter, so a deployment configured with a subset will not present the complete catalog. Docker users must account for container-to-host networking when the database is not running in the same container or network.

Verify the project’s release documentation when exact version-specific counts matter.

_Full upstream README: https://allmcps.com/mcp/postgresql-mcp-server-3/readme_

