MCP.so
Sign In

PostgreSQL MCP Server (Enhanced)

@GarethCott

About PostgreSQL MCP Server (Enhanced)

No overview available yet

Basic information

Category

Databases

License

NOASSERTION

Runtime

node

Transports

stdio

Publisher

GarethCott

Config

Add this server to your MCP-compatible client using the configuration below.

{
  "mcpServers": {
    "enhanced-postgres-mcp-server": {
      "command": "docker",
      "args": [
        "build",
        "-t",
        "mcp/postgres",
        "-f",
        "Dockerfile",
        "."
      ]
    }
  }
}

Tools

No tools detected

We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.

Overview

What is PostgreSQL MCP Server (Enhanced)?

A Model Context Protocol server that provides both read and write access to PostgreSQL databases. It enables LLMs to inspect database schemas, execute queries, modify data, and create or modify database schema objects. This is an enhanced version of the original read-only PostgreSQL MCP server by Anthropic, adding write capabilities and schema management.

How to use PostgreSQL MCP Server (Enhanced)?

Configure it in the "mcpServers" section of your claude_desktop_config.json. Use either Docker (run docker run -i --rm mcp/postgres) or NPX (run npx -y @modelcontextprotocol/server-postgres), providing a PostgreSQL connection URL such as postgresql://host:port/db-name. Then invoke tools like /query, /insert, /update, /createTable, /createFunction, /createTrigger with the required arguments.

Key features of PostgreSQL MCP Server (Enhanced)

  • Execute read-only SQL queries with prepared statements
  • Insert, update, and delete records in tables
  • Create and alter tables, indexes, functions, and triggers
  • Automatic schema discovery as MCP resources
  • Parameterized queries for SQL injection prevention
  • Transactional handling with proper COMMIT/ROLLBACK

Use cases of PostgreSQL MCP Server (Enhanced)

  • LLM-driven inspection of database schemas and data
  • Automated data entry and record updates via natural language commands
  • Schema evolution, such as adding columns or creating indexes
  • Setting up database functions and triggers through conversational AI

FAQ from PostgreSQL MCP Server (Enhanced)

How does this version differ from the original PostgreSQL MCP server?

The original server provides read-only access. This enhanced version adds write capabilities (INSERT, UPDATE, DELETE) and schema management tools like create table, function, trigger, index, and alter table.

What security measures are implemented?

All data modification operations use transactions with COMMIT/ROLLBACK handling. Insert/update operations use parameterized queries to prevent SQL injection. The read-only query tool uses prepared statements to block multi‑statement injection attacks.

How do I connect to a PostgreSQL database?

Provide a PostgreSQL connection URL in the server configuration (e.g., postgresql://user:password@host:port/db-name). For Docker on macOS, use host.docker.internal if the server runs on the host network. Add ?sslmode=no-verify to bypass SSL verification if needed.

Can I create functions and triggers with this server?

Yes. Tools /createFunction and /createTrigger allow creating PostgreSQL functions (specifying language, parameters, body) and triggers (defining when, events, forEach, optional condition).

Does the server use transactions for modifications?

Yes. Each execution of the execute tool is performed within a transaction with proper COMMIT or ROLLBACK handling. Insert, update, and delete tools also run inside a transaction context.

Comments

More Databases MCP servers