Class: EnhanceSwarm::MCPIntegration
- Inherits:
-
Object
- Object
- EnhanceSwarm::MCPIntegration
- Defined in:
- lib/enhance_swarm/mcp_integration.rb
Instance Method Summary collapse
- #analyze_with_gemini(path, prompt) ⇒ Object
- #desktop_commander_available? ⇒ Boolean
- #gemini_available? ⇒ Boolean
- #generate_mcp_settings ⇒ Object
-
#initialize ⇒ MCPIntegration
constructor
A new instance of MCPIntegration.
- #setup_desktop_commander ⇒ Object
- #setup_gemini ⇒ Object
Constructor Details
#initialize ⇒ MCPIntegration
Returns a new instance of MCPIntegration.
5 6 7 |
# File 'lib/enhance_swarm/mcp_integration.rb', line 5 def initialize @config = EnhanceSwarm.configuration end |
Instance Method Details
#analyze_with_gemini(path, prompt) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/enhance_swarm/mcp_integration.rb', line 17 def analyze_with_gemini(path, prompt) return nil unless gemini_available? full_prompt = "@#{path} #{prompt}" output = `gemini -p "#{full_prompt}" 2>/dev/null` output.empty? ? nil : output end |
#desktop_commander_available? ⇒ Boolean
13 14 15 |
# File 'lib/enhance_swarm/mcp_integration.rb', line 13 def desktop_commander_available? @config.desktop_commander_enabled end |
#gemini_available? ⇒ Boolean
9 10 11 |
# File 'lib/enhance_swarm/mcp_integration.rb', line 9 def gemini_available? @config.gemini_enabled && system('which gemini > /dev/null 2>&1') end |
#generate_mcp_settings ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/enhance_swarm/mcp_integration.rb', line 57 def generate_mcp_settings settings = { 'mcpServers' => {} } if @config.desktop_commander_enabled settings['mcpServers']['desktop-commander'] = { 'command' => 'npx', 'args' => ['-y', '@claude-ai/desktop-commander'], 'env' => {} } end settings end |
#setup_desktop_commander ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/enhance_swarm/mcp_integration.rb', line 42 def setup_desktop_commander puts "\n \u{1F527} Desktop Commander MCP Setup:\n\n Desktop Commander allows file operations outside the project directory.\n Configure in your Claude Desktop settings.\n\n Benefits:\n - Access global configuration files\n - Move files between projects\n - System-wide operations\n SETUP\nend\n" |
#setup_gemini ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/enhance_swarm/mcp_integration.rb', line 26 def setup_gemini return if gemini_available? puts "\n \u{1F527} Gemini CLI Setup Required:\n\n 1. Install Gemini CLI (if not installed)\n 2. Run: gemini auth login\n 3. Choose Google auth\n 4. Verify: gemini -p \"test\"\n\n Gemini provides large context analysis capabilities.\n SETUP\nend\n" |