• 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
/internal/mcp/init/claude_code.go
1
package mcpinit
2

3
import (
4
        "context"
5
        "fmt"
6
        "os"
7
        "os/exec"
8

9
        "github.com/spf13/afero"
10
        "github.com/supabase/cli/internal/utils"
11
)
12

13
// claudeCodeClient implements the Client interface for Claude Code
14
type claudeCodeClient struct {
15
        baseClient
16
}
17

NEW
18
func newClaudeCodeClient() *claudeCodeClient {
×
NEW
19
        return &claudeCodeClient{
×
NEW
20
                baseClient: baseClient{
×
NEW
21
                        name:                "claude-code",
×
NEW
22
                        displayName:         "Claude Code",
×
NEW
23
                        installInstructions: "npm install -g @anthropic-ai/claude-cli",
×
NEW
24
                        checkInstalled: func() bool {
×
NEW
25
                                return commandExists("claude")
×
NEW
26
                        },
×
27
                },
28
        }
29
}
30

NEW
31
func (c *claudeCodeClient) Configure(ctx context.Context, fsys afero.Fs) error {
×
NEW
32
        fmt.Println("Configuring Claude Code...")
×
NEW
33
        fmt.Println()
×
NEW
34

×
NEW
35
        // Use utils.PromptChoice for dropdown
×
NEW
36
        choice, err := utils.PromptChoice(ctx, "Where would you like to add the Claude Code MCP server?", []utils.PromptItem{
×
NEW
37
                {Summary: "local", Details: "Local (only for you in this project)"},
×
NEW
38
                {Summary: "project", Details: "Project (shared via .mcp.json in project root)"},
×
NEW
39
                {Summary: "user", Details: "User (available across all projects for your user)"},
×
NEW
40
        })
×
NEW
41
        if err != nil {
×
NEW
42
                fmt.Printf("⚠️  Warning: failed to select scope for Claude Code MCP server: %v\n", err)
×
NEW
43
                fmt.Println("Defaulting to local scope.")
×
NEW
44
                choice = utils.PromptItem{Summary: "local"}
×
NEW
45
        }
×
46

NEW
47
        cmdArgs := []string{"mcp", "add", "--transport", "http", "supabase", "http://localhost:54321/mcp"}
×
NEW
48
        if choice.Summary != "local" {
×
NEW
49
                cmdArgs = append(cmdArgs, "--scope", choice.Summary)
×
NEW
50
        }
×
NEW
51
        cmd := exec.CommandContext(ctx, "claude", cmdArgs...)
×
NEW
52

×
NEW
53
        cmd.Stdout = os.Stdout
×
NEW
54
        cmd.Stderr = os.Stderr
×
NEW
55

×
NEW
56
        err = cmd.Run()
×
NEW
57
        if err != nil {
×
NEW
58
                fmt.Println()
×
NEW
59
                fmt.Printf("⚠️  Warning: failed to configure Claude Code MCP server: %v\n", err)
×
NEW
60
                fmt.Println("You may need to configure it manually.")
×
NEW
61
        } else {
×
NEW
62
                fmt.Println()
×
NEW
63
                fmt.Println("✓ Successfully added Supabase MCP server to Claude Code!")
×
NEW
64
                fmt.Println()
×
NEW
65
                // Command string display removed (cmdStr no longer exists)
×
NEW
66
                fmt.Println()
×
NEW
67
                fmt.Println("The server is now available in your Claude Code environment.")
×
NEW
68
        }
×
NEW
69
        return nil
×
70
}
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