Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/cli/audit_expanded.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (

var auditExpandedLog = logger.New("cli:audit_expanded")

// EngineConfig represents the engine configuration extracted from aw_info.json
type EngineConfig struct {
// AuditEngineConfig represents the engine configuration extracted from aw_info.json
type AuditEngineConfig struct {
EngineID string `json:"engine_id" console:"header:Engine ID"`
EngineName string `json:"engine_name,omitempty" console:"header:Engine Name,omitempty"`
Model string `json:"model,omitempty" console:"header:Model,omitempty"`
Expand Down Expand Up @@ -110,8 +110,8 @@ func findAwInfoPath(logsPath string) string {
return ""
}

// extractEngineConfig parses aw_info.json and returns an EngineConfig
func extractEngineConfig(logsPath string) *EngineConfig {
// extractEngineConfig parses aw_info.json and returns an AuditEngineConfig
func extractEngineConfig(logsPath string) *AuditEngineConfig {
if logsPath == "" {
return nil
}
Expand All @@ -127,7 +127,7 @@ func extractEngineConfig(logsPath string) *EngineConfig {
return nil
}

config := &EngineConfig{
config := &AuditEngineConfig{
EngineID: awInfo.EngineID,
EngineName: awInfo.EngineName,
Model: awInfo.Model,
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/audit_expanded_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ func TestBuildAuditDataWithExpandedSections(t *testing.T) {
auditData := buildAuditData(processedRun, metrics, mcpToolUsage)

// Verify new expanded sections are populated
t.Run("EngineConfig", func(t *testing.T) {
t.Run("AuditEngineConfig", func(t *testing.T) {
require.NotNil(t, auditData.EngineConfig, "Engine config should be populated")
assert.Equal(t, "copilot", auditData.EngineConfig.EngineID, "Engine ID should match")
assert.Equal(t, "gpt-4", auditData.EngineConfig.Model, "Model should match")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/audit_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type AuditData struct {
Recommendations []Recommendation `json:"recommendations,omitempty"`
ObservabilityInsights []ObservabilityInsight `json:"observability_insights,omitempty"`
PerformanceMetrics *PerformanceMetrics `json:"performance_metrics,omitempty"`
EngineConfig *EngineConfig `json:"engine_config,omitempty"`
EngineConfig *AuditEngineConfig `json:"engine_config,omitempty"`
PromptAnalysis *PromptAnalysis `json:"prompt_analysis,omitempty"`
SessionAnalysis *SessionAnalysis `json:"session_analysis,omitempty"`
SafeOutputSummary *SafeOutputSummary `json:"safe_output_summary,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/audit_report_render_overview.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func renderPerformanceMetrics(metrics *PerformanceMetrics) {
}

// renderEngineConfig renders engine configuration details
func renderEngineConfig(config *EngineConfig) {
func renderEngineConfig(config *AuditEngineConfig) {
if config == nil {
return
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/cli/mcp_inspect_headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func TestConnectHTTPMCPServer_WithHeaders(t *testing.T) {
}))
defer server.Close()

config := parser.MCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "http",
config := parser.RegistryMCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "http",
URL: server.URL,
Headers: map[string]string{
"Authorization": "Bearer test-token-123",
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestConnectHTTPMCPServer_NoHeaders(t *testing.T) {
}))
defer server.Close()

config := parser.MCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "http",
config := parser.RegistryMCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "http",
URL: server.URL,
Headers: map[string]string{}}, Name: "test-http-server-no-headers",

Expand Down Expand Up @@ -238,7 +238,7 @@ func TestConnectHTTPMCPServer_NilHeaders(t *testing.T) {
}))
defer server.Close()

config := parser.MCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "http",
config := parser.RegistryMCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "http",
URL: server.URL,
Headers: nil}, Name: "test-http-server-nil-headers",

Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/mcp_inspect_inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func spawnMCPInspector(workflowFile string, serverFilter string, verbose bool) e
return fmt.Errorf("npx not found. Please install Node.js and npm to use the MCP inspector: %w", err)
}

var mcpConfigs []parser.MCPServerConfig
var mcpConfigs []parser.RegistryMCPServerConfig
var serverProcesses []*exec.Cmd
var wg sync.WaitGroup

Expand Down Expand Up @@ -78,7 +78,7 @@ func spawnMCPInspector(workflowFile string, serverFilter string, verbose bool) e
fmt.Fprintln(os.Stderr)

// Start stdio MCP servers in the background
stdioServers := []parser.MCPServerConfig{}
stdioServers := []parser.RegistryMCPServerConfig{}
for _, config := range mcpConfigs {
if config.Type == "stdio" {
stdioServers = append(stdioServers, config)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/mcp_inspect_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ var mcpInspectListLog = logger.New("cli:mcp_inspect_list")

// filterOutSafeOutputs removes safe-outputs MCP servers from the list since they are
// handled by the workflow compiler and not actual MCP servers that can be inspected
func filterOutSafeOutputs(configs []parser.MCPServerConfig) []parser.MCPServerConfig {
var filteredConfigs []parser.MCPServerConfig
func filterOutSafeOutputs(configs []parser.RegistryMCPServerConfig) []parser.RegistryMCPServerConfig {
var filteredConfigs []parser.RegistryMCPServerConfig
for _, config := range configs {
if config.Name != constants.SafeOutputsMCPServerID.String() {
filteredConfigs = append(filteredConfigs, config)
Expand Down
10 changes: 5 additions & 5 deletions pkg/cli/mcp_inspect_mcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (h *headerRoundTripper) RoundTrip(req *http.Request) (*http.Response, error
}

// inspectMCPServer connects to an MCP server and queries its capabilities
func inspectMCPServer(config parser.MCPServerConfig, toolFilter string, verbose bool, useActionsSecrets bool) error {
func inspectMCPServer(config parser.RegistryMCPServerConfig, toolFilter string, verbose bool, useActionsSecrets bool) error {
mcpInspectServerLog.Printf("Inspecting MCP server: name=%s, type=%s", config.Name, config.Type)
fmt.Fprintf(os.Stderr, "%s %s (%s)\n",
console.FormatCommandMessage(config.Name),
Expand Down Expand Up @@ -92,7 +92,7 @@ func inspectMCPServer(config parser.MCPServerConfig, toolFilter string, verbose
}

// buildConnectionString creates a display string for the connection details
func buildConnectionString(config parser.MCPServerConfig) string {
func buildConnectionString(config parser.RegistryMCPServerConfig) string {
switch config.Type {
case "stdio":
if config.Container != "" {
Expand All @@ -110,7 +110,7 @@ func buildConnectionString(config parser.MCPServerConfig) string {
}

// connectToMCPServer establishes a connection to the MCP server and queries its capabilities
func connectToMCPServer(config parser.MCPServerConfig, verbose bool) (*parser.MCPServerInfo, error) {
func connectToMCPServer(config parser.RegistryMCPServerConfig, verbose bool) (*parser.MCPServerInfo, error) {
mcpInspectServerLog.Printf("Connecting to MCP server: name=%s, type=%s", config.Name, config.Type)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
Expand All @@ -129,7 +129,7 @@ func connectToMCPServer(config parser.MCPServerConfig, verbose bool) (*parser.MC
}

// connectStdioMCPServer connects to a stdio-based MCP server using the Go SDK
func connectStdioMCPServer(ctx context.Context, config parser.MCPServerConfig, verbose bool) (*parser.MCPServerInfo, error) {
func connectStdioMCPServer(ctx context.Context, config parser.RegistryMCPServerConfig, verbose bool) (*parser.MCPServerInfo, error) {
mcpInspectServerLog.Printf("Connecting to stdio MCP server: command=%s, args=%d", config.Command, len(config.Args))
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Starting stdio MCP server: %s %s", config.Command, strings.Join(config.Args, " "))))
Expand Down Expand Up @@ -224,7 +224,7 @@ func connectStdioMCPServer(ctx context.Context, config parser.MCPServerConfig, v
}

// connectHTTPMCPServer connects to an HTTP-based MCP server using the Go SDK
func connectHTTPMCPServer(ctx context.Context, config parser.MCPServerConfig, verbose bool) (*parser.MCPServerInfo, error) {
func connectHTTPMCPServer(ctx context.Context, config parser.RegistryMCPServerConfig, verbose bool) (*parser.MCPServerInfo, error) {
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Connecting to HTTP MCP server: "+config.URL))
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/mcp_inspect_mcp_scripts_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func startMCPScriptsHTTPServer(dir string, port int, verbose bool) (*exec.Cmd, e
}

// startMCPScriptsServer starts the mcp-scripts HTTP server and returns the MCP config
func startMCPScriptsServer(mcpScriptsConfig *workflow.MCPScriptsConfig, verbose bool) (*parser.MCPServerConfig, *exec.Cmd, string, error) {
func startMCPScriptsServer(mcpScriptsConfig *workflow.MCPScriptsConfig, verbose bool) (*parser.RegistryMCPServerConfig, *exec.Cmd, string, error) {
mcpInspectLog.Printf("Starting mcp-scripts server with %d tools", len(mcpScriptsConfig.Tools))

// Check if node is available
Expand Down Expand Up @@ -182,7 +182,7 @@ func startMCPScriptsServer(mcpScriptsConfig *workflow.MCPScriptsConfig, verbose
}

// Create MCP server config for the mcp-scripts server
config := &parser.MCPServerConfig{
config := &parser.RegistryMCPServerConfig{
BaseMCPServerConfig: types.BaseMCPServerConfig{
Type: "http",
URL: fmt.Sprintf("http://localhost:%d", port),
Expand Down
44 changes: 22 additions & 22 deletions pkg/cli/mcp_inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ import (
func TestValidateServerSecrets(t *testing.T) {
tests := []struct {
name string
config parser.MCPServerConfig
config parser.RegistryMCPServerConfig
envVars map[string]string
expectError bool
errorMsg string
}{
{
name: "no environment variables",
config: parser.MCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio"}, Name: "simple-tool"},
config: parser.RegistryMCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio"}, Name: "simple-tool"},
expectError: false,
},
{
name: "valid environment variable",
config: parser.MCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio",
config: parser.RegistryMCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio",
Env: map[string]string{
"TEST_VAR": "test_value",
}}, Name: "env-tool",
Expand All @@ -40,7 +40,7 @@ func TestValidateServerSecrets(t *testing.T) {
},
{
name: "missing environment variable",
config: parser.MCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio",
config: parser.RegistryMCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio",
Env: map[string]string{
"MISSING_VAR": "test_value",
}}, Name: "missing-env-tool",
Expand All @@ -50,7 +50,7 @@ func TestValidateServerSecrets(t *testing.T) {
},
{
name: "secrets reference (handled gracefully)",
config: parser.MCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio",
config: parser.RegistryMCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio",
Env: map[string]string{
"API_KEY": "${secrets.API_KEY}",
}}, Name: "secrets-tool",
Expand All @@ -59,7 +59,7 @@ func TestValidateServerSecrets(t *testing.T) {
},
{
name: "github remote mode requires GH_AW_GITHUB_TOKEN",
config: parser.MCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "http",
config: parser.RegistryMCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "http",
URL: "https://api.githubcopilot.com/mcp/",
Env: map[string]string{}}, Name: "github",
},
Expand All @@ -70,7 +70,7 @@ func TestValidateServerSecrets(t *testing.T) {
},
{
name: "github remote mode with custom token",
config: parser.MCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "http",
config: parser.RegistryMCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "http",
URL: "https://api.githubcopilot.com/mcp/",
Env: map[string]string{
"GITHUB_TOKEN": "${{ secrets.CUSTOM_PAT }}",
Expand All @@ -80,7 +80,7 @@ func TestValidateServerSecrets(t *testing.T) {
},
{
name: "github local mode does not require GH_AW_GITHUB_TOKEN",
config: parser.MCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "docker",
config: parser.RegistryMCPServerConfig{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "docker",
Env: map[string]string{}}, Name: "github",
},
expectError: false,
Expand Down Expand Up @@ -125,7 +125,7 @@ func TestDisplayToolAllowanceHint(t *testing.T) {
{
name: "server with blocked tools",
serverInfo: &parser.MCPServerInfo{
Config: parser.MCPServerConfig{
Config: parser.RegistryMCPServerConfig{
Name: "test-server",
Allowed: []string{"tool1", "tool2"},
},
Expand All @@ -150,7 +150,7 @@ func TestDisplayToolAllowanceHint(t *testing.T) {
{
name: "server with no allowed list (all tools allowed)",
serverInfo: &parser.MCPServerInfo{
Config: parser.MCPServerConfig{
Config: parser.RegistryMCPServerConfig{
Name: "open-server",
Allowed: []string{}, // Empty means all allowed
},
Expand All @@ -171,7 +171,7 @@ func TestDisplayToolAllowanceHint(t *testing.T) {
{
name: "server with all tools explicitly allowed",
serverInfo: &parser.MCPServerInfo{
Config: parser.MCPServerConfig{
Config: parser.RegistryMCPServerConfig{
Name: "explicit-server",
Allowed: []string{"tool1", "tool2"},
},
Expand Down Expand Up @@ -256,7 +256,7 @@ func TestMCPInspectFiltersSafeOutputs(t *testing.T) {
}

// Test the filtering logic that inspect command uses
var filteredConfigs []parser.MCPServerConfig
var filteredConfigs []parser.RegistryMCPServerConfig
for _, config := range configs {
if config.Name != constants.SafeOutputsMCPServerID.String() {
filteredConfigs = append(filteredConfigs, config)
Expand All @@ -278,40 +278,40 @@ func TestMCPInspectFiltersSafeOutputs(t *testing.T) {
func TestFilterOutSafeOutputs(t *testing.T) {
tests := []struct {
name string
input []parser.MCPServerConfig
expected []parser.MCPServerConfig
input []parser.RegistryMCPServerConfig
expected []parser.RegistryMCPServerConfig
}{
{
name: "empty input",
input: []parser.MCPServerConfig{},
expected: []parser.MCPServerConfig{},
input: []parser.RegistryMCPServerConfig{},
expected: []parser.RegistryMCPServerConfig{},
},
{
name: "only safe-outputs",
input: []parser.MCPServerConfig{
input: []parser.RegistryMCPServerConfig{
{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio"}, Name: constants.SafeOutputsMCPServerID.String()},
},
expected: []parser.MCPServerConfig{},
expected: []parser.RegistryMCPServerConfig{},
},
{
name: "mixed servers",
input: []parser.MCPServerConfig{
input: []parser.RegistryMCPServerConfig{
{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio"}, Name: constants.SafeOutputsMCPServerID.String()},
{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "docker"}, Name: "github"},
{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "docker"}, Name: "playwright"},
},
expected: []parser.MCPServerConfig{
expected: []parser.RegistryMCPServerConfig{
{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "docker"}, Name: "github"},
{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "docker"}, Name: "playwright"},
},
},
{
name: "no safe-outputs",
input: []parser.MCPServerConfig{
input: []parser.RegistryMCPServerConfig{
{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "docker"}, Name: "github"},
{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio"}, Name: "custom-server"},
},
expected: []parser.MCPServerConfig{
expected: []parser.RegistryMCPServerConfig{
{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "docker"}, Name: "github"},
{BaseMCPServerConfig: types.BaseMCPServerConfig{Type: "stdio"}, Name: "custom-server"},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/mcp_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func listWorkflowsWithMCPServers(workflowsDir string, verbose bool) error {
var totalMCPCount int

for _, result := range results {
serverNames := sliceutil.Map(result.MCPConfigs, func(config parser.MCPServerConfig) string { return config.Name })
serverNames := sliceutil.Map(result.MCPConfigs, func(config parser.RegistryMCPServerConfig) string { return config.Name })

workflowData = append(workflowData, struct {
name string
Expand Down Expand Up @@ -258,7 +258,7 @@ func showInteractiveMCPWorkflowSelection(workflows []struct {
}

// determineConfigStatus checks if an MCP server configuration is valid and ready
func determineConfigStatus(config parser.MCPServerConfig) string {
func determineConfigStatus(config parser.RegistryMCPServerConfig) string {
// Check if the configuration has the minimum required fields
hasExecutable := config.Command != "" || config.URL != "" || config.Container != ""

Expand Down
10 changes: 5 additions & 5 deletions pkg/cli/mcp_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ func TestNewMCPListSubcommand(t *testing.T) {
func TestDetermineConfigStatus(t *testing.T) {
tests := []struct {
name string
config parser.MCPServerConfig
config parser.RegistryMCPServerConfig
expected string
}{
{
name: "valid_stdio_config",
config: parser.MCPServerConfig{
config: parser.RegistryMCPServerConfig{
BaseMCPServerConfig: types.BaseMCPServerConfig{
Command: "npx",
},
Expand All @@ -193,7 +193,7 @@ func TestDetermineConfigStatus(t *testing.T) {
},
{
name: "valid_http_config",
config: parser.MCPServerConfig{
config: parser.RegistryMCPServerConfig{
BaseMCPServerConfig: types.BaseMCPServerConfig{
URL: "http://localhost:3000",
},
Expand All @@ -202,7 +202,7 @@ func TestDetermineConfigStatus(t *testing.T) {
},
{
name: "valid_container_config",
config: parser.MCPServerConfig{
config: parser.RegistryMCPServerConfig{
BaseMCPServerConfig: types.BaseMCPServerConfig{
Container: "docker",
},
Expand All @@ -211,7 +211,7 @@ func TestDetermineConfigStatus(t *testing.T) {
},
{
name: "incomplete_config",
config: parser.MCPServerConfig{},
config: parser.RegistryMCPServerConfig{},
expected: "⚠ Incomplete",
},
}
Expand Down
Loading
Loading