Skip to content

[plan] Fix unformatted stderr output in MCP CLI files (mcp_config_file, mcp_inspect, mcp_list) #21177

@github-actions

Description

@github-actions

Objective

Replace raw fmt.Fprintf(os.Stderr, ...) calls with console.Format* wrappers across all MCP-related CLI files identified in the Terminal Stylist audit (discussion #21126).

Context

The audit found ~54 files with unformatted stderr output. This issue covers the MCP command group.

Files to Modify

All files are in pkg/cli/:

  • mcp_config_file.go
  • mcp_inspect.go
  • mcp_inspect_inspector.go
  • mcp_inspect_list.go
  • mcp_inspect_mcp.go
  • mcp_list.go

Approach

For each file:

  1. Find all fmt.Fprintf(os.Stderr, ...) and fmt.Fprintln(os.Stderr, ...) calls that are NOT already using console formatters
  2. Choose the correct formatter based on message semantics:
    • Info/neutral → console.FormatInfoMessage
    • Success/completion → console.FormatSuccessMessage
    • Warning → console.FormatWarningMessage
    • Error → console.FormatErrorMessage
    • Command display → console.FormatCommandMessage
    • List items → console.FormatListItem
  3. Convert fmt.Fprintf(os.Stderr, "...\n", args...)fmt.Fprintln(os.Stderr, console.FormatXxxMessage(fmt.Sprintf("...", args...)))
  4. Run make fmt && make test-unit to validate

Note

Do NOT change:

  • Calls that already wrap a console.Format* function
  • Calls that output structured data (JSON, tables) which go to stdout

Acceptance Criteria

  • All raw fmt.Fprintf(os.Stderr, ...) diagnostic messages in the 6 MCP files replaced with console formatters
  • make fmt passes with no changes
  • make test-unit passes

Generated by Plan Command for issue #discussion #21126 ·

  • expires on Mar 18, 2026, 5:12 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions