Describe the bug
aws configure agent-toolkit reads each detected agent's MCP config with a plain json.load (DetectedAgent._read_mcp_config in awscli/customizations/agenttoolkit/agents.py), and _configure_mcp in configure.py loops over the agents without handling errors. Gemini CLI reads ~/.gemini/settings.json with comments stripped (JSON.parse(stripJsonComments(content)) in packages/cli/src/config/settings.ts), so the file can contain comments, and one comment in it raises JSONDecodeError here. The command exits with 255 and an error that does not name the file, and every agent after Gemini CLI in AGENT_CONFIGS (Kiro, OpenClaw, OpenCode, Pi, Windsurf) gets no MCP configuration, although their skills were already installed.
Expected Behavior
Each agent is configured on its own. An agent whose config cannot be read is reported with the path and the reason, its file is left as it is, and the command goes on with the remaining agents, the way agents without automated setup are listed now.
Current Behavior
Skills installed to:
Claude Code — ~/.claude/skills
Gemini CLI — ~/.agents/skills/
Kiro — ~/.kiro/skills
AWS MCP server configured for:
✓ Claude Code — ~/.claude.json: updated
aws: [ERROR]: Expecting property name enclosed in double quotes: line 2 column 3 (char 4)
The exit code is 255, and ~/.kiro/settings/mcp.json is not created.
Reproduction Steps
export HOME=$(mktemp -d)
mkdir -p ~/.claude ~/.gemini ~/.kiro
echo '{}' > ~/.claude.json
printf '{\n // theme for the terminal UI\n "theme": "Default"\n}\n' > ~/.gemini/settings.json
aws configure agent-toolkit --yes
echo $? # 255
ls ~/.kiro/settings/mcp.json # No such file or directory
Possible Solution
Catch ValueError and OSError per agent in _configure_mcp, print the agent, the path and the error, leave that file untouched, and continue; list those agents next to the ones without automated setup. From reading the code, a non-zero exit of the shell command in _configure_via_shell (subprocess.run(..., check=True), used for Codex) stops the loop the same way. I can open a PR with unit tests for both if this direction works for you.
Additional Information/Context
The open PRs that touch this code (#10456, file encoding; #10605, the Knowledge MCP server) do not change how a config that fails to parse is handled.
CLI version used
aws-cli/2.37.9 Python/3.13.14 Darwin/25.5.0 source/arm64 (v2 at f92d8b6)
Environment details (OS name and version, etc.)
macOS, Apple Silicon, aws-cli installed from source in a virtualenv.
Generated by AI tools (Claude Code) and reviewed by @nefayran.
Describe the bug
aws configure agent-toolkitreads each detected agent's MCP config with a plainjson.load(DetectedAgent._read_mcp_configinawscli/customizations/agenttoolkit/agents.py), and_configure_mcpinconfigure.pyloops over the agents without handling errors. Gemini CLI reads~/.gemini/settings.jsonwith comments stripped (JSON.parse(stripJsonComments(content))inpackages/cli/src/config/settings.ts), so the file can contain comments, and one comment in it raisesJSONDecodeErrorhere. The command exits with 255 and an error that does not name the file, and every agent after Gemini CLI inAGENT_CONFIGS(Kiro, OpenClaw, OpenCode, Pi, Windsurf) gets no MCP configuration, although their skills were already installed.Expected Behavior
Each agent is configured on its own. An agent whose config cannot be read is reported with the path and the reason, its file is left as it is, and the command goes on with the remaining agents, the way agents without automated setup are listed now.
Current Behavior
The exit code is 255, and
~/.kiro/settings/mcp.jsonis not created.Reproduction Steps
Possible Solution
Catch
ValueErrorandOSErrorper agent in_configure_mcp, print the agent, the path and the error, leave that file untouched, and continue; list those agents next to the ones without automated setup. From reading the code, a non-zero exit of the shell command in_configure_via_shell(subprocess.run(..., check=True), used for Codex) stops the loop the same way. I can open a PR with unit tests for both if this direction works for you.Additional Information/Context
The open PRs that touch this code (#10456, file encoding; #10605, the Knowledge MCP server) do not change how a config that fails to parse is handled.
CLI version used
aws-cli/2.37.9 Python/3.13.14 Darwin/25.5.0 source/arm64 (v2 at f92d8b6)
Environment details (OS name and version, etc.)
macOS, Apple Silicon, aws-cli installed from source in a virtualenv.
Generated by AI tools (Claude Code) and reviewed by @nefayran.