Skip to content

fix(git): keep stdio validation errors recoverable#4334

Open
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/git-stdio-parse-errors
Open

fix(git): keep stdio validation errors recoverable#4334
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/git-stdio-parse-errors

Conversation

@he-yufeng

Copy link
Copy Markdown

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

  • Server: git
  • Changes to: stdio transport error handling

Motivation and Context

mcp-server-git was the outlier among the Python reference servers: it passed raise_exceptions=True into Server.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.py
  • python -m pytest src\git\tests\test_server.py::test_stdio_transport_errors_do_not_abort_server -q
  • python -m ruff check src\git\src\mcp_server_git\server.py src\git\tests\test_server.py
  • git diff --check

I also ran the full python -m pytest src\git\tests\test_server.py -q on Windows. All test assertions reached pass state, but the existing GitPython temp repository fixture hit Windows file-handle cleanup errors during teardown (PermissionError while removing .git temp 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

No README/config changes are needed because this is an internal transport recovery behavior fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[git] raise_exceptions=True

1 participant