Docs / Guides

Give Cursor read-only access to your database

Updated

Cursor's agent can query your database through SayQL's MCP server, read-only. It gets your schema and, by default, counts and summaries instead of rows, and it never sees the database password.

Set it up

  1. Install SayQL from the download page and add your database. A read-only login makes the database enforce read-only too.
  2. Connect Cursor. Open Settings → AI apps, then Connect an app on the Access tab, and pick Cursor. Open in Cursor adds SayQL in one click (Cursor asks first), or SayQL shows the entry to put in ~/.cursor/mcp.json.
  3. Ask in Cursor's Agent chat: "how many customers signed up last week, by country?" The agent reads the schema and runs read-only queries through SayQL.

Read-only, enforced

SayQL checks every statement before it runs, and AI apps can't change data: INSERT, UPDATE, DELETE and DDL are refused. When you do want a change, the agent can open the SQL in a SayQL tab for you to review and run yourself.

Decide what it sees

  • Per connection, choose what AI apps get back from a query: nothing, counts and summaries (the default), masked rows, or all rows.
  • Never-send columns are refused in any form and withheld from SELECT *.
  • Database notes you approve, such as what a status code means, are part of the schema Cursor gets, so its SQL fits your data.

All of this is in MCP for AI apps.

Keep track

The Activity tab lists what Cursor ran, refused queries too. Block stops it at once, and Only allow apps I've approved refuses apps you haven't chosen.

Using Claude Code? See Connect Claude Code to PostgreSQL safely. To keep personal data out entirely, see Keep personal data out of AI prompts.

Something missing or unclear? Ask in Discussions.