Skip to content

kiro-cli should log spawned MCP server command/args at trace level #6883

@shyamataws

Description

@shyamataws

Before opening, please confirm:

Operating System

macOS

Kiro Version

kiro-cli 1.28.2

Bug Description

kiro-cli should log spawned MCP server command/args at trace level

Summary

When an MCP server fails to initialize, kiro-cli provides no information about what command it actually spawned, even at KIRO_LOG_LEVEL=trace. The only error is:

ErrorCode(-32002), "connection closed: initialize response"

from chat_cli::cli::chat::tool_manager (line 1959).

This made a simple misconfiguration (wrong Node version) take ~30 minutes to diagnose.

Steps to Reproduce

  1. Configure an MCP server in ~/.kiro/settings/mcp.json with correct settings
  2. Have a custom agent in ~/.kiro/agents/ with its own mcpServers block pointing to a wrong Node version
  3. Set chat.defaultAgent to that agent in ~/.kiro/settings/cli.json
  4. Run KIRO_LOG_LEVEL=trace kiro-cli chat
  5. MCP server fails with -32002: connection closed: initialize response

Expected Behavior

Expected Behavior

At trace level, kiro-cli should log:

  • The exact command, args, and env used to spawn each MCP server
  • Which config file the MCP server definition came from (agent config vs mcp.json)
  • Any stderr output from the spawned process before it dies

Actual Behavior

Trace logs show zero information about the spawned command. No way to tell which config was used or what binary was invoked.

Conversation ID

No response

Additional Context

Root Cause of what I was trying to diagnose for context (this is not the root cause for your bug report!)

The agent config (~/.kiro/agents/*.json) overrides ~/.kiro/settings/mcp.json when an agent is active. The agent config had the wrong Node path (v20 instead of v22), causing the MCP server to exit immediately with a version check error. Without spawn logging, this was invisible.

Environment

  • kiro-cli (latest as of 2026-03-27)
  • macOS
  • Node v22.22.2
  • aws-outlook-mcp v0.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions