cli icon indicating copy to clipboard operation
cli copied to clipboard

feat(mcp): add `supabase init` command to configure MCP clients

Open Rodriguespn opened this issue 3 months ago • 4 comments

What kind of change does this PR introduce?

Feature enhancement to supabase init command.

What is the current behavior?

supabase init initializes a local Supabase project but doesn't configure MCP (Model Context Protocol) clients.

What is the new behavior?

After running supabase init, users are now prompted to configure the Supabase MCP server for their preferred client through an interactive flow.

Expected User Interaction

When running supabase init, users will experience the following flow:

➜ supabase init
Generate VS Code settings for Deno? [y/N] n
Generate IntelliJ Settings for Deno? [y/N] n
Configure Supabase MCP server locally? [y/N] y

If user answers "yes", they see a dropdown menu:

Which client do you want to configure?
  • claude-code    (Claude Code)
  • cursor         (Cursor)
  • vscode         (VS Code)
  • other          (Configure it manually)

Navigation: Use arrow keys ↑/↓ to navigate, Enter to select

Option 1: Claude Code

If selected, automatically runs:

claude mcp add --transport http supabase http://localhost:54321/mcp

Option 2: Cursor

If selected, prompts for scope (also a dropdown):

Where would you like to add the configuration?
  • project    (Project-local (in .cursor/mcp.json))
  • global     (Global (in your home directory))

Creates/updates the selected config file with:

{
  "mcpServers": {
    "supabase": {
      "url": "http://localhost:54321/mcp"
    }
  }
}

Option 3: VS Code

If selected, prompts for scope (dropdown):

Where would you like to add the configuration?
  • project    (Project-local (in .vscode/mcp.json))
  • global     (Global (in your home directory))

Creates/updates the selected config file with:

{
  "servers": {
    "supabase": {
      "type": "http",
      "url": "http://localhost:54321/mcp"
    }
  }
}

Option 4: Other

If selected, skips automatic configuration. Users can configure manually later.

Final output:

Finished supabase init.

Related Issues

Implements requirements from Linear issue AI-81

Rodriguespn avatar Oct 29 '25 15:10 Rodriguespn

Pull Request Test Coverage Report for Build 19194338182

Details

  • 0 of 355 (0.0%) changed or added relevant lines in 9 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-1.6%) to 53.056%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/mcp.go 0 3 0.0%
cmd/mcp_init.go 0 8 0.0%
internal/mcp/init/utils.go 0 11 0.0%
cmd/init.go 0 18 0.0%
internal/mcp/init/client.go 0 18 0.0%
internal/mcp/init/claude_code.go 0 47 0.0%
internal/mcp/init/init.go 0 78 0.0%
internal/mcp/init/cursor.go 0 84 0.0%
internal/mcp/init/vscode.go 0 88 0.0%
<!-- Total: 0 355
Files with Coverage Reduction New Missed Lines %
internal/gen/keys/keys.go 5 12.9%
<!-- Total: 5
Totals Coverage Status
Change from base Build 19176861370: -1.6%
Covered Lines: 6388
Relevant Lines: 12040

💛 - Coveralls

coveralls avatar Oct 29 '25 15:10 coveralls

Addressed @sweatybridge's suggestion to move MCP configuration under supabase init:

  • Added a new flag: --mcp-client
  • Usage: supabase init --mcp-client=claude-code (also supports cursor, vscode)
  • This runs MCP setup after project scaffolding and configures the chosen client

Kept supabase mcp init for now to support interactive/targeted setup, but the flag should cover the review's intent. Happy to consolidate further if you'd prefer removing the mcp command entirely.

Rodriguespn avatar Nov 05 '25 14:11 Rodriguespn

Hey @sweatybridge, brainstormed about this with @gregnr and we've decided to go on a different direction. It's still under development but I'll change the Linear issue with the new approach to this once we have it. Converting this PR into a draft one

Rodriguespn avatar Nov 05 '25 16:11 Rodriguespn

@sweatybridge ready for review. I've updated the description with the expected behavior

Rodriguespn avatar Nov 08 '25 14:11 Rodriguespn