fix: replace fastmcp update_config_file with encoding-safe implementation#178
Merged
ichoosetoaccept merged 1 commit intomainfrom Feb 18, 2026
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Greptile SummaryReplaces fastmcp's
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["_write_config_file(config_path, server_config)"] --> B{config_path exists?}
B -- Yes --> C["Read file with encoding='utf-8'"]
C --> D{Content non-empty?}
D -- Yes --> E["json.loads(raw)"]
D -- No --> F["config = {}"]
B -- No --> F
E --> G["config.setdefault('mcpServers', {})"]
F --> G
G --> H["config['mcpServers'][SERVER_NAME] = server_config.model_dump()"]
H --> I["write_text(json.dumps(config), encoding='utf-8')"]
I --> J["return True ✅"]
E -- JSONDecodeError --> K["except Exception → return False ❌"]
I -- OSError --> K
Last reviewed commit: 7323bab |
Member
Author
Merge activity
|
ichoosetoaccept
added a commit
that referenced
this pull request
Feb 18, 2026
…m deeplink (#181) ## Summary Address two Greptile review findings from PR #178 (merged before comments were visible due to stacked PR limitations). ## Changes 1. **Check stderr for Claude Code CLI detection** — Some CLI tools (including Node.js-based CLIs) print version info to stderr rather than stdout. `_find_claude_command` now checks both `result.stdout` and `result.stderr` for the "Claude Code" string. Applied to both the PATH lookup and the known-locations fallback. 2. **Exclude empty `env` from Cursor deeplink** — `model_dump_json(exclude_none=True)` still serialized `"env": {}` into the base64 payload when no env vars were provided. Added `exclude_defaults=True` to omit the empty dict, keeping the deeplink payload clean and consistent with `mcp-json` output. ## Tests added - `test_found_via_stderr` — verifies Claude Code detection when version string is only in stderr - `test_deeplink_excludes_empty_env` — decodes the base64 deeplink config and asserts `env` key is absent when no env vars provided - Updated `test_not_claude_code` to also set `stderr=""` for completeness ## Related Filed #180 for the codereviewbuddy bug where `list_review_comments` missed these inline Greptile threads entirely.
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.

Summary
Replace fastmcp's
update_config_file()with our own encoding-safe implementation in theinstallmodule.Problem
CI was failing across all platforms (Ubuntu, macOS, Windows) and both dependency resolutions (
highestandlowest-direct). The root cause: fastmcp'supdate_config_file()internally callsPath.read_text()andPath.write_text()without specifyingencoding=. Our CI setsPYTHONWARNDEFAULTENCODING=1, which in Python 3.14 promotes this to anEncodingWarningexception — caught by_write_config_file's broadexcept Exceptionhandler, making all config-writing tests fail.Fix
update_config_file()call with a simple read → merge → write usingjson.loads/json.dumps, always passingencoding="utf-8".update_config_fileimport from fastmcp (onlyStdioMCPServeris still used).update_config_fileto instead trigger real filesystem errors (making a path a directory sowrite_textfails).Test plan
All 461 tests pass locally. CI should now pass on all matrix combinations.