Skip to content

aws configure agent-toolkit fails to configure MCP server on non-English Windows environments #10452

Description

@stknohg

Describe the bug

Environment

  • Japanese Windows 11
  • AWS CLI v2.35.10
  • Claude Code v2.1.187

Running aws configure agent-toolkit on Japanese Windows 11 to configure an MCP server results in an error.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

The MCP server configuration is saved without errors.

Current Behavior

The error when configuring the Claude Code MCP server is as follows.

# Use Claude Code
PS C:\> aws configure agent-toolkit --region us-east-1

Detecting installed AI coding agents...
  ✓ Claude Code — C:\Users\xxxxxxxx/.claude/skills
  ✗ Cline — ~/.cline/skills (not found)
  ✗ Codex — ~/.agents/skills (not found)
  ✗ Cursor — ~/.cursor/skills (not found)
  ✗ Gemini CLI — ~/.agents/skills (not found)
  ✓ Kiro — C:\Users\xxxxxxxx/.kiro/skills
  ✗ OpenClaw — ~/.openclaw/skills (not found)
  ✗ OpenCode — ~/.agents/skills (not found)
  ✗ Pi — ~/.pi/agent/skills (not found)
  ✗ Windsurf — ~/.agents/skills (not found)

Select agents to configure (space to toggle, up/down arrows to navigate, enter to confirm):
  [x] Claude Code — C:\Users\xxxxxxxx/.claude/skills
  [ ] Kiro — C:\Users\xxxxxxxx/.kiro/skills

Attempting to configure the MCP server produces the following error.

Fetching default AWS skills...
  Found: amazon-bedrock, aws-billing-and-cost-management, aws-blocks, aws-cdk, aws-cloudformation, aws-containers, aws-iam, aws-messaging-and-streaming, aws-observability, aws-sdk-js-v3-usage, aws-sdk-python-usage, aws-sdk-swift-usage, aws-serverless, signing-in-to-aws

Install 14 default AWS skills? [Y/n]: n

Configure AWS MCP server connection? [Y/n]: y

AWS MCP server configured for:

aws: [ERROR]: 'cp932' codec can't decode byte 0x94 in position 17949: illegal multibyte sequence

Full traceback with --debug.

Configure AWS MCP server connection? [Y/n]: 2026-06-26 17:23:42,835 - MainThread - awscli.compat - DEBUG - readline module not available
y

AWS MCP server configured for:
2026-06-26 17:23:44,534 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "awscli\clidriver.py", line 602, in main
  File "awscli\lazy.py", line 43, in __call__
  File "awscli\customizations\commands.py", line 153, in __call__
  File "awscli\customizations\commands.py", line 207, in __call__
  File "awscli\customizations\agenttoolkit\configure.py", line 126, in _run_main
  File "awscli\customizations\agenttoolkit\configure.py", line 206, in _configure_mcp
  File "awscli\customizations\agenttoolkit\agents.py", line 225, in configure_mcp_server
  File "awscli\customizations\agenttoolkit\agents.py", line 255, in _read_mcp_config
  File "json\__init__.py", line 298, in load
UnicodeDecodeError: 'cp932' codec can't decode byte 0x94 in position 17949: illegal multibyte sequence

aws: [ERROR]: 'cp932' codec can't decode byte 0x94 in position 17949: illegal multibyte sequence

Reproduction Steps

Configure the MCP server by running the aws configure agent-toolkit command while retaining an agent configuration file that contains characters not supported by CP932 in a Japanese Windows environment.

Possible Solution

Suspected root cause

The MCP server configuration file (~/.claude.json) contains an em-dash (U+2014, 0xE28094 in UTF-8).

The _read_mcp_config and _write_mcp_config methods handle reading and writing the configuration file, but do not specify an encoding when opening the file. On Japanese Windows, Python defaults to CP932, which cannot decode the UTF-8 encoded em-dash, causing the error.

https://github.com/aws/aws-cli/blob/2.35.10/awscli/customizations/agenttoolkit/agents.py#L250-L267

Proposed Fix

  • Use compat_open instead of open when opening the file, or
  • Explicitly open the file with UTF-8 encoding

Since the configuration files for each agent are expected to be UTF-8 encoded (this hasn't been explicitly verified, but it is highly likely), hardcoding UTF-8 may not cause any issues.
Alternatively, I think it would be fine to include the file encoding settings in AGENT_CONFIGS.

Additional Information/Context

A similar issue may occur not only in the Japanese Windows but also in non-English Windows environments.

CLI version used

2.35.10

Environment details (OS name and version, etc.)

Japanese Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    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