- 
                Notifications
    
You must be signed in to change notification settings  - Fork 307
 
          feat(mcp): add supabase mcp init command to configure MCP clients
          #4383
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Draft
      
      
            Rodriguespn
  wants to merge
  12
  commits into
  develop
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
feat/mcp-init-command
  
      
      
   
  
    
  
  
  
 
  
      
    base: develop
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    - Add main mcp command group in cmd/mcp.go - Add mcp init subcommand in cmd/mcp_init.go - Create internal/mcp/init package for implementation - Provides basic structure for interactive MCP server setup wizard This implements the foundation for AI-81: CLI init command that will: - Guide users through obtaining a Supabase PAT - Detect installed MCP clients (Cursor, VS Code, Claude Desktop) - Generate appropriate configuration files - Securely store credentials Related: https://linear.app/supabase/issue/AI-81/cli-init
Change mcpCmd.GroupID from groupManagementAPI to groupQuickStart to avoid requiring authentication before running mcp init. The init command should be accessible without prior login as it guides users through setup.
- Add --client flag to specify target MCP client - Implement client detection for Cursor, VS Code, Claude Desktop, Claude Code, Windsurf, and Cline - Generate platform-specific config templates based on official Supabase docs - Display setup instructions for each client type - Support macOS, Windows, and Linux config paths
…ude Code - Add configureJSONClient() to automatically create/update mcp.json files - Support project-local and global configuration options - Prompt for project reference interactively - Handle existing configs by merging (not overwriting) - Add configureClaudeCode() to use Claude CLI for configuration - Detect if Claude CLI is available and run 'claude mcp add' command - Display step-by-step next actions after configuration - Mark clients as CanAutomate: cursor, vscode, claude-code
- Add actual client binary/app detection instead of just checking config directories - Add isClientInstalled() that checks for: * Cursor: cursor binary or Cursor.app * VS Code: code binary * Claude Desktop: Claude.app * Claude Code: claude CLI * Windsurf: windsurf binary or Windsurf.app * Cline: VS Code (as it's an extension) - Switch from local NPX server to remote OAuth server at https://mcp.supabase.com/mcp - Update config templates to use remote server format with: * type: 'remote' * url: https://mcp.supabase.com/mcp * OAuth configuration with api.supabase.com * SUPABASE_MCP_SERVER_PERSONAL_ACCESS_TOKEN env var - Show manual config instructions when client not installed - Separate installed vs. available clients in interactive mode - Update Claude Code auto-config to use 'remote' command instead of npx - Update all manual instruction templates to use remote server format
- Add Codex to the list of supported MCP clients - Add getCodexConfigPath() for platform-specific config paths: * macOS: ~/Library/Application Support/Codex/mcp.json * Windows: ~/AppData/Roaming/Codex/mcp.json * Linux: ~/.config/Codex/mcp.json - Add Codex detection via 'codex' binary or Codex.app - Add Codex-specific manual configuration instructions - Update supported clients list to include Codex with URL: https://codex.so - Set CanAutomate to false (manual configuration only)
- Fix import formatting with goimports - Add error checking for fmt.Scanln calls - Lowercase error messages (ST1005) - Remove redundant newlines in fmt.Println - Remove unused ctx parameter from configureJSONClient - Add #nosec G204 comment for validated command execution - Apply gofmt formatting to all files
          Pull Request Test Coverage Report for Build 19043045070Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes. 
 Details
 
 
 
 💛 - Coveralls | 
    
- Introduced Client interface for extensible MCP client support - Implemented client registry pattern for easy addition of new clients - Refactored Claude Code implementation to use new interface - Added documentation for adding new clients - Supports auto-detection of installed clients - Currently supports Claude Code with foundation for more clients
- Implemented cursorClient with JSON config file approach - Supports both project-local (.cursor/mcp.json) and global configs - Adds Supabase MCP server URL to mcpServers configuration - Merges with existing config if present - Added appExists helper for macOS app detection - Updated help text to mention Cursor support
- Created baseClient struct with common Client interface methods - Refactored claudeCodeClient and cursorClient to embed baseClient - Added constructor functions (newClaudeCodeClient, newCursorClient) - Reduced code duplication by using composition pattern - Updated example template to show new pattern - Each client now only implements Configure() method
- Implemented vscodeClient with JSON config file approach - Supports both project-local (.vscode/mcp.json) and global configs - Adds Supabase MCP server with type: http and URL - Merges with existing config if present - Updated help text to mention VS Code support - Checks for 'code' command availability
Reorganized MCP init package for better scalability and maintainability: - client.go: Base Client interface and baseClient implementation - claude_code.go: Claude Code client implementation - cursor.go: Cursor client implementation - vscode.go: VS Code client implementation - utils.go: Helper functions (appExists) - init.go: Core logic, client registry, and orchestration Benefits: - Each client is now in its own file for easy maintenance - Adding new clients is simpler - just create a new file - Reduced init.go from 425 to ~100 lines - Better separation of concerns - Easier to navigate and understand
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
What
Implements
supabase mcp initcommand to help users configure Model Context Protocol (MCP) clients to work with Supabase's remote MCP server.Why
Closes https://linear.app/supabase/issue/AI-81
Users need an easy way to set up MCP integration with their preferred AI coding assistants without manually editing JSON configuration files.
How
Features
--clientflag: Target specific client for configurationhttps://mcp.supabase.com/mcpclaude mcp addCLI command.cursor/mcp.jsonwith server URL.vscode/mcp.jsonwith server config (type: http)Architecture
Built with scalability in mind:
clientRegistryFile structure:
Client-Specific Configurations
Claude Code
Cursor (
.cursor/mcp.json){ "mcpServers": { "supabase": { "url": "https://mcp.supabase.com/mcp" } } }VS Code (
.vscode/mcp.json){ "mcpServers": { "supabase": { "type": "http", "url": "https://mcp.supabase.com/mcp" } } }Usage Examples
User Experience Flow
--clientflagTesting
Related
Notes
groupQuickStart(no authentication required)aferofilesystem abstraction for testability