Skip to main content
Glama
BrassaiKao

postgres-mcp-full-access

by BrassaiKao

postgres-mcp-full-access

A pure, full-access PostgreSQL MCP server for AI agents. Enables unrestricted SQL execution (DDL/DML) with zero database bundling.

This project embraces a "pure middleware" philosophy, stripping away restrictive database environment setups and hardcoded query filtering. It does exactly one thing: unconditionally accepts and executes any SQL command from your Agent (including CREATE, INSERT, UPDATE, DELETE, and DROP), and returns the result.

All connection methods, network architectures, and security constraints are entirely left to the user and the native PostgreSQL Role-Level Security (RLS) to manage.

✨ Key Features

  • 100% Decoupled: Zero database bundling. It runs purely as an stdio middleware layer.

  • Always Latest: No locked-in versions. Every build automatically pulls the latest Node.js, MCP SDK, and pg drivers, eliminating maintenance overhead.

  • Unrestricted Access: Breaking free from the typical read-only sandbox. Your AI can autonomously create databases, define tables, and perform vector searches (e.g., pgvector).

  • Dynamic Database Switching: Built-in support for switching databases mid-session—allowing the AI to create a new database and immediately connect to it to execute further commands.

  • Minimalist Deployment: A single command builds a clean Docker image, ready to be spawned by your Agent at any time.


Related MCP server: PostgreSQL MCP Server

🚀 Quick Start (One-Click Build)

1. Clone the repository

git clone [https://github.com/BrassaiKao/postgres-mcp-full-access.git](https://github.com/BrassaiKao/postgres-mcp-full-access.git)
cd postgres-mcp-full-access

2. Build the latest environment image No local Node.js installation is required. Just run:

docker compose up -d --build

(This automatically pulls the latest dependencies and generates an image named hermes-postgres-mcp:latest on your machine. The container will gracefully exit once the build is complete, consuming zero background resources.)

⚙️ Usage with AI Agents

To use this with an MCP-compatible agent (like Hermes Agent or Claude Desktop), modify your agent's configuration file (e.g., ~/.hermes/config.yaml):

mcp_servers:
  postgres_middleware:
    command: "docker"
    args:
      - "run"
      - "-i"             # Required: Keep interactive mode open for stdio
      - "--rm"           # Automatically remove the container when done
      # - "--network=your_network" # Uncomment if you need to connect to a specific Docker network
      - "-e"
      # Insert the PostgreSQL connection string you want the Agent to use
      - "DATABASE_URL=postgresql://agent_user:password@your_db_host:5432/postgres"
      - "hermes-postgres-mcp:latest"

🛡️ Security Best Practices (Crucial)

Because this MCP Server allows all SQL syntax, DO NOT give the AI your postgres (Superuser) credentials.

Instead, create a dedicated Role in your PostgreSQL database. Use GRANT and REVOKE to precisely control which tables the Agent can read or write. By delegating security to the database layer, even if a Prompt Injection occurs, malicious commands will be natively blocked by PostgreSQL with a Permission denied error!

Related MCP Connectors

Related MCP Servers

  • F
    license
    A
    quality
    Not graded
    maintenance
    Enables comprehensive PostgreSQL database management through natural language including queries, schema operations, user management, and administrative tasks. Features enterprise-grade connection pooling, transaction support, and full database administration capabilities.
    11
    74 npm
    1
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to interact with PostgreSQL databases through schema intelligence, query execution, and DBA tooling including index analysis and health monitoring. Features configurable access levels and audit logging for secure database operations.
    347 npm
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables full read-write access to PostgreSQL databases with transaction management and safety controls, allowing LLMs to query and modify database content.
    6 npm
    3
    MIT