Conversation
Add interactive MCP server registration during project initialization with support for multiple platforms and configuration types. Features: - Interactive prompt with arrow key navigation (promptui) - Support for 4 platforms: * Claude Desktop (global config) * Claude Code (project .mcp.json) * Cursor (project .cursor/mcp.json) * VS Code/Cline (project .vscode/mcp.json) - Platform-specific JSON formats (VS Code uses different structure) - New flags: --register-mcp (registration only), --skip-mcp (skip prompt) - Automatic backup creation before modification - Project-specific configs enable team collaboration via version control Changes: - Add promptui dependency for interactive selection - Create internal/cmd/mcp_register.go with registration logic - Update internal/cmd/init.go with MCP registration flow - Support both global and project-specific MCP configurations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add interactive API key configuration during project initialization with support for both environment variables and .sym/.env file. Features: - Interactive prompt only when API key not found - Priority: system env var > .sym/.env file - Masked input for API key entry - Basic validation (sk- prefix, length check) - Automatic .gitignore update for .sym/.env - File permissions set to 0600 for security New flags: - --setup-api-key: Setup API key only (skip roles/policy init) - --skip-api-key: Skip API key configuration prompt Changes: - Create internal/cmd/api_key.go with key management logic - Add promptAPIKeyIfNeeded() to init.go workflow - Update convert, validate, mcp commands to use getAPIKey() - Support loading API key from .sym/.env file Benefits: - No need to set environment variables manually - Project-specific API keys (team collaboration) - Secure file storage with restrictive permissions - Backward compatible with existing env var setup - Can be configured later with 'sym init --setup-api-key'
Remove '\n' from fmt.Println calls to fix go vet errors. fmt.Println automatically adds a newline, so explicit '\n' is redundant.
…ance - Add error checking for file.Close() calls in api_key.go - Add error checking for os.WriteFile() calls in mcp_register.go - Display warning messages when backup file creation fails - Fixes all errcheck linter violations in CI
- Replace promptui masked input with bufio.Reader for better paste support - Add cleanAPIKey function to remove control characters and whitespace - Fix duplicate label output when pasting API keys - Keep only printable ASCII characters (33-126) in API key input - Update .gitignore to include .sym/.env
…at/mcp-registration # Conflicts: # go.mod # go.sum # internal/cmd/mcp.go
- Remove duplicate autoConvertPolicy function (moved to internal/mcp/server.go) - Clean up unused imports (context, encoding/json, converter, llm, schema) - Fix golangci-lint unused function warning
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
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.
Summary
This PR enhances the sym init command with automated MCP server registration
and OpenAI API key configuration, improving the developer onboarding
experience.
What Changed
✨ Added automatic MCP server registration for Claude Code, Cursor, and VS
Code
🔧 Supports multiple application configurations:
Claude Code: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
Cursor: ~/.cursor/mcp.json
VS Code: ~/Library/Application Support/Code/User/settings.json
📦 Configures Symphony MCP server with npx @dev-symphony/sym@latest mcp
🛡️ Creates backup files before modifying existing configurations
🎯 New flags: --register-mcp (register MCP only), --skip-mcp (skip MCP
registration)
🔑 Interactive API key configuration with standard input
📁 Stores API keys securely in .sym/.env with 0600 permissions
🔍 Validates API key format (must start with 'sk-', minimum length check)
🧹 Cleans input to remove control characters and whitespace for reliable
validation
📋 Full paste support with bufio.Reader (no duplicate output issues)
🚫 Automatically adds .sym/.env to .gitignore
🎯 New flags: --setup-api-key (setup API key only), --skip-api-key (skip
API key setup)
🔄 Priority: System environment variable → .sym/.env file
🎉 Integrated MCP registration prompt after roles/policy initialization
🎉 Integrated API key configuration prompt if not already configured
🎛️ Added new command-line flags for flexible workflows
✅ Fixed all golangci-lint errcheck violations
✅ Added proper error handling for file operations (Close(), WriteFile())
✅ Removed redundant newlines in fmt.Println statements
✅ Improved paste handling to prevent duplicate output
Usage Examples
Standard initialization with all features
sym init
Creates roles.json, user-policy.json
Prompts for MCP registration
Prompts for API key configuration if needed
Register MCP server only
sym init --register-mcp
Interactive prompt to choose: Claude Code, Cursor, or VS Code
Setup API key only
sym init --setup-api-key
Prompts for OpenAI API key with paste support
Skip prompts
sym init --skip-mcp --skip-api-key
Only creates roles.json and user-policy.json
Technical Details
API Key Input Handling
compatibility
33-126)
Error Handling
Test Plan
Breaking Changes
None. All new features are opt-in via flags.
Dependencies
Files Changed