diff --git a/pkg/cli/mcp_inspect.go b/pkg/cli/mcp_inspect.go index 2fe39b0ded8..e1cb6ee9fc2 100644 --- a/pkg/cli/mcp_inspect.go +++ b/pkg/cli/mcp_inspect.go @@ -253,72 +253,6 @@ func listWorkflowsWithMCP(workflowsDir string, verbose bool) error { return nil } -// NewMCPInspectCommand creates the mcp inspect command -func NewMCPInspectCommand() *cobra.Command { - var serverFilter string - var toolFilter string - var spawnInspector bool - var checkSecrets bool - - cmd := &cobra.Command{ - Use: "mcp inspect [workflow-file]", - Short: "Inspect MCP servers and list available tools, resources, and roots", - Long: `Inspect MCP servers used by a workflow and display available tools, resources, and roots. - -This command starts each MCP server configured in the workflow, queries its capabilities, -and displays the results in a formatted table. It supports stdio, Docker, and HTTP MCP servers. - -Examples: - gh aw mcp inspect # List workflows with MCP servers - gh aw mcp inspect weekly-research # Inspect MCP servers in weekly-research.md - gh aw mcp inspect daily-news --server tavily # Inspect only the tavily server - gh aw mcp inspect weekly-research --server github --tool create_issue # Show details for a specific tool - gh aw mcp inspect weekly-research -v # Verbose output with detailed connection info - gh aw mcp inspect weekly-research --inspector # Launch @modelcontextprotocol/inspector - gh aw mcp inspect weekly-research --check-secrets # Check GitHub Actions secrets - -The command will: -- Parse the workflow file to extract MCP server configurations -- Start each MCP server (stdio, docker, http) -- Query available tools, resources, and roots -- Validate required secrets are available -- Display results in formatted tables with error details`, - Args: cobra.MaximumNArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - var workflowFile string - if len(args) > 0 { - workflowFile = args[0] - } - - verbose, _ := cmd.Flags().GetBool("verbose") - if cmd.Parent() != nil { - parentVerbose, _ := cmd.Parent().PersistentFlags().GetBool("verbose") - verbose = verbose || parentVerbose - } - - // Validate that tool flag requires server flag - if toolFilter != "" && serverFilter == "" { - return fmt.Errorf("--tool flag requires --server flag to be specified") - } - - // Handle spawn inspector flag - if spawnInspector { - return spawnMCPInspector(workflowFile, serverFilter, verbose) - } - - return InspectWorkflowMCP(workflowFile, serverFilter, toolFilter, verbose, checkSecrets) - }, - } - - cmd.Flags().StringVar(&serverFilter, "server", "", "Filter to inspect only the specified MCP server") - cmd.Flags().StringVar(&toolFilter, "tool", "", "Show detailed information about a specific tool (requires --server)") - cmd.Flags().BoolP("verbose", "v", false, "Enable verbose output with detailed connection information") - cmd.Flags().BoolVar(&spawnInspector, "inspector", false, "Launch the official @modelcontextprotocol/inspector tool") - cmd.Flags().BoolVar(&checkSecrets, "check-secrets", false, "Check GitHub Actions repository secrets for missing secrets") - - return cmd -} - // spawnMCPInspector launches the official @modelcontextprotocol/inspector tool // and spawns any stdio MCP servers beforehand func spawnMCPInspector(workflowFile string, serverFilter string, verbose bool) error {