npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

postgres-mcp-hardened

v0.1.10

Published

Secure read-only PostgreSQL MCP server in Rust — a maintained alternative to the deprecated @modelcontextprotocol/server-postgres. Blocks writes at the AST, not with regexes.

Readme

postgres-mcp-hardened

A maintained, read-only PostgreSQL MCP server — the drop-in replacement for @modelcontextprotocol/server-postgres, which was deprecated by its authors and last released in December 2024.

Writes are refused by walking the parsed SQL, not by matching strings. Comments, dollar-quoting and Unicode tricks do not survive the parse, so they cannot smuggle a statement past the check.

Try to break it without installing anything — the guard has an offline mode:

npx postgres-mcp-hardened --validate "/* comment */ DROP TABLE users"
# REJECT: non-read-only statement: Drop

If something that writes comes back ALLOW, that is the most useful thing anyone can report. The design and the defects found so far are written up in Rebuilding the Deprecated PostgreSQL MCP Server in Rust.

Replace the deprecated server

 {
   "mcpServers": {
     "postgres": {
-      "command": "npx",
-      "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
+      "command": "npx",
+      "args": ["-y", "postgres-mcp-hardened", "--stdio"],
+      "env": { "DATABASE_URL": "postgres://readonly_user:PASSWORD@localhost:5432/mydb" }
     }
   }
 }

The connection string moves from an argument to DATABASE_URL on purpose: arguments show up in ps output and in shell history on a shared machine, and a database password does not belong there.

What it does differently

  • Read-only is enforced twice. The validator rejects anything that is not a read, and the session runs in a READ ONLY transaction — so a gap in the first layer is not a breach.
  • Statement timeout and row caps are set server-side, so a careless question cannot pin your database or drag a million rows into a model's context.
  • Every query is written to an audit log chained by hash, which survives a restart and makes a deleted or truncated tail detectable.
  • Optional OAuth (RS256) with audience and issuer enforced, for running it as a shared HTTP endpoint rather than a local process.
  • Signed releases — every artefact carries a Sigstore signature and a SHA-256, and this package refuses to install a binary whose checksum does not match the one recorded at publish time.

Install

npx -y postgres-mcp-hardened --stdio       # no install
npm install -g postgres-mcp-hardened       # or keep it around

The package fetches a prebuilt binary for your platform from the matching GitHub release: Linux (x64, arm64), macOS (Intel, Apple Silicon) and Windows (x64). Alpine/musl is not among them — the Linux builds link against glibc; use the container image ghcr.io/eszetael/postgres-mcp-hardened or build from source with cargo build --release in a clone.

Full documentation, configuration reference and the security model: https://github.com/Eszetael/postgres-mcp-hardened

MIT licensed.