Skip to content

Conversation

gregnr
Copy link
Collaborator

@gregnr gregnr commented Apr 23, 2025

Allows you to scope the MCP server to a specific project via the --project-ref CLI flag:

{
  "mcpServers": {
    "supabase": {
      "command": "npx",
      "args": [
        "-y",
        "@supabase/mcp-server-supabase@latest",
        "--access-token",
        "<personal-access-token>",
        "--project-ref",
        "<project-ref>"
      ]
    }
  }
}

This is useful for:

  • Defining in an MCP JSON config that is committed to version control so that you can link a local project with the remote Supabase project
  • Ensuring that the LLM only operates on the specified project and not others
  • Reducing the number of tools

Under the hood

When you configure the server with a specific project ID, all tools that previously accepted a project_id parameter will omit that parameter from its tool definition and statically set it to the configured ID. Specifically we create an injectableTool() function that allows us to define tools with an optional inject property that performs the above logic. This allows us implement this scoping logic without duplicating every single tool definition for each mode.

Additionally we omit any account-level tools (like list_organizations, list_projects, etc) when in project scoped mode. This has the added benefit of reducing the number of tools we need for clients like Cursor who limit the total number of tools to 40.

@gregnr gregnr merged commit e30a8be into main Apr 25, 2025
1 check passed
GQAdonis pushed a commit to skytok-net/supabase-mcp that referenced this pull request Aug 14, 2025
…/project-scoped

feat: project scoped server option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants