Skip to content

Read CLI-scanned MCP config files as UTF-8 explicitly - #4690

Merged
jlowin merged 1 commit into
mainfrom
claude/issue-4689-fix-3d8d69
Jul 28, 2026
Merged

jlowin merged 1 commit into
mainfrom
claude/issue-4689-fix-3d8d69

Conversation

@jlowin

@jlowin jlowin commented Jul 28, 2026

Copy link
Copy Markdown
Member

fastmcp discover reads MCP config files (Claude Desktop, Claude Code, project mcp.json, Cursor, Gemini, Goose) with Path.read_text(), which falls back to the OS's preferred encoding when none is given. On Windows with a non-UTF-8 locale (cp949, cp932, cp936), any non-ASCII byte in a config file — like an em dash written by another tool — raises an unhandled UnicodeDecodeError and crashes the command.

These files are always written as UTF-8 by the tools that produce them, so read them as UTF-8 explicitly rather than trusting the platform locale. Same pattern as the fixes in #3579, #4084, #4164, and #4532.

Closes #4689

Fixes UnicodeDecodeError in `fastmcp discover` on Windows when the
system locale isn't UTF-8 (e.g. cp949) and a scanned config file
(Claude Desktop, Claude Code, project mcp.json, Cursor, Gemini, Goose)
contains a non-ASCII byte.
@marvin-context-protocol marvin-context-protocol Bot added the bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. label Jul 28, 2026
@jlowin
jlowin merged commit d6b9dae into main Jul 28, 2026
16 checks passed
@jlowin
jlowin deleted the claude/issue-4689-fix-3d8d69 branch July 28, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fastmcp discover crashes with UnicodeDecodeError on Windows with a non-UTF-8 locale

1 participant