Skip to content

fix(shared): preserve MCPError payload on pickle#2478

Open
MukundaKatta wants to merge 1 commit intomodelcontextprotocol:mainfrom
MukundaKatta:codex/mcp-error-pickle-safe
Open

fix(shared): preserve MCPError payload on pickle#2478
MukundaKatta wants to merge 1 commit intomodelcontextprotocol:mainfrom
MukundaKatta:codex/mcp-error-pickle-safe

Conversation

@MukundaKatta
Copy link
Copy Markdown

Summary

  • make MCPError pickle-safe by reconstructing exceptions from the full ErrorData payload instead of bare Exception args
  • preserve the specialized UrlElicitationRequiredError shape during round-trip reconstruction
  • add regression tests for pickling both MCPError and UrlElicitationRequiredError

Testing

  • python3 -m py_compile src/mcp/shared/exceptions.py tests/shared/test_exceptions.py
  • python3 -m pytest tests/shared/test_exceptions.py -k pickle_roundtrip
  • PYTHONPATH=src python3 -m pytest tests/shared/test_exceptions.py -k pickle_roundtrip

Local note: pytest is blocked in this desktop environment because the available interpreter bottoms out before the repo's required typing features (ImportError on TypeAlias from Python 3.9).

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.

1 participant