Skip to content
PostgreSQL
1 views
v0.6.2
MIT
databasepostgressqlread-only

Summary

Read-only PostgreSQL access with automatic schema inspection — the reference MCP server for Postgres.

Features

  • Read-only SQL access to any PostgreSQL database
  • Automatic schema inspection for every table
  • Single-argument setup with a connection string

Installation

Set up this MCP server in your favorite AI agent — copy a ready-made configuration below.

Any MCP-compatible agent

Most agents (Claude, Cursor, Windsurf, VS Code, and more) read a standard mcpServers configuration.

  1. Open your agent's MCP configuration file.
  2. Merge the snippet below into it.
  3. Restart the agent — the "PostgreSQL" tools will be available.
{
  "mcpServers": {
    "postgres-reference": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://localhost/mydb"
      ]
    }
  }
}

Description

The reference PostgreSQL MCP server gives an assistant read-only access to a database, along with the schema information it needs to write correct queries.

What it does
  • Read-only query execution. Every statement runs inside a read-only transaction, so an assistant cannot modify data even if it decides to try.
  • Schema resources. Each table is exposed as a resource with its column names and types, so the model works from the actual schema rather than inferring one from table names.
Why the read-only constraint is the point

Giving a language model write access to a production database is a decision that deserves more thought than a config file entry. This server removes the question entirely, which makes it a sensible default for analysis, debugging, and answering questions about data.

Setup

One argument — the connection string — and you are running: npx -y @modelcontextprotocol/server-postgres postgresql://host/db. For write access or broader database support, DBHub and vendor-specific servers are better choices.

Part of the MCP reference server collection, now maintained in the archived servers repository.

Related MCP Servers

MCP: deja-vu

by Vladislav Shulcz

New

Indexes the coding-agent sessions already sitting on your disk — months of history from before you installed it — and serves them back over MCP. 3.5 GB searched in ~1.5 ms, no LLM, no embeddings.

Developer ToolsDatabases & Data
1 views
New

Weaviate's MCP server, built into the database itself — hybrid search, schema inspection, tenant listing and batch upserts at /v1/mcp, scoped by RBAC.

Databases & Data

Google's open-source MCP server for enterprise databases — one binary that fronts AlloyDB, BigQuery, Spanner, Postgres, MySQL, Oracle, MongoDB, Snowflake and more.

Databases & DataCloud & Infrastructure
3 views

MCP: DBHub

by Bytebase

Featured

A universal database MCP server — one integration for PostgreSQL, MySQL, SQL Server, SQLite, and MariaDB.

Databases & Data
Browse all MCP servers →