Skip to main content

PgSafe MCP (Lite Edition)

Early Access $9

Enterprise Suite Pro: $9 Early Access (Regular $19) con código EARLYACCESS: https://johanld.gumroad.com/l/genesis-enterprise-suite/EARLYACCESS

⚡ Enterprise Infrastructure & Tooling

Component Pricing Delivery / Direct Access
Starter Kit Free ($0+) 25+ .cursorrules, CLAUDE.md stack rules & MCP config templates. Download Free
Enterprise Suite Pro $9 Early Access $19 6 Pro MCP Servers, Zero-Downtime DB migrations, Residential Proxies, Docker Compose Stack & Commercial License. Get Early Access ($9)
Config Generator Free Web Tool Interactive visual config generator for Claude Desktop & Cursor. Open Generator
pgsafe-mcp MCP server

PyPI License: MIT Python 3.10+ MCP Compliant

⚡ Enterprise Infrastructure & Tooling

Package Access Features
Starter Kit Free ($0+) 25+ .cursorrules, CLAUDE.md stack rules & MCP config templates. Download Free
Enterprise Suite Pro $19 USD 6 Pro MCP Servers, Zero-Downtime DB migrations, Residential Proxies, Docker Compose Stack & Commercial License. Get Pro License
Config Generator Free Web Tool Interactive visual config generator for Claude Desktop & Cursor. Open Generator

PgSafe MCP is a Zero-Trust Model Context Protocol server that enables AI agents in Claude Desktop, Cursor, Windsurf, and Antigravity to inspect schemas and run analytical SQL queries without risking accidental data loss, destructive mutations (DROP, TRUNCATE, DELETE), or runaway table scans.


Run without cloning

uvx pgsafe-mcp

Claude Desktop / Cursor config entry:

{
  "mcpServers": {
    "pgsafe-mcp": {
      "command": "uvx",
      "args": [
        "pgsafe-mcp"
      ]
    }
  }
}

CI

🛡️ Why PgSafe MCP?

Giving an AI assistant raw access to your database is terrifying:

  1. Accidental Deletions: One ambiguous prompt can lead an LLM to generate DROP TABLE or DELETE FROM users;.
  2. Production Table Locks: An unindexed query with a multi-table Cartesian product can consume 100% CPU and lock production tables.
  3. Multi-Statement Injection: LLMs can be tricked via prompt injection into chaining malicious SQL commands (SELECT 1; TRUNCATE audit_logs;).

PgSafe acts as a strict guardrail sitting between the AI agent and your database engine.


⚡ Features (Lite Edition)

  • 🔒 Enforced Read-Only Guard: Automatically detects and blocks all destructive statements (DROP, TRUNCATE, ALTER, UPDATE, INSERT, DELETE).
  • 🛑 Anti-Chaining Protection: Disallows multi-statement execution via semicolons.
  • ⏱️ Automatic LIMIT Injection: Ensures every SELECT query has a capped LIMIT clause (default: 100 rows, max: 1,000) to protect database memory.
  • 📊 Zero-Cost Schema Reflection: Tools to explore public tables and columns without executing custom introspection queries.
  • 🪶 Zero Dependency Core: Native support for SQLite out of the box; optional PostgreSQL adapter.

🚀 Quick Setup in 2 Minutes

1. Installation

git clone https://github.com/johannschiffer/pgsafe-mcp.git
cd pgsafe-mcp
pip install .

For PostgreSQL support:

pip install "psycopg[binary]>=3.1.0"

2. Configure Claude Desktop (claude_desktop_config.json)

On Linux: ~/.config/Claude/claude_desktop_config.json
On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "pgsafe": {
      "command": "python",
      "args": ["-m", "pgsafe.server"],
      "cwd": "/path/to/pgsafe-mcp",
      "env": {
        "DATABASE_URL": "postgresql://user:password@localhost:5432/production_db"
      }
    }
  }
}

For SQLite, simply point to your .db file:

{
  "mcpServers": {
    "pgsafe": {
      "command": "python",
      "args": ["-m", "pgsafe.server"],
      "cwd": "/path/to/pgsafe-mcp",
      "env": {
        "DATABASE_URL": "sqlite:///data/nexus.db"
      }
    }
  }
}

🛠️ MCP Tools Exposed to AI Agents

Tool Parameters Description
list_tables (none) Returns list of all user tables in the database
describe_table table_name Returns column names, data types, nullability, and primary keys
safe_query query, limit Executes strictly read-only SQL with forced LIMIT enforcement
analyze_query query Inspects SQL for unindexed table scan and Cartesian join risks

💎 Need Enterprise Data Protection? Upgrade to PgSafe Pro

Running against live production workloads with sensitive customer data?

Feature Lite (Open Source) Enterprise Suite ($9 Early Access)
Read-Only SQL Validation ✅ ✅
Forced LIMIT Injection ✅ ✅
PostgreSQL & SQLite ✅ ✅
MySQL, MariaDB & ClickHouse ❌ ✅
Automatic PII Redaction & Masking (Emails, Cards, Hashes) ❌ ✅
Dry-Run Mutation Simulation (Auto-Rollback Test Harness) ❌ ✅
Index Recommendation Advisor ❌ ✅
Production Docker & Compose ❌ ✅
Full Pytest Suite & Architecture Guide ❌ ✅

👉 Get the Genesis Enterprise Suite ($9 Early Access)


Solución Enterprise (Genesis Suite)

Para despliegues en producción y cargas intensivas con bypass de rate limits, soporte multi-tenant y configuraciones Docker precompiladas:

  • Bypass de Rate Limits & IP Rotation: Protección de bases de datos multi-tenant, enmascaramiento PII en vivo y verificaciones de migración sin caída.
  • Soporte Multi-Tenant & RBAC: Control de accesos granular, gestión de secretos y auditoría criptográfica.
  • Docker Compose Stacks: Contenedores precompilados y configuraciones listas para producción con orquestación autónoma.

👉 Genesis Enterprise Suite ($9 Early Access)
📦 Genesis AI Engineering Starter Kit ($0+)

📄 License

MIT License. See LICENSE for details.

Genesis MCP Ecosystem

Module What it does Repo
CrawlEngine MCP Anti-bot web scraping, clean Markdown, proxy rotation and TLS evasion GitHub
BrowserBridge MCP Deterministic headless browser automation with cryptographic action receipts GitHub
PgSafe MCP (this repo) Zero-trust PostgreSQL/SQLite guard, live PII masking, zero-downtime migration checks GitHub
OmniBridge MCP Multi-channel notification and webhook bus with a persistent SQLite WAL queue GitHub
SysFlow MCP Safe Linux administration plane: systemd, port audit, isolated execution GitHub
FastMCP Forge Production MCP server scaffolder: stdio, SSE and auth middleware GitHub

Live config builder | Starter Kit, free | Enterprise Suite, $9 Early Access

Metadata

Release files for pgsafe-mcp 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pgsafe-mcp 1.0.4
File Size Uploaded Provenance Actions
pgsafe_mcp-1.0.4.tar.gz 16.5 kB Without provenance Details for pgsafe_mcp-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pgsafe-mcp 1.0.4
File Interpreter ABI Platform Actions
pgsafe_mcp-1.0.4-py3-none-any.whl Python 3 none any Details for pgsafe_mcp-1.0.4-py3-none-any.whl

Total release size: 31.8 kB

Release files / pgsafe_mcp-1.0.4.tar.gz

Download URL pgsafe_mcp-1.0.4.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a9ec1035fad786c0fe93709fa685a9b4a2ae6e73b79441c63b8b3cbdba9986f7
BLAKE2b-256 checksum
How to use checksums
ec0ba2965ae9709de65b907ef04694c026765802630be86063b1c09d33edfde8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / pgsafe_mcp-1.0.4-py3-none-any.whl

Download URL pgsafe_mcp-1.0.4-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00cff9337bd6815c6d4dfbef2f0b7d9352388d46cba3537997a5bd2365aa6e1e
BLAKE2b-256 checksum
How to use checksums
332d9ab5ea3ae07cb900f79730888e914f9275d439d8e4354c6213daad0f2d44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for pgsafe-mcp 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page