fix(git): keep stdio validation errors recoverable#4334
Open
he-yufeng wants to merge 1 commit into
Open
Conversation
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.
Description
Fixes #4213 by letting the git server use the default
Server.run(...)behavior, matching the time server. Validation errors from stdin parsing should be returned through the JSON-RPC error path instead of being re-raised into the server task group and terminating the process.Server Details
Motivation and Context
mcp-server-gitwas the outlier among the Python reference servers: it passedraise_exceptions=TrueintoServer.run(...). For malformed JSON-RPC input, that makes transport-level validation errors abort the server process instead of keeping the stdio session recoverable.The change removes that override and adds a focused regression test that verifies the git server no longer opts into exception-raising transport behavior.
How Has This Been Tested?
python -m py_compile src\git\src\mcp_server_git\server.py src\git\tests\test_server.pypython -m pytest src\git\tests\test_server.py::test_stdio_transport_errors_do_not_abort_server -qpython -m ruff check src\git\src\mcp_server_git\server.py src\git\tests\test_server.pygit diff --checkI also ran the full
python -m pytest src\git\tests\test_server.py -qon Windows. All test assertions reached pass state, but the existing GitPython temp repository fixture hit Windows file-handle cleanup errors during teardown (PermissionErrorwhile removing.gittemp dirs). I did not count that as a clean full-suite pass.Breaking Changes
None. This aligns git server transport error behavior with the other Python servers instead of changing tool semantics.
Types of changes
Checklist
Additional context
No README/config changes are needed because this is an internal transport recovery behavior fix.