Postgres MCP Server

Provides read-only access to PostgreSQL databases for Large Language Models, enabling schema inspection and query execution.

Local serverstdio 1

What is the Postgres MCP server?

Provides read-only access to PostgreSQL databases for Large Language Models, enabling schema inspection and query execution. Exposed over MCP by the postgres mcp server, that capability becomes something an assistant can invoke while it works, not something you go and do afterwards.

What it actually does

A Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.

Its toolset

Everything the assistant can do here goes through one of these:

  • query — Execute read-only SQL queries against the connected database
  • Input — sql (string): The SQL query to execute
  • Tools — The Tools tool exposed by this server
  • Resources — The server provides schema information for each table in the database:

Adding it to your client

Setup follows the usual MCP pattern — install or clone the server, register it in your client's configuration file, restart the client. The configuration blocks on this page cover the common clients.

When to reach for it

Among the database access options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. Postgres's toolset — query, Input, Tools and 1 more — is a fair guide to whether it matches your workflow. It is maintained by DanielRSnell; worth a glance at recent repository activity before you build anything load-bearing on it.

This entry was verified against Postgres's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Caveats

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the postgres mcp server does with a few real requests.

Available tools

ToolWhat it does
queryExecute read-only SQL queries against the connected database
Inputsql (string): The SQL query to execute
ToolsThe Tools tool exposed by this server.
ResourcesThe server provides schema information for each table in the database:

How to install the Postgres MCP server

{
  "mcpServers": {
    "postgres": {
      "command": "docker",
      "args": [
        "run", 
        "-i", 
        "--rm", 
        "mcp/postgres", 
        "postgresql://host.docker.internal:5432/mydb"]
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Example prompts to try

  • Use Postgres to query.
  • Use Postgres to Input.
  • Use Postgres to Tools.

Frequently asked questions

It supports read-only SQL SELECT queries. Data manipulation queries such as INSERT, UPDATE, and DELETE are not permitted.