Skip to content

Add Claude CLI support with Strategy Pattern architecture (v0.6.0) - #19

Open
o2alexanderfedin wants to merge 6 commits into
anaisbetts:mainfrom
o2alexanderfedin:main
Open

Add Claude CLI support with Strategy Pattern architecture (v0.6.0)#19
o2alexanderfedin wants to merge 6 commits into
anaisbetts:mainfrom
o2alexanderfedin:main

Conversation

@o2alexanderfedin

@o2alexanderfedin o2alexanderfedin commented May 26, 2025

Copy link
Copy Markdown

🚀 Major Enhancement: Claude CLI Support & Strategy Pattern Architecture

This PR introduces comprehensive Claude CLI support with a robust Strategy Pattern architecture, bringing the MCP installer to v0.6.0 with significant performance and extensibility improvements.

✨ New Features

Claude CLI Integration

  • Automatic Detection: Detects if claude CLI is available at startup
  • Immediate Availability: Servers installed via CLI are available instantly (no restart required)
  • Graceful Fallback: Falls back to Claude Desktop config if CLI unavailable
  • Enhanced UX: Clear feedback on installation method and availability status

Strategy Pattern Architecture

  • Extensible Design: Clean interface ready for multiple installation environments
  • Performance Optimized: Early strategy detection (1 call vs 4 calls per operation)
  • Future-Ready: Prepared for Docker, Kubernetes, VS Code Extensions, and more
  • Maintainable: Eliminated conditional branching duplication throughout codebase

🏗️ Technical Improvements

Architecture Changes

  • Added InstallationStrategy interface with concrete implementations:
    • ClaudeCliStrategy - For claude CLI installations
    • ClaudeDesktopStrategy - For traditional config file approach
  • Global strategy initialization at server startup
  • Unified installation interface across all environments

Performance Enhancements

  • Before: 4 hasClaudeCLI() calls per installation operation
  • After: 1 hasClaudeCLI() call per server startup
  • Eliminated redundant environment detection
  • Streamlined installation flow

Code Quality

  • Removed legacy installToClaudeCLI/installToClaudeDesktop functions
  • Simplified conditional logic throughout the codebase
  • Better separation of concerns
  • Enhanced error handling and user feedback

📦 Installation & Usage

For Claude CLI (New - Recommended):

claude mcp add mcp-installer npx --args @o2alexanderfedin/mcp-installer

For Claude Desktop (Existing):

{
  "mcpServers": {
    "mcp-installer": {
      "command": "npx",
      "args": ["@o2alexanderfedin/mcp-installer"]
    }
  }
}

🔄 Backward Compatibility

No Breaking Changes: All existing Claude Desktop installations continue to work exactly as before
Enhanced Experience: Existing users get improved performance and better error messages
Seamless Migration: No action required for current users

🧪 Testing

  • ✅ TypeScript compilation passes
  • ✅ Build system works correctly
  • ✅ Module loads without runtime errors
  • ✅ Backward compatibility verified
  • ✅ Strategy pattern functionality confirmed

📋 Commits Included

  1. Add Claude CLI support with automatic detection and fallback (8e50814)

    • Core Claude CLI integration
    • Automatic detection logic
    • Enhanced README documentation
  2. Remove unused function to fix TypeScript compilation (dd6e4a9)

    • Clean up legacy code
    • Fix compilation issues
  3. Refactor installation logic using Strategy Pattern (a778373)

    • Complete Strategy Pattern implementation
    • Performance optimizations
    • Code simplification
  4. Bump version to 0.6.0 (ce7ed5c)

    • Version update for release

🎯 Future Roadmap

This architecture enables easy addition of new installation environments:

  • Docker containers (docker run commands)
  • Kubernetes deployments (kubectl apply)
  • VS Code Extensions (.vscode/settings.json)
  • JetBrains IDEs (plugin configuration)
  • Cloud deployments (AWS Lambda, Google Cloud Functions)

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

gh-o2services and others added 4 commits May 25, 2025 21:24
- Add hasClaudeCLI() function to detect claude CLI availability
- Add installToClaudeCLI() function using claude mcp add commands
- Update installation functions to prefer Claude CLI over Claude Desktop
- Add immediate availability for CLI vs restart requirement for Desktop
- Update README with Claude CLI installation instructions and features
- Maintain backward compatibility with Claude Desktop

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove installRepoWithArgsToClaudeDesktop function that was unused
- Fix TypeScript compilation error

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Replace conditional branching with Strategy Pattern for better extensibility
- Add InstallationStrategy interface with ClaudeCliStrategy and ClaudeDesktopStrategy implementations
- Move strategy detection to server startup for improved performance (1 detection vs 4 per operation)
- Eliminate duplicate hasClaudeCLI() calls and conditional logic throughout codebase
- Simplify installation flow with unified strategy.install() interface
- Remove legacy installToClaudeCLI/installToClaudeDesktop functions
- Prepare architecture for future environment support (Docker, Kubernetes, VS Code, etc.)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@o2alexanderfedin o2alexanderfedin changed the title Add Claude CLI support with automatic detection and fallback Add Claude CLI support with Strategy Pattern architecture (v0.6.0) May 26, 2025
gh-o2services and others added 2 commits June 1, 2025 23:12
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants