Skip to content

#4213 removed explicit raise_exceptions=True - #4553

Closed
Rithika-07 wants to merge 1 commit into
modelcontextprotocol:mainfrom
Rithika-07:#4213-fix
Closed

Rithika-07 wants to merge 1 commit into
modelcontextprotocol:mainfrom
Rithika-07:#4213-fix

Conversation

@Rithika-07

Copy link
Copy Markdown

Description

Removes the explicit raise_exceptions=True flag in mcp-server-git. This aligns its crash/error handling behavior with other reference servers (like mcp-server-time and mcp-server-sqlite), ensuring malformed client input results in a JSON-RPC error response rather than crashing the server process.

Server Details

  • Server: git
  • Changes to: server entrypoint (src/git/src/mcp_server_git/server.py)

Motivation and Context

There was an inconsistency in crash behavior across MCP reference servers when handling malformed client input (such as deep recursion payloads triggering Pydantic ValidationError):

  • mcp-server-git had raise_exceptions=True explicitly set, causing unhandled exceptions to tear down the task group and terminate the server process with exit code 1.
  • Other servers rely on the default (raise_exceptions=False), which handles the exception and reports it back to the client as an error while keeping the process running.

Removing raise_exceptions=True resolves this reliability issue and standardizes error handling behavior across reference servers.

How Has This Been Tested?

  1. Existing Test Suite: Ran pytest in a clean Python virtual environment. All 43 existing tests passed with zero regressions.
  2. Bug Reproducer Script: Sent a deeply nested tools/call (git_add) payload (200+ levels deep):
    • Before Fix: Server crashed immediately with code 1 (ValidationError).
    • After Fix: Server logged the error, returned a JSON-RPC error notification to the client, and stayed alive.

Breaking Changes

  • Yes
  • No

Types of changes

  • [ x] 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

@cliffhall cliffhall added the closed-superseded-v2 Closed: fixed or made obsolete by the v2 / 2026-07-28 refactor (#4875) label Oct 20, 2026
@cliffhall

Copy link
Copy Markdown
Member

Thank you for this pull request, and apologies for the long wait for a response.

Since it was opened, the reference servers have been rebuilt for the 2026-07-28 MCP specification (#4857) and released as v2 (2.0.0 on npm for the TypeScript servers, 2026.10.19 on PyPI for the Python servers). The code this PR changes has been replaced, and the behavior it addresses has either been fixed in v2 or no longer exists in the same form.

This is not a judgment on the change or on you; it's a consequence of the code it targets having been replaced. If the problem still happens on v2, please open a fresh issue with the version you're running and steps to reproduce. Note that this repository now accepts contributions as issues rather than pull requests from anyone but its maintainers; see CONTRIBUTING.md.

This is part of the backlog triage in #4875.

@cliffhall cliffhall closed this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closed-superseded-v2 Closed: fixed or made obsolete by the v2 / 2026-07-28 refactor (#4875)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants