intermediate
Postgres MCP server
March 31, 2025

Postgres MCP server

Learn how to use Cursor's MCP server to connect to and query your Postgres database directly from the editor

Introduction

The MCP protocol allows cursor agent to interact with your postgres server in a read only mode.

You can utlize it query and analyze your Postgres database right within Cursor.

Installation

pnpm dlx shadcn@latest add https://cursorintro.com/mcp-rules/r/postgres.json

Getting Started

  1. Once you run the above command, you will see a .cursor folder created in your project repo
  2. Within it you will see a mcp.json file
  3. Open the file and update your postgres connection details.
  4. Open Cursor settings by going Settings > Cursor settings > MCP
  5. You should click on "Enabled" button and click on refresh
  6. You should see a green circle beside Posgres
  7. It means the connection is ready and your Cursor agent can talk with your database

Resources

  1. Postgres MCP server open source code internals to check how it's built