Skip to content

Commit 9d2bd37

Browse files
authored
Merge pull request #94 from supabase-community/docs/encourage-read-only
docs: encourage read-only mode by default
2 parents 63a062f + d91a101 commit 9d2bd37

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

README.md

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,28 @@ Next, configure your MCP client (such as Cursor) to use this server. Most MCP cl
3636
"args": [
3737
"-y",
3838
"@supabase/mcp-server-supabase@latest",
39-
"--access-token",
40-
"<personal-access-token>"
41-
]
39+
"--read-only",
40+
"--project-ref=<project-ref>"
41+
],
42+
"env": {
43+
"SUPABASE_ACCESS_TOKEN": "<personal-access-token>"
44+
}
4245
}
4346
}
4447
}
4548
```
4649

47-
Replace `<personal-access-token>` with the token you created in step 1. Alternatively you can omit `--access-token` and instead set the `SUPABASE_ACCESS_TOKEN` environment variable to your personal access token (you will need to restart your MCP client after setting this). This allows you to keep your token out of version control if you plan on committing this configuration to a repository.
50+
Replace `<personal-access-token>` with the token you created in step 1. Alternatively you can omit `SUPABASE_ACCESS_TOKEN` in this config and instead set it globally on your machine. This allows you to keep your token out of version control if you plan on committing this configuration to a repository.
4851

49-
The following additional options are available:
52+
The following options are available:
5053

51-
- `--project-ref`: Used to scope the server to a specific project. See [project scoped mode](#project-scoped-mode).
52-
- `--read-only`: Used to restrict the server to read-only queries. See [read-only mode](#read-only-mode).
54+
- `--read-only`: Used to restrict the server to read-only queries. Recommended by default. See [read-only mode](#read-only-mode).
55+
- `--project-ref`: Used to scope the server to a specific project. Recommended by default. If you omit this, the server will have access to all projects in your Supabase account. See [project scoped mode](#project-scoped-mode).
5356

5457
If you are on Windows, you will need to [prefix the command](#windows). If your MCP client doesn't accept JSON, the direct CLI command is:
5558

5659
```shell
57-
npx -y @supabase/mcp-server-supabase@latest --access-token=<personal-access-token>
60+
npx -y @supabase/mcp-server-supabase@latest --read-only --project-ref=<project-ref>
5861
```
5962

6063
> Note: Do not run this command directly - this is meant to be executed by your MCP client in order to start the server. `npx` automatically downloads the latest version of the MCP server from `npm` and runs it in a single command.
@@ -73,9 +76,12 @@ On Windows, you will need to prefix the command with `cmd /c`:
7376
"npx",
7477
"-y",
7578
"@supabase/mcp-server-supabase@latest",
76-
"--access-token",
77-
"<personal-access-token>"
78-
]
79+
"--read-only",
80+
"--project-ref=<project-ref>"
81+
],
82+
"env": {
83+
"SUPABASE_ACCESS_TOKEN": "<personal-access-token>"
84+
}
7985
}
8086
}
8187
}
@@ -92,9 +98,12 @@ or with `wsl` if you are running Node.js inside WSL:
9298
"npx",
9399
"-y",
94100
"@supabase/mcp-server-supabase@latest",
95-
"--access-token",
96-
"<personal-access-token>"
97-
]
101+
"--read-only",
102+
"--project-ref=<project-ref>"
103+
],
104+
"env": {
105+
"SUPABASE_ACCESS_TOKEN": "<personal-access-token>"
106+
}
98107
}
99108
}
100109
}
@@ -118,10 +127,10 @@ Make sure Node.js is available in your system `PATH` environment variable. If yo
118127

119128
### Project scoped mode
120129

121-
By default, the MCP server will have access to all organizations and projects in your Supabase account. If you want to restrict the server to a specific project, you can set the `--project-ref` flag on the CLI command:
130+
Without project scoping, the MCP server will have access to all organizations and projects in your Supabase account. We recommend you restrict the server to a specific project by setting the `--project-ref` flag on the CLI command:
122131

123132
```shell
124-
npx -y @supabase/mcp-server-supabase@latest --access-token=<personal-access-token> --project-ref=<project-ref>
133+
npx -y @supabase/mcp-server-supabase@latest --project-ref=<project-ref>
125134
```
126135

127136
Replace `<project-ref>` with the ID of your project. You can find this under **Project ID** in your Supabase [project settings](https://supabase.com/dashboard/project/_/settings/general).
@@ -130,13 +139,13 @@ After scoping the server to a project, [account-level](#project-management) tool
130139

131140
### Read-only mode
132141

133-
If you wish to restrict the Supabase MCP server to read-only queries, set the `--read-only` flag on the CLI command:
142+
To restrict the Supabase MCP server to read-only queries, set the `--read-only` flag on the CLI command:
134143

135144
```shell
136-
npx -y @supabase/mcp-server-supabase@latest --access-token=<personal-access-token> --read-only
145+
npx -y @supabase/mcp-server-supabase@latest --read-only
137146
```
138147

139-
This prevents write operations on any of your databases by executing SQL as a read-only Postgres user. Note that this flag only applies to database tools (`execute_sql` and `apply_migration`) and not to other tools like `create_project` or `create_branch`.
148+
We recommend you enable this by default. This prevents write operations on any of your databases by executing SQL as a read-only Postgres user. Note that this flag only applies to database tools (`execute_sql` and `apply_migration`) and not to other tools like `create_project` or `create_branch`.
140149

141150
## Tools
142151

0 commit comments

Comments
 (0)