Skip to content

Conversation

@linw1995
Copy link
Contributor

  • Add TransportWriter type alias for cleaner type definitions
  • Wrap transport writer in Option to enable proper closure
  • Implement close() method to drop writer and signal end of communication
  • Update graceful_shutdown to close transport before waiting for process exit
  • Improve error handling for closed transport state

Motivation and Context

I recently built an MCP stdio server that uses grcov for code coverage collection. During integration testing, I discovered that source coverage from the MCP server binary was not being generated.
After investigation, I found that LLVM profile data is not produced when an executable exits with an abnormal status.

How Has This Been Tested?

Yes. I try it out on my project.

image
  • Before: Coverage data was missing due to abnormal exit status
  • After: Coverage data is consistently generated and collected

Breaking Changes

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 Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Addresses the graceful shutdown improvements discussed in #347 and #364

- Add TransportWriter type alias for cleaner type definitions
- Wrap transport writer in Option to enable proper closure
- Implement close() method to drop writer and signal end of communication
- Update graceful_shutdown to close transport before waiting for process exit
- Improve error handling for closed transport state

Addresses the graceful shutdown improvements discussed in modelcontextprotocol#347 and modelcontextprotocol#364
@github-actions github-actions bot added T-core Core library changes T-transport Transport layer changes labels Aug 27, 2025
@jokemanfire jokemanfire merged commit d328157 into modelcontextprotocol:main Aug 28, 2025
11 checks passed
@github-actions github-actions bot mentioned this pull request Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants