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_cra

v1.0.3

Published

Secure MCP server for reading PostgreSQL databases

Readme

PostgreSQL MCP Server

A secure, read-only MCP (Model Context Protocol) server for PostgreSQL databases. Provides safe access to PostgreSQL through standardized MCP tools with built-in security measures to prevent data modification.

Features

  • 🔒 Read-only access - Only SELECT queries are allowed
  • 🛡️ SQL injection protection - Parameterized queries and input validation
  • 📊 Schema exploration - List schemas, tables, and table structures
  • 🔍 Query execution - Execute parameterized SELECT queries (max 1000 rows)
  • Type-safe - Built with TypeScript and Zod validation
  • 🚀 Easy setup - Simple configuration via environment variables

Installation

npm install postgres_mcp_cra

Or install globally:

npm install -g postgres_mcp_cra

Quick Start

1. Install the package (optional)

If you want to install locally in a project:

npm install postgres_mcp_cra

Note: Installation is optional when using npx (recommended method below).

2. Configure MCP Server

Add to your .mcp.json or Claude Desktop configuration:

Recommended: Using npx (no installation required)

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "postgres_mcp_cra"],
      "env": {
        "PGHOST": "localhost",
        "PGPORT": "5432",
        "PGDATABASE": "mydatabase",
        "PGUSER": "myuser",
        "PGPASSWORD": "mypassword"
      }
    }
  }
}

Or use a connection string with npx:

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "postgres_mcp_cra"],
      "env": {
        "DATABASE_URL": "postgresql://user:password@localhost:5432/mydatabase"
      }
    }
  }
}

Alternative: Using local installation

If you've installed the package locally:

{
  "mcpServers": {
    "postgres": {
      "command": "node",
      "args": ["node_modules/postgres_mcp_cra/dist/index.js"],
      "env": {
        "PGHOST": "localhost",
        "PGPORT": "5432",
        "PGDATABASE": "mydatabase",
        "PGUSER": "myuser",
        "PGPASSWORD": "mypassword"
      }
    }
  }
}

3. Usage Example

Usage Example

Security

⚠️ Important Security Notice

For sensitive databases, always use a database connection with read-only permissions.

This MCP server is designed to be read-only and includes multiple security measures:

  • ✅ Only SELECT queries are allowed
  • ✅ SQL injection protection through parameterized queries
  • ✅ Input validation with Zod schemas
  • ✅ Schema/table name validation
  • ✅ Query result limits (1000 rows max)

However, you should still configure your PostgreSQL user with read-only permissions to add an extra layer of security.

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues, questions, or contributions, please open an issue on the GitHub repository.