99 "github.com/spf13/cobra"
1010 "github.com/spf13/viper"
1111 _init "github.com/supabase/cli/internal/init"
12+ mcpinit "github.com/supabase/cli/internal/mcp/init"
1213 "github.com/supabase/cli/internal/utils"
1314)
1415
@@ -34,16 +35,29 @@ var (
3435 }
3536 },
3637 RunE : func (cmd * cobra.Command , args []string ) error {
37- fsys := afero .NewOsFs ()
38- if ! cmd .Flags ().Changed ("with-vscode-settings" ) && ! cmd .Flags ().Changed ("with-vscode-workspace" ) {
39- createVscodeSettings = nil
40- }
38+ fsys := afero .NewOsFs ()
39+ if ! cmd .Flags ().Changed ("with-vscode-settings" ) && ! cmd .Flags ().Changed ("with-vscode-workspace" ) {
40+ createVscodeSettings = nil
41+ }
4142
42- if ! cmd .Flags ().Changed ("with-intellij-settings" ) {
43- createIntellijSettings = nil
44- }
45- ctx , _ := signal .NotifyContext (cmd .Context (), os .Interrupt )
46- return _init .Run (ctx , fsys , createVscodeSettings , createIntellijSettings , initParams )
43+ if ! cmd .Flags ().Changed ("with-intellij-settings" ) {
44+ createIntellijSettings = nil
45+ }
46+ ctx , _ := signal .NotifyContext (cmd .Context (), os .Interrupt )
47+
48+ // Run core project init first
49+ if err := _init .Run (ctx , fsys , createVscodeSettings , createIntellijSettings , initParams ); err != nil {
50+ return err
51+ }
52+
53+ // Optionally configure MCP client if flag is provided
54+ mcpClient , _ := cmd .Flags ().GetString ("mcp-client" )
55+ if mcpClient != "" {
56+ if err := mcpinit .Run (ctx , fsys , mcpClient ); err != nil {
57+ return err
58+ }
59+ }
60+ return nil
4761 },
4862 PostRun : func (cmd * cobra.Command , args []string ) {
4963 fmt .Println ("Finished " + utils .Aqua ("supabase init" ) + "." )
@@ -59,5 +73,6 @@ func init() {
5973 flags .BoolVar (createIntellijSettings , "with-intellij-settings" , false , "Generate IntelliJ IDEA settings for Deno." )
6074 flags .BoolVar (& initParams .UseOrioleDB , "use-orioledb" , false , "Use OrioleDB storage engine for Postgres." )
6175 flags .BoolVar (& initParams .Overwrite , "force" , false , "Overwrite existing " + utils .ConfigPath + "." )
76+ flags .String ("mcp-client" , "" , "Configure Supabase MCP for a client (e.g., claude-code, cursor, vscode). Runs after project init if provided." )
6277 rootCmd .AddCommand (initCmd )
6378}
0 commit comments