MCP.so
Sign In

PostgreSQL MCP ServerFeatured

@modelcontextprotocol

Basic information

Category

Databases

Last updated

License

NOASSERTION

Transports

stdio

Author

modelcontextprotocol

About PostgreSQL MCP Server

Archived reference MCP server for read-only PostgreSQL access: inspect schemas and run SQL inside read-only transactions.

Before you connect

Documentation reviewed 2026-10-25

When to choose this server

This is the older PostgreSQL reference server, now documented in the servers-archived repository. It offers schema inspection and SQL queries described as read-only in the upstream README.

Setup and limitations

For a new deployment, compare maintained database integrations first. If evaluating this reference, use a disposable database and a database-enforced read-only role; do not rely only on the tool description. Its former servers/main/src/postgres source link is no longer the current location.

These notes check the linked documentation, not a live authenticated connection. Suggested checks are steps for you to run.

PostgreSQL MCP Server config

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

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://localhost/mydb"
      ]
    }
  }
}

PostgreSQL MCP Server tools

1

Run a read-only SQL query

Overview

What is PostgreSQL?

PostgreSQL MCP Server is the original reference server from the Model Context Protocol project that gives an AI assistant read-only access to a PostgreSQL database. It lets the model inspect table schemas and run SQL queries, with every query executed inside a READ ONLY transaction.

Status: this server is archived. It moved to the modelcontextprotocol/servers-archived repository, which is no longer maintained, and the npm package @modelcontextprotocol/server-postgres (last version 0.6.2) is marked "Archived and unmaintained; no security guarantees". For new setups, prefer an actively maintained PostgreSQL MCP server.

How to use PostgreSQL?

Add it to your MCP client (for example claude_desktop_config.json), replacing /mydb with your database name:

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
    }
  }
}

A Docker image mcp/postgres was also published; when the database runs on your host, use host.docker.internal instead of localhost in the connection URL. Credentials can go in the URL as postgresql://user:password@host:port/db-name.

Key features of PostgreSQL

  • query tool: run read-only SQL; input is sql (string)
  • Table schema resources at postgres://<host>/<table>/schema, with column names and data types discovered from database metadata
  • Every query runs in a READ ONLY transaction

Use cases of PostgreSQL

  • Let an assistant explore an unfamiliar database schema
  • Answer ad-hoc questions with SQL against a development or read replica
  • Prototype MCP database access before choosing a maintained server

Frequently asked questions

1

Can it write to my database?

No. The only tool runs queries inside a read-only transaction.

2

Is it still maintained?

No. It is archived with no security guarantees; use it only for testing, and avoid connecting it to production data.

3

What license does it use?

MIT. Sources: [servers-archived/src/postgres](https://github.com/modelcontextprotocol/servers-archived/tree/main/src/postgres), [npm](https://www.npmjs.com/package/@modelcontextprotocol/server-postgres). Checked 2026-11-10.

Comments

More Databases MCP servers