88 "path/filepath"
99
1010 "github.com/spf13/afero"
11+ "github.com/supabase/cli/internal/utils"
1112)
1213
1314// cursorClient implements the Client interface for Cursor
@@ -32,22 +33,16 @@ func (c *cursorClient) Configure(ctx context.Context, fsys afero.Fs) error {
3233 fmt .Println ("Configuring Cursor..." )
3334 fmt .Println ()
3435
35- // Prompt for config scope
36- fmt .Println ("Where would you like to add the configuration?" )
37- fmt .Println (" 1. Project-local (in .cursor/mcp.json)" )
38- fmt .Println (" 2. Global (in your home directory)" )
39- fmt .Print ("Choice [1]: " )
40-
41- var choice string
42- if _ , err := fmt .Scanln (& choice ); err != nil && err .Error () != "unexpected newline" {
43- return fmt .Errorf ("failed to read choice: %w" , err )
44- }
45- if choice == "" {
46- choice = "1"
36+ choice , err := utils .PromptChoice (ctx , "Where would you like to add the configuration?" , []utils.PromptItem {
37+ {Summary : "project" , Details : "Project-local (in .cursor/mcp.json)" },
38+ {Summary : "global" , Details : "Global (in your home directory)" },
39+ })
40+ if err != nil {
41+ return err
4742 }
4843
4944 var configPath string
50- if choice == "2 " {
45+ if choice . Summary == "global " {
5146 // Global config
5247 homeDir , _ := os .UserHomeDir ()
5348 configPath = filepath .Join (homeDir , ".cursor" , "mcp.json" )
@@ -59,7 +54,8 @@ func (c *cursorClient) Configure(ctx context.Context, fsys afero.Fs) error {
5954
6055 // Prepare the Supabase MCP server config
6156 supabaseConfig := map [string ]interface {}{
62- "url" : "http://localhost:54321/mcp" ,
57+ "type" : "http" ,
58+ "url" : "http://localhost:54321/mcp" ,
6359 }
6460
6561 // Read existing config if it exists
@@ -100,18 +96,24 @@ func (c *cursorClient) Configure(ctx context.Context, fsys afero.Fs) error {
10096 return fmt .Errorf ("failed to write config file: %w" , err )
10197 }
10298
99+ // Generate example for display
100+ configExample , _ := json .MarshalIndent (map [string ]interface {}{
101+ "mcpServers" : map [string ]interface {}{
102+ "supabase" : supabaseConfig ,
103+ },
104+ }, "" , " " )
105+
103106 fmt .Println ()
104107 fmt .Printf ("✓ Successfully configured Cursor at: %s\n " , configPath )
105108 fmt .Println ()
106109 fmt .Println ("Configuration added:" )
107- fmt .Println (`{
108- "mcpServers": {
109- "supabase": {
110- "url": "http://localhost:54321/mcp"
111- }
112- }
113- }` )
110+ fmt .Println (string (configExample ))
111+ fmt .Println ()
112+ fmt .Println ("Next steps:" )
113+ fmt .Println (" 1. Open Cursor" )
114+ fmt .Println (" 2. Navigate to Cursor Settings > Tools & MCP" )
115+ fmt .Println (" 3. Enable the 'supabase' MCP server" )
114116 fmt .Println ()
115- fmt .Println ("The Supabase MCP server is now available in Cursor!" )
117+ fmt .Println ("The Supabase MCP server will then be available in Cursor!" )
116118 return nil
117119}
0 commit comments