Skip to content

aws configure agent-toolkit stops at an agent config it cannot parse, and later agents get no MCP setup #10732

Description

@nefayran

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions