Give Claude Code Read-Only Database Access: Supabase, Neon, and MongoDB MCP (Measured)

Read-Only DB MCPs: Supabase, Neon, MongoDB, measured

Last Verified: October 2026 — tool lists measured in full and read-only mode for all three servers

Claude Code writes better queries when it can see your real schema instead of guessing column names. But “let the agent into the database” is where most people stop, and for good reason.

Supabase, Neon, and MongoDB all ship an official MCP server with a read-only switch. We turned it on and off for each one and counted what it removes. Short version: it takes away every tool that writes, and keeps the one that queries. So read-only stops Claude Code from changing your data. It doesn’t stop it from reading all of it. Here’s the one-line setup for each, the numbers, and the second lock worth adding.

Still choosing a database server? The database MCP roundup compares the options. Want tools with no account at all? Start with the 5-server starter pack.

Quick Start

Run the line for your database, in your project folder.

Supabase (put your project ref in):

claude mcp add --scope project --transport http supabase "https://mcp.supabase.com/mcp?project_ref=<your-project-ref>&read_only=true"

Neon:

claude mcp add --scope project --transport http neon "https://mcp.neon.tech/mcp?readonly=true"

MongoDB (put your connection string in; needs Node.js 22.13+):

claude mcp add --scope user mongodb --env MDB_MCP_CONNECTION_STRING="mongodb+srv://USER:PASS@cluster0.example.mongodb.net/" -- npx -y mongodb-mcp-server@latest --readOnly

For Supabase and Neon, start Claude Code, run /mcp, and sign in. Total time: about 2 minutes.

⚡ Copy This Prompt: Let Claude Code Connect It Read-Only

Or hand the job to the agent. It checks for an existing entry first and only reads to verify:

You have shell access and the `claude mcp` CLI on this machine. Connect my database to Claude Code in read-only mode and report back. Do not tell me it's done unless step 4 actually confirms it.

1. Run `claude mcp list`. If a supabase, neon, or mongodb entry already exists, show me its URL or command and check it has the read-only setting (read_only=true, readonly=true, or --readOnly). If it doesn't, tell me and stop.
2. Ask me which database I use, then run only that line, with my value in place of the placeholder:
Supabase (ask me for the project ref): claude mcp add --scope project --transport http supabase "https://mcp.supabase.com/mcp?project_ref=<your-project-ref>&read_only=true"
Neon: claude mcp add --scope project --transport http neon "https://mcp.neon.tech/mcp?readonly=true"
MongoDB (ask me for the connection string; run `node -v` first and stop if it is below v22.13.0): claude mcp add --scope user mongodb --env MDB_MCP_CONNECTION_STRING="mongodb+srv://USER:PASS@cluster0.example.mongodb.net/" -- npx -y mongodb-mcp-server@latest --readOnly
3. For Supabase or Neon, tell me to run `/mcp`, pick the server, and finish the sign-in in the browser. Wait until I say it's done.
4. Using only read tools, list my tables (or collections) and show me the structure of one of them. Do not insert, update, delete, migrate, or create anything.
On this page (8 sections)
  1. What the Read-Only Switch Actually Removes
  2. Step-by-Step Setup
  3. Try It (One Prompt Each)
  4. Make It Smaller
  5. Honest Limits
  6. Common Mistakes to Avoid
  7. Q&A
  8. Official Resources

What the Read-Only Switch Actually Removes

We listed every tool each server offers with the switch off and on, on October 5, 2026. Context is the size of the tool definitions, roughly what the model reads just to know the tools exist.

ServerRead-only switchTools · context (full → read-only)
Supabaseread_only=true in the URL20 → 13 · ~4.2K → ~2.7K
Neonreadonly=true in the URL114 → 51 · ~28.9K → ~11.6K
MongoDB--readOnly flag31 → 20 · ~20.5K → ~14.7K
  • Supabase drops 7 tools: migrations, Edge Function deploys, and creating, merging, resetting, or deleting branches. execute_sql stays.
  • Neon drops 63: creating or deleting projects, branches, roles, databases, and snapshots, migrations, auth and storage changes, and even get_connection_string. run_sql stays, limited to reads.
  • MongoDB drops 11: insert, update, delete, drop, create, and rename. find, aggregate, explain, and export stay.

That’s the point of read-only: Claude Code can still answer “why is this query slow” and “what does this table look like”, it just has no tool that writes. It also makes Neon a lot cheaper to keep connected: read-only cuts its definitions from ~28.9K to ~11.6K tokens.

Step-by-Step Setup

Do just the step for your database.

Supabase — one project, read-only

~2 min

Find your project ref in Project Settings > General (or the part before .supabase.co in your project URL), then:

claude mcp add --scope project --transport http supabase "https://mcp.supabase.com/mcp?project_ref=<your-project-ref>&read_only=true"

project_ref limits it to that one project and hides the account-level tools. Then run /mcp, pick supabase, and choose the organization that owns the project when the browser asks. No token to paste, so the .mcp.json entry is safe to commit.

Neon — read-only URL

~2 min

claude mcp add --scope project --transport http neon "https://mcp.neon.tech/mcp?readonly=true"

Run /mcp, pick neon, and sign in. Neon’s sign-in screen also lets you choose a read-only scope: pick it, so there are two locks instead of one. If you still have an old /sse URL, replace it; Neon retired that endpoint on October 1, 2026.

MongoDB — read-only flag plus a read-only user

~3 min

Check node -v is v22.13.0 or newer, and download the package once so the first connect doesn’t time out:

npx -y mongodb-mcp-server@latest --version

In Atlas, add a database user with the built-in Read any database role and use it in the connection string. Then:

claude mcp add --scope user mongodb --env MDB_MCP_CONNECTION_STRING="mongodb+srv://USER:PASS@cluster0.example.mongodb.net/" -- npx -y mongodb-mcp-server@latest --readOnly

--scope user keeps the password out of the project’s .mcp.json, so it never lands in git.

Verify it

~20 sec

claude mcp list

Your server should show Connected (Supabase and Neon only after the /mcp sign-in). Then ask Claude Code to list your tables or collections. If you see a tool like apply_migration, create_branch, or insert-many in /mcp, the read-only setting didn’t take: remove the entry and add it again.

Robot holding up a check-mark sign in one hand and a red X sign in the other
Read-only lets every query through and stops every write. It doesn’t decide which rows Claude Code gets to see.

Try It (One Prompt Each)

Supabase

List my tables, then show me which ones have RLS disabled and what the security advisor says about them.

You should see: Table names plus advisor warnings, straight from your project.

Neon

Run Neon's database health checks and tell me the three slowest queries and whether an index would help.

You should see: Findings from the built-in checks and query stats, not generic advice.

MongoDB

Infer the schema of the orders collection and explain the query plan for finding a customer's last 10 orders.

You should see: A field list with types and an explain plan that shows whether it scans.

Make It Smaller

Read-only still loads tools you may never use. Both hosted servers let you pick categories in the URL. Measured the same way:

ServerAdd to the URLTools · context
Supabase&features=database,docs5 · ~1.2K
Neon&category=querying&category=schema11 · ~3.6K

That keeps schema reading, SQL, and (for Neon) the health checks and slow-query list. For more ways to cut context, see what actually reduced our Claude Code token usage.

Honest Limits

  • Read-only still reads everything. Customer emails, tokens in a settings table, whatever is there. Point it at a dev project, a Neon branch, or a copy of the data when you can. Neon itself recommends its MCP server for development and testing, not production.
  • Supabase read-only bypasses RLS. It queries as a role that can read every row, so your row-level security policies don’t narrow what Claude Code sees.
  • Query results go into the conversation. Anything a query returns is sent to the model. Ask for counts and samples instead of full table dumps.
  • Text in your data can carry instructions. A row that says “ignore previous instructions” is read like any other text. Keep tool approvals on, and a Claude Code hook can block anything that looks like a write.
  • Our Supabase numbers come from its open-source package. The hosted server needs a sign-in to list tools, so we measured the package from the same repository. Expect a tool or two of difference.

Common Mistakes to Avoid

  • Dropping the read-only setting while debugging. It’s easy to remove it “just for one migration” and forget. Add a second entry with a different name for writes, and remove it when you’re done.
  • Putting a MongoDB password in --scope project. That writes the connection string into .mcp.json, which usually gets committed.
  • Leaving out project_ref on Supabase. Without it the server can see every project in your organization, not just the one you meant.
  • Reading “Connected” as “working”. It only means the server started. Ask for your tables once before you rely on it.

Q&A

Can I connect more than one database?

Yes. Each line adds a separately named server, so Supabase and MongoDB can sit side by side. Each one adds its tool definitions to every session, so remove the ones you aren’t using.

Is read-only enforced by the server or by Claude?

By the server. The write tools are never registered, so Claude Code can’t call them even if asked. Neon’s run_sql is also limited to reads in this mode, and a read-only database user (or Neon’s read-only sign-in scope) adds a lock on the database side.

What about plain Postgres or MySQL?

Anthropic’s old Postgres reference server is archived and had a read-only bypass. The database MCP roundup covers maintained alternatives.

How do I remove one?

claude mcp remove supabase --scope project, claude mcp remove neon --scope project, or claude mcp remove mongodb --scope user.

Official Resources