Class: Aidp::CLI::McpDashboard

Inherits:
Object
  • Object
show all
Includes:
MessageDisplay
Defined in:
lib/aidp/cli/mcp_dashboard.rb

Overview

Dashboard for viewing MCP servers across all providers

Constant Summary

Constants included from MessageDisplay

MessageDisplay::COLOR_MAP

Instance Method Summary collapse

Methods included from MessageDisplay

#display_message, included, #message_display_prompt

Constructor Details

#initialize(root_dir = nil, configuration: nil, provider_info_class: Aidp::Harness::ProviderInfo) ⇒ McpDashboard

Returns a new instance of McpDashboard.



13
14
15
16
17
# File 'lib/aidp/cli/mcp_dashboard.rb', line 13

def initialize(root_dir = nil, configuration: nil, provider_info_class: Aidp::Harness::ProviderInfo)
  @root_dir = root_dir || Dir.pwd
  @configuration = configuration || Aidp::Harness::Configuration.new(@root_dir)
  @provider_info_class = provider_info_class
end

Instance Method Details

#check_task_eligibility(required_servers) ⇒ Object

Get MCP server availability for a specific task requirement



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/aidp/cli/mcp_dashboard.rb', line 57

def check_task_eligibility(required_servers)
  server_matrix = build_server_matrix
  eligible_providers = []

  @configuration.provider_names.each do |provider|
    provider_servers = server_matrix[:provider_servers][provider] || []
    enabled_servers = provider_servers.select { |s| s[:enabled] }.map { |s| s[:name] }

    # Check if provider has all required servers
    if required_servers.all? { |req| enabled_servers.include?(req) }
      eligible_providers << provider
    end
  end

  {
    required_servers: required_servers,
    eligible_providers: eligible_providers,
    total_providers: @configuration.provider_names.size
  }
end

#display_dashboard(options = {}) ⇒ Object

Display MCP dashboard showing all servers across all providers



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/aidp/cli/mcp_dashboard.rb', line 20

def display_dashboard(options = {})
  no_color = options[:no_color] || false

  # Gather MCP server information from all providers
  server_matrix = build_server_matrix

  # Display summary
  display_message("MCP Server Dashboard", type: :highlight)
  display_message("=" * 80, type: :muted)
  display_message("", type: :info)

  # Check if there are any MCP-capable providers
  if server_matrix[:providers].empty?
    display_message("No providers with MCP support configured.", type: :info)
    display_message("MCP is supported by providers like: claude", type: :muted)
    display_message("\n" + "=" * 80, type: :muted)
    return
  end

  # Check if there are any MCP servers configured
  if server_matrix[:servers].empty?
    display_message("No MCP servers configured across any providers.", type: :info)
    display_message("Add MCP servers with: claude mcp add <name> -- <command>", type: :muted)
    display_message("\n" + "=" * 80, type: :muted)
    return
  end

  # Display the main table
  display_server_table(server_matrix, no_color)

  # Display eligibility warnings
  display_eligibility_warnings(server_matrix)

  display_message("\n" + "=" * 80, type: :muted)
end

#display_task_eligibility(required_servers) ⇒ Object

Display eligibility check for specific servers



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/aidp/cli/mcp_dashboard.rb', line 79

def display_task_eligibility(required_servers)
  result = check_task_eligibility(required_servers)

  display_message("\nTask Eligibility Check", type: :highlight)
  display_message("Required MCP Servers: #{required_servers.join(", ")}", type: :info)
  display_message("", type: :info)

  if result[:eligible_providers].any?
    display_message("✓ Eligible Providers (#{result[:eligible_providers].size}/#{result[:total_providers]}):", type: :success)
    result[:eligible_providers].each do |provider|
      display_message("  • #{provider}", type: :success)
    end
  else
    display_message("✗ No providers have all required MCP servers", type: :error)
    display_message("  Consider configuring MCP servers for at least one provider", type: :warning)
  end
end