You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) standardizes how Large Language Models (LLMs) talk to external services like Supabase. It connects AI assistants directly with your Supabase project and allows them to perform tasks like managing tables, fetching config, and querying data. See the [full list of tools](#tools).
8
8
9
-
## Prerequisites
10
-
11
-
You will need Node.js ([active LTS](https://nodejs.org/en/about/previous-releases) or newer) installed on your machine. You can check this by running:
12
-
13
-
```shell
14
-
node -v
15
-
```
16
-
17
-
If you don't have Node.js 22+ installed, you can download it from [nodejs.org](https://nodejs.org/).
18
-
19
9
## Setup
20
10
21
-
### 1. Personal access token (PAT)
22
-
23
-
First, go to your [Supabase settings](https://supabase.com/dashboard/account/tokens) and create a personal access token. Give it a name that describes its purpose, like "Cursor MCP Server".
24
-
25
-
This will be used to authenticate the MCP server with your Supabase account. Make sure to copy the token, as you won't be able to see it again.
26
-
27
-
### 2. Configure MCP client
28
-
29
-
Next, configure your MCP client (such as Cursor) to use this server. Most MCP clients store the configuration as JSON in the following format:
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.
51
-
52
-
The following options are available:
53
-
54
-
-`--read-only`: Used to restrict the server to read-only queries and tools. 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).
56
-
-`--features`: Used to specify which tool groups to enable. See [feature groups](#feature-groups).
11
+
### 1. Follow our security best practices
57
12
58
-
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:
Before setting up the MCP server, we recommend you read our [security best practices](#security-risks) to understand the risks of connecting an LLM to your Supabase projects and how to mitigate them.
63
14
64
-
> 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.
65
15
66
-
#### Windows
16
+
###2. Configure your MCP client
67
17
68
-
On Windows, you will need to prefix the command with `cmd /c`:
18
+
The Supabase MCP server is hosted at `https://mcp.supabase.com/mcp` and supports the Streamable HTTP transport with OAuth authentication. If you're running Supabase locally with [Supabase CLI](https://supabase.com/docs/guides/local-development/cli/getting-started), you can access the MCP server at `http://localhost:54321/mcp` with a subset of tools.
The easiest way to connect your MCP client (such as Cursor) to your project is clicking [Connect](https://supabase.com/dashboard/project/_?showConnect=true&tab=mcp) in the Supabase dashboard and navigating to the MCP tab. There you can choose options such as [feature groups](#feature-groups), and generate one-click installers or config entries for popular clients.
90
21
91
-
or with `wsl` if you are running Node.js inside WSL:
22
+
Most MCP clients store the configuration as JSON in the following format:
Make sure Node.js is available in your system `PATH` environment variable. If you are running Node.js natively on Windows, you can set this by running the following commands in your terminal.
114
-
115
-
1. Get the path to `npm`:
35
+
Your MCP client will automatically prompt you to login to Supabase during setup. This will open a browser window where you can login to your Supabase account and grant access to the MCP client. Be sure to choose the organization that contains the project you wish to work with. In the future, we'll offer more fine grain control over these permissions.
116
36
117
-
```shell
118
-
npm config get prefix
119
-
```
37
+
For more information, visit the [Supabase MCP docs](https://supabase.com/docs/guides/getting-started/mcp).
120
38
121
-
2. Add the directory to your PATH:
39
+
## Options
122
40
123
-
```shell
124
-
setx PATH "%PATH%;<path-to-dir>"
125
-
```
41
+
The following options are configurable as URL query parameters:
126
42
127
-
3. Restart your MCP client.
43
+
-`read_only`: Used to restrict the server to read-only queries and tools. Recommended by default. See [read-only mode](#read-only-mode).
44
+
-`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).
45
+
-`features`: Used to specify which tool groups to enable. See [feature groups](#feature-groups).
128
46
129
-
### 3. Follow our security best practices
130
-
131
-
Before running the MCP server, we recommend you read our [security best practices](#security-risks) to understand the risks of connecting an LLM to your Supabase projects and how to mitigate them.
47
+
When using the URL in the dashboard or docs, these parameters will be populated for you.
132
48
133
49
### Project scoped mode
134
50
135
-
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:
51
+
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` query parameter in the server URL:
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).
@@ -144,10 +60,10 @@ After scoping the server to a project, [account-level](#project-management) tool
144
60
145
61
### Read-only mode
146
62
147
-
To restrict the Supabase MCP server to read-only queries, set the `--read-only` flag on the CLI command:
63
+
To restrict the Supabase MCP server to read-only queries, set the `read_only` query parameter in the server URL:
We recommend enabling this setting by default. This prevents write operations on any of your databases by executing SQL as a read-only Postgres user (via `execute_sql`). All other mutating tools are disabled in read-only mode, including:
@@ -165,15 +81,15 @@ We recommend enabling this setting by default. This prevents write operations on
165
81
166
82
### Feature groups
167
83
168
-
You can enable or disable specific tool groups by passing the `--features`flag to the MCP server. This allows you to customize which tools are available to the LLM. For example, to enable only the [database](#database) and [docs](#knowledge-base) tools, you would run:
84
+
You can enable or disable specific tool groups by passing the `features`query parameter to the MCP server. This allows you to customize which tools are available to the LLM. For example, to enable only the [database](#database) and [docs](#knowledge-base) tools, you would specify the server URL as:
Available groups are: [`account`](#account), [`docs`](#knowledge-base), [`database`](#database), [`debugging`](#debugging), [`development`](#development), [`functions`](#edge-functions), [`storage`](#storage), and [`branching`](#branching-experimental-requires-a-paid-plan).
175
91
176
-
If this flag is not passed, the default feature groups are: `account`, `database`, `debugging`, `development`, `docs`, `functions`, and `branching`.
92
+
If this parameter is not set, the default feature groups are: `account`, `database`, `debugging`, `development`, `docs`, `functions`, and `branching`.
177
93
178
94
## Tools
179
95
@@ -183,7 +99,7 @@ The following Supabase tools are available to the LLM, [grouped by feature](#fea
183
99
184
100
#### Account
185
101
186
-
Enabled by default when no `--project-ref` is passed. Use `account` to target this group of tools with the [`--features`](#feature-groups) option.
102
+
Enabled by default when no `project_ref` is set. Use `account` to target this group of tools with the [`features`](#feature-groups) option.
187
103
188
104
_**Note:** these tools will be unavailable if the server is [scoped to a project](#project-scoped-mode)._
189
105
@@ -199,13 +115,13 @@ _**Note:** these tools will be unavailable if the server is [scoped to a project
199
115
200
116
#### Knowledge Base
201
117
202
-
Enabled by default. Use `docs` to target this group of tools with the [`--features`](#feature-groups) option.
118
+
Enabled by default. Use `docs` to target this group of tools with the [`features`](#feature-groups) option.
203
119
204
120
-`search_docs`: Searches the Supabase documentation for up-to-date information. LLMs can use this to find answers to questions or learn how to use specific features.
205
121
206
122
#### Database
207
123
208
-
Enabled by default. Use `database` to target this group of tools with the [`--features`](#feature-groups) option.
124
+
Enabled by default. Use `database` to target this group of tools with the [`features`](#feature-groups) option.
209
125
210
126
-`list_tables`: Lists all tables within the specified schemas.
211
127
-`list_extensions`: Lists all extensions in the database.
@@ -215,30 +131,30 @@ Enabled by default. Use `database` to target this group of tools with the [`--fe
215
131
216
132
#### Debugging
217
133
218
-
Enabled by default. Use `debugging` to target this group of tools with the [`--features`](#feature-groups) option.
134
+
Enabled by default. Use `debugging` to target this group of tools with the [`features`](#feature-groups) option.
219
135
220
136
-`get_logs`: Gets logs for a Supabase project by service type (api, postgres, edge functions, auth, storage, realtime). LLMs can use this to help with debugging and monitoring service performance.
221
137
-`get_advisors`: Gets a list of advisory notices for a Supabase project. LLMs can use this to check for security vulnerabilities or performance issues.
222
138
223
139
#### Development
224
140
225
-
Enabled by default. Use `development` to target this group of tools with the [`--features`](#feature-groups) option.
141
+
Enabled by default. Use `development` to target this group of tools with the [`features`](#feature-groups) option.
226
142
227
143
-`get_project_url`: Gets the API URL for a project.
228
144
-`get_anon_key`: Gets the anonymous API key for a project.
229
145
-`generate_typescript_types`: Generates TypeScript types based on the database schema. LLMs can save this to a file and use it in their code.
230
146
231
147
#### Edge Functions
232
148
233
-
Enabled by default. Use `functions` to target this group of tools with the [`--features`](#feature-groups) option.
149
+
Enabled by default. Use `functions` to target this group of tools with the [`features`](#feature-groups) option.
234
150
235
151
-`list_edge_functions`: Lists all Edge Functions in a Supabase project.
236
152
-`get_edge_function`: Retrieves file contents for an Edge Function in a Supabase project.
237
153
-`deploy_edge_function`: Deploys a new Edge Function to a Supabase project. LLMs can use this to deploy new functions or update existing ones.
238
154
239
155
#### Branching (Experimental, requires a paid plan)
240
156
241
-
Enabled by default. Use `branching` to target this group of tools with the [`--features`](#feature-groups) option.
157
+
Enabled by default. Use `branching` to target this group of tools with the [`features`](#feature-groups) option.
242
158
243
159
-`create_branch`: Creates a development branch with migrations from production branch.
244
160
-`list_branches`: Lists all development branches.
@@ -249,7 +165,7 @@ Enabled by default. Use `branching` to target this group of tools with the [`--f
249
165
250
166
#### Storage
251
167
252
-
Disabled by default to reduce tool count. Use `storage` to target this group of tools with the [`--features`](#feature-groups) option.
168
+
Disabled by default to reduce tool count. Use `storage` to target this group of tools with the [`features`](#feature-groups) option.
253
169
254
170
-`list_storage_buckets`: Lists all storage buckets in a Supabase project.
255
171
-`get_storage_config`: Gets the storage config for a Supabase project.
0 commit comments