Cursor / PostgreSQL / remote MCP

Cursor, meet the real schema.
Not the database password.

Give Cursor your live schema and approved database tools through a hosted MCP link. Keep PostgreSQL credentials out of mcp.json, choose read-only or custom access, and see every query Cursor runs.

Free forever: 1 database + 1 linkRemote HTTP MCPProject-scoped configuration
checkout-service — Cursor⌘ K
billing.ts ×
18 const renewal = await db
19 .from("subscriptions")
20 .where(eq(status, "past_due"));
21
22 return renewal;
Agent +

Check the production schema and fix this query without changing data.

datamcp · inspect_schemasubscriptions9 columns · 3 indexes✓ Read only

The table uses billing_status, not status. I'll update the filter and keep the query read-only.

⎇ main*⌁ datamcp connectedPostgreSQL

What the editor actually gets

Cursor gets the schema.
The project gets a boundary.

Cursor calls one project-scoped MCP link. datamcp discovers the live schema, checks every requested tool, and returns only the approved result.

  1. 01Connect PostgreSQL

    datamcp discovers tables, columns, relationships, indexes, and available query tools.

  2. 02Create a project link

    Choose read-only, read-write, or custom table permissions for this codebase.

  3. 03Add it to Cursor

    Place the remote server in the project or global MCP configuration.

  4. 04Work against reality

    Cursor can inspect the real schema before it writes or explains SQL.

Cursor agent→project MCP config→scoped datamcp link→PostgreSQL

Work with the real system

Ask from the repository.
Verify against live context.

The agent can inspect only the tools and data exposed by the MCP link assigned to this project.

Fix this query using the production schema. Do not write data.
datamcpinspect_schemaRead only · schema

Cursor finds the real column and index names before editing the code.

Why are checkout failures higher after this deploy?
datamcpquery_databaseRead only · 64 rows

The agent compares application changes with approved live query results.

Add the missing test data for this one account.
datamcpinsert_rowsWrite allowed · 1 row

The write runs only when the link, PostgreSQL role, and table policy all allow it.

Set up Cursor

One link in the right scope.

Use project configuration when the database belongs to one repository. Use a user-level server only when the same boundary genuinely applies everywhere.

Open the complete setup guide →
  1. 1
    Add the PostgreSQL source

    Use a dedicated database role with the minimum permissions the project needs.

  2. 2
    Create the Cursor MCP link

    Choose the permission preset and copy the generated remote configuration.

  3. 3
    Save it in mcp.json

    Prefer `.cursor/mcp.json` for repository-specific access and verify the tools in Cursor settings.

  4. 4
    Test allowed and denied actions

    Confirm the useful query works and an operation outside policy fails.

Project context, not blanket access

The agent sees enough to help.
The policy stays in control.

The editor configuration points to an MCP endpoint. It does not need the PostgreSQL password to discover the schema or run approved tools.

Cursor can receive

Approved tools and results

  • Live schema details exposed by the MCP link
  • Approved query results and result metadata
  • Only the database tools assigned to this project
Cursor does not receive

The source credential

  • The PostgreSQL password or connection string
  • Other workspace sources and unrelated MCP links
  • Any operation denied by the link or database role
ConfigurationProject or user scope
CredentialEncrypted behind datamcp
RevocationDisable one link
ActivityPostgreSQL query history

Hosted or local

Choose based on where
the connection must live.

A local server is valid for one machine. A hosted link matters when the same controlled connection must survive beyond that laptop.

Use local MCP when

Everything stays on one developer machine.

  • Only one local Cursor client needs the source
  • You can maintain the runtime and package yourself
  • Remote availability and team sharing are unnecessary
  • The database is reachable from that machine

Before you connect

Practical questions.
Direct answers.

Configuration, credentials, permissions, hosting, and the limits that matter in a real project.

01

How does Cursor connect to PostgreSQL through MCP?

Cursor connects to a remote datamcp endpoint using its MCP configuration. datamcp authenticates the link, provides schema tools, validates query permissions, runs approved SQL against PostgreSQL, and returns the result to Cursor.

02

Where do I add the datamcp URL in Cursor?

Add the remote MCP server to .cursor/mcp.json for a project-specific connection or to ~/.cursor/mcp.json for a global connection. Project configuration is usually safer for database access because it keeps the connection scoped to the relevant codebase.

03

Does Cursor receive my PostgreSQL password?

No. Cursor receives the hosted MCP endpoint and its authentication details. The PostgreSQL connection string remains encrypted on datamcp and is never written into Cursor's MCP configuration.

04

Can Cursor be limited to read-only queries?

Yes. Create a read-only MCP link to allow SELECT queries while blocking writes and DDL. Custom table-level permissions can narrow different parts of the schema to specific operations.

05

Is a local Node.js or Docker process required?

No. Cursor supports remote HTTP MCP servers, so datamcp runs the server and transport. Cursor connects to the hosted HTTPS endpoint directly.

06

Can I try Cursor PostgreSQL MCP first?

Yes. Free includes one PostgreSQL connection and one MCP link forever, enough to verify schema discovery and permissions without a paid subscription.

Start with one link

Give Cursor the schema, not the password

Connect one PostgreSQL database and create one hosted Cursor MCP link free forever. Upgrade only when you need more sources or links.