-
Notifications
You must be signed in to change notification settings - Fork 308
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
base: develop
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 19105505226Details
💛 - Coveralls |
| var ( | ||
| mcpCmd = &cobra.Command{ | ||
| GroupID: groupQuickStart, | ||
| Use: "mcp", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we plan to add other sub commands under supabase mcp? If not, I'd probably add new flags to supabase init instead.
We currently prompt users to create deno config when running supabase init which is logically similar to vscode config for mcp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have plans to extend the mcp command to a dev env for building mcp servers
https://www.notion.so/supabase/Supabase-CLI-Integration-635fe64201f944c1a97856cf83c565c9?source=copy_link
The Notion page is still under construction so please disregard the exact commands stated but the general idea is there.
But since these plans are for developing mcp servers using Supabase and not to configure the SUpabase MCP server using our CLI, I agree that a flag to supabase init would suit this use case better.
Something like supabase init --mcp-client=claude-code?
|
Addressed @sweatybridge's suggestion to move MCP configuration under
Kept |
- 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
- 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
- Adds --mcp-client flag to supabase init (e.g., --mcp-client=claude-code) - Wires to internal MCP setup after project scaffolding - Addresses review feedback to avoid a top-level mcp command for config
997f4ca to
79948e4
Compare
|
Hey @sweatybridge, brainstormed about this with @gregnr and we've decided to go on a different direction. It's still under development but I'll change the Linear issue with the new approach to this once we have it. |
What
Implements
supabase mcp initand adds--mcp-clientflag tosupabase initto 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
Addresses review feedback to attach MCP configuration to
supabase init.Users need an easy way to set up MCP integration with their preferred AI coding assistants without manually editing JSON configuration files.
How
Features
--mcp-clientflag onsupabase init: Target specific client for configurationsupabase init --mcp-client=claude-codehttps://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:
clientRegistryClient-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
Related