← Back to Pull requests

Docs/multi project setup #290

Open
AnuragRaut08 opened this pull request with 55 lines diff across 1 files
View on GitHub
AnuragRaut08 AnuragRaut08 commented on May 21, 2026 15:54 UTC
Author

Summary

Adds documentation explaining how to configure multiple named MCP
server instances for workflows involving multiple Supabase projects.

This includes:

.mcp.json configuration examples
PAT authentication guidance
Recommended use of --read-only for production
Explanation of why separate server instances avoid OAuth authorization loops

Fixes #233

Diff: 55 lines (+55 / -0) across 1 files Reviewer: gregnr Review duration: 258200m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.34) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.34 · 55 lines diff across 1 files
0.34
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 5 substantive comment(s)
0.89
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
88%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.241
Real PR Conversation Timeline
11 items
gregnr gregnr commented on May 26, 2026 22:33 UTC
Reviewer

Thanks for the PR @AnuragRaut08! In general we don't recommend connecting Supabase MCP to prod due to the security risks involved, so my concern is that documenting multi-env configurations like this would send mixed messages.

One thing that would be great to add though is a specific callout to prefer project-scoped MCP (e.g. .mcp.json files in each repo) over global user-wide MCP (e.g. ~/.claude.json). This way users can scope each repo to their respective Supabase project and simply switching into each repo directory will automatically inherit the correct MCP configuration. Likely many users already do this, but a specific callout would be helpful.

AnuragRaut08 AnuragRaut08 commented on Jun 06, 2026 07:52 UTC
Author

Thanks for the feedback! I've updated the guide to recommend project-scoped MCP configuration files (for example, .mcp.json within each repository) instead of global user-wide configuration, and clarified the multi-project setup guidance accordingly.

gregnr gregnr commented on code on Jun 10, 2026 20:05 UTC
Code Review
README.md:1
@@ -87,6 +87,61 @@ We recommend enabling this setting by default. This prevents write operations on
 `rebase_branch`
 `update_storage_config`.
 
+
+
+
+### Using multiple projects simultaneously
+
+If you work across multiple Supabase projects (in the same org or different orgs), you can run multiple named MCP server instances — one per project — rather than switching a single server between projects.
+
+> [!NOTE]
+> We recommend using project-scoped MCP configuration files (for example, `.mcp.json` inside each repository) instead of global user-wide configuration such as `~/.claude.json`.
+>
+> This helps ensure each repository is automatically associated with the correct Supabase project, reduces configuration mistakes, and makes switching between projects easier.
+
+Create a `.mcp.json` file at your project root:
+
+```json
+{
+  "mcpServers": {
+    "supabase-staging": {
+      "type": "stdio",
+      "command": "npx",
+      "args": [
+        "-y",
+        "@supabase/mcp-server-supabase@latest",
+        "--project-ref=<staging-ref>"
+      ],
+      "env": {
+        "SUPABASE_ACCESS_TOKEN": "<your-pat>"
+      }
+    },
+    "supabase-secondary": {
+      "type": "stdio",
+      "command": "npx",
+      "args": [
+        "-y",
+        "@supabase/mcp-server-supabase@latest",
+        "--read-only",
+        "--project-ref=<secondary-ref>"
+      ],
+      "env": {
+        "SUPABASE_ACCESS_TOKEN": "<your-pat>"
+      }
+    }

Perhaps we can reduce this to a single entry called supabase for demonstration purposes? Also the stdio transport is no longer recommended in favour of the remote HTTP transport (https://mcp.supabase.com/mcp). Can we please change the config accordingly?

gregnr gregnr commented on code on Jun 10, 2026 20:08 UTC
Code Review
README.md:1
@@ -87,6 +87,61 @@ We recommend enabling this setting by default. This prevents write operations on
 `rebase_branch`
 `update_storage_config`.
 
+
+
+
+### Using multiple projects simultaneously
+
+If you work across multiple Supabase projects (in the same org or different orgs), you can run multiple named MCP server instances — one per project — rather than switching a single server between projects.
+
+> [!NOTE]
+> We recommend using project-scoped MCP configuration files (for example, `.mcp.json` inside each repository) instead of global user-wide configuration such as `~/.claude.json`.
+>
+> This helps ensure each repository is automatically associated with the correct Supabase project, reduces configuration mistakes, and makes switching between projects easier.
+
+Create a `.mcp.json` file at your project root:
+
+```json
+{
+  "mcpServers": {
+    "supabase-staging": {
+      "type": "stdio",
+      "command": "npx",
+      "args": [
+        "-y",
+        "@supabase/mcp-server-supabase@latest",
+        "--project-ref=<staging-ref>"
+      ],
+      "env": {
+        "SUPABASE_ACCESS_TOKEN": "<your-pat>"
+      }
+    },
+    "supabase-secondary": {
+      "type": "stdio",
+      "command": "npx",
+      "args": [
+        "-y",
+        "@supabase/mcp-server-supabase@latest",
+        "--read-only",
+        "--project-ref=<secondary-ref>"
+      ],
+      "env": {
+        "SUPABASE_ACCESS_TOKEN": "<your-pat>"
+      }
+    }
+  }
+}
+```
+
+A few things worth knowing:
+
+* **One PAT covers all projects** — Personal Access Tokens are org-scoped, so the same token works for every project in your organization.
+* **`--project-ref` locks the server at startup** — each process only ever talks to one project. In clients like Claude Code, tools get namespaced automatically: `mcp__supabase-staging__*` vs `mcp__supabase-secondary__*`, so you can tell the agent exactly which server to use.
+* **Avoid connecting to production** — prefer development projects whenever possible. If production access is required, use project scoping and read-only mode.
+* **Why not a single server?** — Project scope is resolved at startup. A single server switching projects mid-session may require re-authentication each time. Running separate server instances avoids that workflow entirely.
+
+Generate a Personal Access Token at `supabase.com/dashboard/account/tokens` and use it as `SUPABASE_ACCESS_TOKEN` to avoid OAuth prompts altogether.

Remote MCP (http transport) no longer requires a PAT - the happy path is to simply use OAuth to authorize. Perhaps we can omit most or all of these points?

gregnr gregnr commented on Jun 10, 2026 20:08 UTC
Reviewer

Thanks @AnuragRaut08 🙂 added a few more comments.

AnuragRaut08 AnuragRaut08 commented on Jun 15, 2026 15:13 UTC
Author

Thanks for the additional feedback @gregnr

I've updated the documentation to align with the current recommended MCP workflow:

Replaced the previous stdio transport example with the recommended remote HTTP transport configuration
Simplified the example to a single supabase entry
Removed the PAT-specific and multi-server workflow details to better reflect the current recommended setup
Kept the recommendation for repository-scoped .mcp.json configuration when working across multiple projects

Pushed the updates for another review. Thanks again for the guidance.

AnuragRaut08 AnuragRaut08 commented on Aug 15, 2026 16:46 UTC
Author

@gregnr Any follow up?

AnuragRaut08 AnuragRaut08 commented on code on Oct 18, 2026 13:23 UTC
Code Review
README.md:1
@@ -87,6 +87,61 @@ We recommend enabling this setting by default. This prevents write operations on
 `rebase_branch`
 `update_storage_config`.
 
+
+
+
+### Using multiple projects simultaneously
+
+If you work across multiple Supabase projects (in the same org or different orgs), you can run multiple named MCP server instances — one per project — rather than switching a single server between projects.
+
+> [!NOTE]
+> We recommend using project-scoped MCP configuration files (for example, `.mcp.json` inside each repository) instead of global user-wide configuration such as `~/.claude.json`.
+>
+> This helps ensure each repository is automatically associated with the correct Supabase project, reduces configuration mistakes, and makes switching between projects easier.
+
+Create a `.mcp.json` file at your project root:
+
+```json
+{
+  "mcpServers": {
+    "supabase-staging": {
+      "type": "stdio",
+      "command": "npx",
+      "args": [
+        "-y",
+        "@supabase/mcp-server-supabase@latest",
+        "--project-ref=<staging-ref>"
+      ],
+      "env": {
+        "SUPABASE_ACCESS_TOKEN": "<your-pat>"
+      }
+    },
+    "supabase-secondary": {
+      "type": "stdio",
+      "command": "npx",
+      "args": [
+        "-y",
+        "@supabase/mcp-server-supabase@latest",
+        "--read-only",
+        "--project-ref=<secondary-ref>"
+      ],
+      "env": {
+        "SUPABASE_ACCESS_TOKEN": "<your-pat>"
+      }
+    }

Replaced the two stdio server entries with a single remote HTTP configuration using https://mcp.supabase.com/mcp.

AnuragRaut08 AnuragRaut08 commented on code on Oct 18, 2026 13:23 UTC
Code Review
README.md:1
@@ -87,6 +87,61 @@ We recommend enabling this setting by default. This prevents write operations on
 `rebase_branch`
 `update_storage_config`.
 
+
+
+
+### Using multiple projects simultaneously
+
+If you work across multiple Supabase projects (in the same org or different orgs), you can run multiple named MCP server instances — one per project — rather than switching a single server between projects.
+
+> [!NOTE]
+> We recommend using project-scoped MCP configuration files (for example, `.mcp.json` inside each repository) instead of global user-wide configuration such as `~/.claude.json`.
+>
+> This helps ensure each repository is automatically associated with the correct Supabase project, reduces configuration mistakes, and makes switching between projects easier.
+
+Create a `.mcp.json` file at your project root:
+
+```json
+{
+  "mcpServers": {
+    "supabase-staging": {
+      "type": "stdio",
+      "command": "npx",
+      "args": [
+        "-y",
+        "@supabase/mcp-server-supabase@latest",
+        "--project-ref=<staging-ref>"
+      ],
+      "env": {
+        "SUPABASE_ACCESS_TOKEN": "<your-pat>"
+      }
+    },
+    "supabase-secondary": {
+      "type": "stdio",
+      "command": "npx",
+      "args": [
+        "-y",
+        "@supabase/mcp-server-supabase@latest",
+        "--read-only",
+        "--project-ref=<secondary-ref>"
+      ],
+      "env": {
+        "SUPABASE_ACCESS_TOKEN": "<your-pat>"
+      }
+    }
+  }
+}
+```
+
+A few things worth knowing:
+
+* **One PAT covers all projects** — Personal Access Tokens are org-scoped, so the same token works for every project in your organization.
+* **`--project-ref` locks the server at startup** — each process only ever talks to one project. In clients like Claude Code, tools get namespaced automatically: `mcp__supabase-staging__*` vs `mcp__supabase-secondary__*`, so you can tell the agent exactly which server to use.
+* **Avoid connecting to production** — prefer development projects whenever possible. If production access is required, use project scoping and read-only mode.
+* **Why not a single server?** — Project scope is resolved at startup. A single server switching projects mid-session may require re-authentication each time. Running separate server instances avoids that workflow entirely.
+
+Generate a Personal Access Token at `supabase.com/dashboard/account/tokens` and use it as `SUPABASE_ACCESS_TOKEN` to avoid OAuth prompts altogether.

Removed the PAT-based authentication guidance and simplified the explanation around OAuth and project-scoped configuration.

AnuragRaut08 AnuragRaut08 commented on Oct 18, 2026 13:26 UTC
Author

Hi @gregnr — following up on this PR. Thanks again for the earlier feedback; I've incorporated the requested direction into a refreshed version of the documentation.

The update uses the recommended remote HTTP transport, simplifies the example to a single supabase entry with OAuth, and retains the recommendation for repository-scoped .mcp.json configuration.

Since the original branch is now outdated and has merge conflicts, I've refreshed the change against the current main branch to keep the diff focused and avoid unrelated changes.

Could you please take a look at the refreshed PR when you get a chance? If the approach looks good, I'd appreciate your review so we can get this documentation improvement merged and close out the original issue. Thanks!

Reviewers
Assignees
AnuragRaut08 AnuragRaut08
Labels
risk: low confidence: 88.6% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 34.1% (LOW) · Higher = larger blast radius
34.1%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 88.6% · Lower = rushed or shallow review
88.6%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 3.9% · Safe to merge
3.9%
Repository