aws / aws/amazon-q-developer-cli
`--agent` flag prevents MCP servers from loading (both agent JSON mcpServers and global mcp.json)
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
## Bug Report
### Description
When using `kiro-cli chat --agent `, 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`:
```json
{
"mcpServers": {
"my-server": {
"url": "http://localhost:8080/mcp",
"disabled": false
}
}
}
```
2. Create an agent config at `.kiro/agents/my-agent.json` with `mcpServers` also defined.
3. Run **without** `--agent`:
```bash
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. ✅
4. Run **with** `--agent`:
```bash
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.
Contributor guide
Research direction
Start by reproducing the two commands in the issue, comparing MCP startup with and without `--agent`. Trace agent configuration loading and MCP startup, including `--require-mcp-startup`; done means both the agent and global `mcp.json` servers load in non-interactive mode and startup failures are handled consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100