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
- Once you run the above command, you will see a
.cursor
folder created in your project repo - Within it you will see a
mcp.json
file - Open the file and update your postgres connection details.
- Open Cursor settings by going Settings > Cursor settings > MCP
- You should click on "Enabled" button and click on refresh
- You should see a green circle beside Posgres
- It means the connection is ready and your Cursor agent can talk with your database
Resources
- Postgres MCP server open source code internals to check how it's built