Repository navigation
cli: read MCP and fastmcp.json config files as utf-8 - #5345
Merged
Merged
Conversation
zzstoatzz
marked this pull request as ready for review
September 29, 2026 02:09
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the cli read
fastmcp.json,mcp.jsonand the existingclaude_desktop_config.jsonwith the system code page, so on windows with cp1252/cp936 non-asciienv/argsvalues came through garbled or crashedfastmcp install. every such read now passesencoding="utf-8", matchingMCPConfig.from_file,MCPServerConfig.from_fileandfastmcp discover(#4690).closes #5317
what was affected
seven call sites decoded with the locale encoding:
run_commandandcreate_mcp_config_server(fastmcp run), the MCPConfig check infastmcp inspect,_resolve_json_spec(fastmcp list/call),load_and_merge_config,process_common_args(all installers), and the env-merge pre-read ininstall_claude_desktop. with an arabic path likeC:\Users\فاطمة\notes.jsin the file, cp1252 hits the undefined byte0x81and raisesUnicodeDecodeError. some callers don't catch it at all, andinstall_claude_desktopreports it asFailed to install server: 'charmap' codec .... latin-1 text likeOlá Josédecodes to mojibake without any error.tests
tests/cli/test_config_encoding.pyadds a fixture that makes reads without an explicit encoding decode as cp1252. it patchesbuiltins.openandio.text_encoding, which is whatpathlibconsults. the file then drives each entry point with a utf-8 config containing arabic and accented text. all five tests fail on the previous code with the reporter's'charmap' codec can't decode byte 0x81error.not in scope
writes that still use the default encoding are untouched.
fastmcp generate-cliwriting its script and skill file could hit the same issue on the write side if tool descriptions contain non-ascii. that's a separate change if we want it.--env-filegoes throughdotenv_values, which already defaults to utf-8.Opened by the fastmcp-triage run on nate's laptop (run); the agent chose ready, urgency soon.
Resume the session:
claude --resume b1067b9d-7a01-46e6-89ae-bfb798f631b6🤖 Generated with Claude Code