Skip to content

Migrate mcp_inspect_mcp.go to console package abstraction#11636

Merged
pelikhan merged 3 commits intomainfrom
copilot/migrate-mcp-inspect-to-console-helpers
Jan 24, 2026
Merged

Migrate mcp_inspect_mcp.go to console package abstraction#11636
pelikhan merged 3 commits intomainfrom
copilot/migrate-mcp-inspect-to-console-helpers

Conversation

Copy link
Contributor

Copilot AI commented Jan 24, 2026

The mcp_inspect_mcp.go file directly used Lipgloss styles instead of the console package abstraction layer, breaking consistency with other CLI commands.

Changes

Server info display:

  • styles.ServerNameconsole.FormatCommandMessage()
  • styles.ServerTypeconsole.FormatInfoMessage()

Error boxes:

  • styles.ErrorBox.Render()console.RenderErrorBox()
  • Updated to handle returned slice of strings for proper TTY detection

Section headers:

  • styles.Header.Render()console.FormatSectionHeader()
  • Applied to all 7 headers: Tool Access Status, Available Resources, Available Roots, Tool Details, Tool Attributes, Input Schema, Output Schema

Removed:

  • Direct pkg/styles import

Example

// Before
fmt.Print(styles.ErrorBox.Render(fmt.Sprintf("❌ Connection failed: %s", err)))

// After
errorBox := console.RenderErrorBox(fmt.Sprintf("❌ Connection failed: %s", err))
for _, line := range errorBox {
    fmt.Fprintln(os.Stderr, line)
}

Visual output remains identical. Aligns with patterns in audit_report_render.go and deps_security.go.

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Migrate mcp_inspect_mcp.go to use console helpers instead of direct Lipgloss</issue_title>
<issue_description>## Objective

Replace direct Lipgloss style usage in mcp_inspect_mcp.go with appropriate console package helpers for consistency.

Context

From discussion #11611: The mcp_inspect_mcp.go file directly uses styles.ServerName, styles.ServerType, and styles.ErrorBox.Render() instead of going through the console package abstraction layer.

Current Issues: Lines 54-57, 73 use direct Lipgloss styles.

Approach

  1. Review current usage in pkg/cli/mcp_inspect_mcp.go:

    • Identify all direct styles.* usage (lines ~54-57, ~73)
    • Determine appropriate console package alternatives
  2. Replace with console helpers:

    • Use existing console formatters where applicable
    • Consider creating new helpers if needed (e.g., FormatListItem())
    • Maintain the same visual appearance
  3. Test the output:

    • Verify output looks the same in terminal
    • Test non-TTY mode works correctly
    • Ensure error boxes render properly

Files to Modify

  • Update: pkg/cli/mcp_inspect_mcp.go (lines ~54-57, ~73)
  • Consider: pkg/console/*.go (if new helpers are needed)

Implementation Guidance

// Before (mcp_inspect_mcp.go:54-57):
serverNameStyled := styles.ServerName.Render(serverName)
serverTypeStyled := styles.ServerType.Render(fmt.Sprintf("(%s)", mcpConfig.Mode))

// After (option 1 - use existing formatter):
serverInfo := console.FormatInfoMessage(fmt.Sprintf("%s (%s)", serverName, mcpConfig.Mode))

// After (option 2 - create new helper if needed):
serverInfo := console.FormatListItem(fmt.Sprintf("%s (%s)", serverName, mcpConfig.Mode))
// Before (mcp_inspect_mcp.go:73):
fmt.Fprintln(os.Stderr, styles.ErrorBox.Render(errorMsg))

// After:
fmt.Fprintln(os.Stderr, console.RenderErrorBox(errorMsg))

Acceptance Criteria

  • All direct styles.* usage replaced with console helpers
  • Output appearance remains consistent
  • TTY detection works properly
  • No direct Lipgloss imports remain in CLI commands
  • Code passes make fmt and make lint
  • make agent-finish completes successfully

Priority

Phase 1: Critical Fix (1-2 hours estimated)

AI generated by Plan Command for discussion #11611

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 24, 2026 11:58
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…p.go

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate mcp_inspect_mcp.go to use console helpers Migrate mcp_inspect_mcp.go to console package abstraction Jan 24, 2026
Copilot AI requested a review from pelikhan January 24, 2026 12:17
@pelikhan
Copy link
Contributor

@copilot format, lint

Copy link
Contributor Author

Copilot AI commented Jan 24, 2026

@copilot format, lint

✅ Format and lint completed successfully with no issues. The code is already properly formatted and passes all validation checks.

@pelikhan pelikhan marked this pull request as ready for review January 24, 2026 12:25
@pelikhan pelikhan merged commit 93e1fc3 into main Jan 24, 2026
133 checks passed
@pelikhan pelikhan deleted the copilot/migrate-mcp-inspect-to-console-helpers branch January 24, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Migrate mcp_inspect_mcp.go to use console helpers instead of direct Lipgloss

2 participants