Skip to content

[task] Consolidate MCP files into pkg/cli/mcp subpackage #4341

@github-actions

Description

@github-actions

Objective

Reorganize the 17 MCP-related files in pkg/cli into a dedicated pkg/cli/mcp/ subpackage to improve code organization and maintainability.

Context

The CLI package currently has 17 MCP-related files (all prefixed with mcp_*), which represents a significant portion of the package. This scattered organization makes the MCP functionality harder to navigate and maintain. Part of issue #4321.

Approach

  1. Create new pkg/cli/mcp/ directory structure with logical subdirectories:
    • pkg/cli/mcp/registry/ for registry-related files
    • pkg/cli/mcp/workflow/ for workflow loading/scanning
  2. Move and rename files (remove mcp_ prefix since they'll be in mcp package):
    • mcp_add.gomcp/add.go
    • mcp_config_file.gomcp/config.go
    • mcp_inspect.go + mcp_inspect_mcp.gomcp/inspect.go (consolidate)
    • mcp_list.gomcp/list.go
    • mcp_list_tools.gomcp/list_tools.go
    • mcp_logs_guardrail.gomcp/logs_guardrail.go
    • mcp_registry.go + mcp_registry_list.go + mcp_registry_types.gomcp/registry/ package
    • mcp_schema.gomcp/schema.go
    • mcp_secrets.gomcp/secrets.go
    • mcp_server.gomcp/server.go
    • mcp_tool_table.gomcp/tool_table.go
    • mcp_validation.gomcp/validation.go
    • mcp_workflow_loader.go + mcp_workflow_scanner.gomcp/workflow/ package
  3. Update all imports across the codebase to reference new package locations
  4. Run tests to ensure no functionality is broken

Files to Create/Modify

Create:

  • pkg/cli/mcp/ directory and subdirectories
  • New package files in pkg/cli/mcp/, pkg/cli/mcp/registry/, pkg/cli/mcp/workflow/

Modify:

  • All files that import the moved MCP CLI functions (update import paths)
  • Move 17 MCP files from pkg/cli/ to appropriate locations in pkg/cli/mcp/

Delete:

  • Original pkg/cli/mcp_*.go files after successful move

Acceptance Criteria

  • All 17 MCP files successfully moved to pkg/cli/mcp/ subpackage structure
  • Registry-related files organized in pkg/cli/mcp/registry/ subpackage
  • Workflow-related files organized in pkg/cli/mcp/workflow/ subpackage
  • All imports updated across codebase
  • All existing tests pass: make test-unit
  • No compilation errors: make build
  • CLI commands continue to work correctly (manual testing of gh aw mcp commands)
  • Top-level pkg/cli/ directory reduced from 74 to ~60 files

Estimated Effort

8-10 hours

Priority

High Impact, Medium Effort (Priority 1)
Related to #4321

AI generated by Plan Command for #4321

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions