Skip to content

--agent flag prevents MCP servers from loading (both agent JSON mcpServers and global mcp.json) #3865

Description

@anch0r76

Bug Report

Description

When using kiro-cli chat --agent <name>, MCP servers do not load — neither from the agent JSON's mcpServers field nor from the global ~/.kiro/settings/mcp.json. Without --agent, the same mcp.json works correctly and all MCP tools appear.

Steps to Reproduce

  1. Configure ~/.kiro/settings/mcp.json:
{
  "mcpServers": {
    "my-server": {
      "url": "http://localhost:8080/mcp",
      "disabled": false
    }
  }
}
  1. Create an agent config at .kiro/agents/my-agent.json with mcpServers also defined.

  2. Run without --agent:

kiro-cli chat --no-interactive --trust-all-tools --require-mcp-startup "list your MCP tools"

Result: MCP tools from mcp.json are loaded and available. ✅

  1. Run with --agent:
kiro-cli chat --agent my-agent --no-interactive --trust-all-tools --require-mcp-startup "list your MCP tools"

Result: MCP tools are NOT available. Agent only sees built-in tools (read, write, shell, etc.). ❌

Expected Behavior

MCP servers should load regardless of whether --agent is specified. The agent's mcpServers field and/or global mcp.json should both be respected.

Environment

  • kiro-cli version: 2.11.1
  • OS: macOS 26.5 (arm64) and macOS 13.7.8 (x86_64)
  • MCP transport: Streamable HTTP (url field, not command)
  • --require-mcp-startup flag has no effect when --agent is used

Additional Context

  • The --require-mcp-startup flag does not error or exit with code 3 when MCP fails to load with --agent — it silently proceeds without tools.
  • The agent JSON's tools array (listing built-in tools) and allowedTools array (listing MCP tool names) are both correctly configured.
  • This affects non-interactive mode (--no-interactive) which is critical for programmatic/bot use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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