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

supabase / cli / 19105505226

05 Nov 2025 02:34PM UTC coverage: 53.269% (-1.4%) from 54.699%
19105505226

Pull #4383

github

web-flow
Merge 79948e448 into 4054f205d
Pull Request #4383: feat(mcp): add `supabase mcp init` command to configure MCP clients

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

5 existing lines in 1 file now uncovered.

6388 of 11992 relevant lines covered (53.27%)

5.97 hits per line

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

0.0
/internal/mcp/init/init.go
1
package mcpinit
2

3
import (
4
        "context"
5
        "fmt"
6

7
        "github.com/spf13/afero"
8
)
9

10
// clientRegistry holds all supported clients
11
var clientRegistry = []Client{
12
        newClaudeCodeClient(),
13
        newCursorClient(),
14
        newVSCodeClient(),
15
}
16

NEW
17
func Run(ctx context.Context, fsys afero.Fs, clientFlag string) error {
×
NEW
18
        // If a specific client is requested
×
NEW
19
        if clientFlag != "" {
×
NEW
20
                return configureSpecificClient(ctx, fsys, clientFlag)
×
NEW
21
        }
×
22

23
        // Find installed clients
NEW
24
        var installedClients []Client
×
NEW
25
        for _, client := range clientRegistry {
×
NEW
26
                if client.IsInstalled() {
×
NEW
27
                        installedClients = append(installedClients, client)
×
NEW
28
                }
×
29
        }
30

31
        // If no clients installed, show available options
NEW
32
        if len(installedClients) == 0 {
×
NEW
33
                fmt.Println("No MCP clients detected on this system.")
×
NEW
34
                fmt.Println()
×
NEW
35
                fmt.Println("Available clients:")
×
NEW
36
                for _, client := range clientRegistry {
×
NEW
37
                        fmt.Printf("  • %s\n", client.DisplayName())
×
NEW
38
                        fmt.Printf("    Install: %s\n", client.InstallInstructions())
×
NEW
39
                        fmt.Println()
×
NEW
40
                }
×
NEW
41
                fmt.Println("After installing a client, run this command again.")
×
NEW
42
                return nil
×
43
        }
44

45
        // If only one client is installed, configure it directly
NEW
46
        if len(installedClients) == 1 {
×
NEW
47
                client := installedClients[0]
×
NEW
48
                fmt.Printf("Detected %s\n", client.DisplayName())
×
NEW
49
                fmt.Println()
×
NEW
50
                return client.Configure(ctx, fsys)
×
NEW
51
        }
×
52

53
        // Multiple clients installed - show options
NEW
54
        fmt.Println("Multiple MCP clients detected:")
×
NEW
55
        for i, client := range installedClients {
×
NEW
56
                fmt.Printf("  %d. %s\n", i+1, client.DisplayName())
×
NEW
57
        }
×
NEW
58
        fmt.Println()
×
NEW
59
        fmt.Println("Use the --client flag to configure a specific client:")
×
NEW
60
        for _, client := range installedClients {
×
NEW
61
                fmt.Printf("  supabase mcp init --client %s\n", client.Name())
×
NEW
62
        }
×
63

NEW
64
        return nil
×
65
}
66

NEW
67
func configureSpecificClient(ctx context.Context, fsys afero.Fs, clientName string) error {
×
NEW
68
        // Find the requested client
×
NEW
69
        var targetClient Client
×
NEW
70
        for _, client := range clientRegistry {
×
NEW
71
                if client.Name() == clientName {
×
NEW
72
                        targetClient = client
×
NEW
73
                        break
×
74
                }
75
        }
76

NEW
77
        if targetClient == nil {
×
NEW
78
                fmt.Printf("❌ Unknown client: %s\n\n", clientName)
×
NEW
79
                fmt.Println("Supported clients:")
×
NEW
80
                for _, client := range clientRegistry {
×
NEW
81
                        fmt.Printf("  • %s\n", client.Name())
×
NEW
82
                }
×
NEW
83
                return fmt.Errorf("unknown client: %s", clientName)
×
84
        }
85

86
        // Check if installed
NEW
87
        if !targetClient.IsInstalled() {
×
NEW
88
                fmt.Printf("❌ %s is not installed on this system.\n\n", targetClient.DisplayName())
×
NEW
89
                fmt.Println("To install:")
×
NEW
90
                fmt.Printf("  %s\n", targetClient.InstallInstructions())
×
NEW
91
                return nil
×
NEW
92
        }
×
93

94
        // Configure
NEW
95
        fmt.Printf("Configuring %s...\n\n", targetClient.DisplayName())
×
NEW
96
        return targetClient.Configure(ctx, fsys)
×
97
}
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