• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / cli / 19194338182

08 Nov 2025 02:29PM UTC coverage: 53.056% (-1.6%) from 54.689%
19194338182

Pull #4383

github

web-flow
Merge a898faa1b into af2b11bea
Pull Request #4383: feat(mcp): add `supabase mcp init` command to configure MCP clients

0 of 355 new or added lines in 9 files covered. (0.0%)

5 existing lines in 1 file now uncovered.

6388 of 12040 relevant lines covered (53.06%)

5.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/init.go
1
package cmd
2

3
import (
4
        "fmt"
5
        "os"
6
        "os/signal"
7

8
        "github.com/spf13/afero"
9
        "github.com/spf13/cobra"
10
        "github.com/spf13/viper"
11
        _init "github.com/supabase/cli/internal/init"
12
        mcpinit "github.com/supabase/cli/internal/mcp/init"
13
        "github.com/supabase/cli/internal/utils"
14
)
15

16
var (
17
        createVscodeSettings   = new(bool)
18
        createIntellijSettings = new(bool)
19
        initParams             = utils.InitParams{}
20

21
        initCmd = &cobra.Command{
22
                GroupID: groupLocalDev,
23
                Use:     "init",
24
                Short:   "Initialize a local project",
25
                PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
×
26
                        if !viper.IsSet("WORKDIR") {
×
27
                                // Prevents recursing to parent directory
×
28
                                viper.Set("WORKDIR", ".")
×
29
                        }
×
30
                        return cmd.Root().PersistentPreRunE(cmd, args)
×
31
                },
32
                PreRun: func(cmd *cobra.Command, args []string) {
×
33
                        if initParams.UseOrioleDB {
×
34
                                cobra.CheckErr(cmd.MarkFlagRequired("experimental"))
×
35
                        }
×
36
                },
37
                RunE: func(cmd *cobra.Command, args []string) error {
×
38
                        fsys := afero.NewOsFs()
×
39
                        if !cmd.Flags().Changed("with-vscode-settings") && !cmd.Flags().Changed("with-vscode-workspace") {
×
40
                                createVscodeSettings = nil
×
41
                        }
×
42

43
                        if !cmd.Flags().Changed("with-intellij-settings") {
×
44
                                createIntellijSettings = nil
×
45
                        }
×
46
                        ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
×
NEW
47

×
NEW
48
                        // Run core project init first
×
NEW
49
                        if err := _init.Run(ctx, fsys, createVscodeSettings, createIntellijSettings, initParams); err != nil {
×
NEW
50
                                return err
×
NEW
51
                        }
×
52

53
                        // Prompt for MCP configuration if in interactive mode
NEW
54
                        console := utils.NewConsole()
×
NEW
55
                        if configureMCP, err := console.PromptYesNo(ctx, "Configure Supabase MCP server locally?", false); err != nil {
×
NEW
56
                                return err
×
NEW
57
                        } else if configureMCP {
×
NEW
58
                                clientName, err := mcpinit.PromptMCPClient(ctx)
×
NEW
59
                                if err != nil {
×
NEW
60
                                        return err
×
NEW
61
                                }
×
62
                                // Skip configuration if user selected "other"
NEW
63
                                if clientName != "other" {
×
NEW
64
                                        if err := mcpinit.Run(ctx, fsys, clientName); err != nil {
×
NEW
65
                                                return err
×
NEW
66
                                        }
×
67
                                }
68
                        }
69

NEW
70
                        return nil
×
71
                },
72
                PostRun: func(cmd *cobra.Command, args []string) {
×
73
                        fmt.Println("Finished " + utils.Aqua("supabase init") + ".")
×
74
                },
×
75
        }
76
)
77

78
func init() {
×
79
        flags := initCmd.Flags()
×
80
        flags.BoolVar(createVscodeSettings, "with-vscode-workspace", false, "Generate VS Code workspace.")
×
81
        cobra.CheckErr(flags.MarkHidden("with-vscode-workspace"))
×
82
        flags.BoolVar(createVscodeSettings, "with-vscode-settings", false, "Generate VS Code settings for Deno.")
×
83
        flags.BoolVar(createIntellijSettings, "with-intellij-settings", false, "Generate IntelliJ IDEA settings for Deno.")
×
84
        flags.BoolVar(&initParams.UseOrioleDB, "use-orioledb", false, "Use OrioleDB storage engine for Postgres.")
×
85
        flags.BoolVar(&initParams.Overwrite, "force", false, "Overwrite existing "+utils.ConfigPath+".")
×
86
        rootCmd.AddCommand(initCmd)
×
87
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc