Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor transports to help enable graceful shutdown #142

Merged
merged 12 commits into from
Mar 31, 2025

Conversation

halter73
Copy link
Contributor

I took this over from #122

  • This also paves the way for better multi-session support
  • We should definitely rethink names for the transport API. But for now, I kept the names similar as possible, so we can focus on the API shape.

stephentoub and others added 5 commits March 27, 2025 18:13
# Conflicts:
#	src/ModelContextProtocol/Client/McpClient.cs
#	src/ModelContextProtocol/Protocol/Transport/StdioServerTransport.cs
- This also paves the way for better multi-session support
- We should definitely rethink names for the transport API
- For now, I kept the names similar as possible, so we can
  focus on the API shape
@halter73 halter73 mentioned this pull request Mar 29, 2025
- Use SemaphoreSlim in McpJsonRpcEndpoint
- Dispose IClientTransport on connection failure
- Test cleanup
@halter73
Copy link
Contributor Author

The faster test runs after these changes are really nice.

csharp-sdk [main] > dotnet test --filter ModelContextProtocol.Tests.ClientIntegrationTests
...
Test summary: total: 41, failed: 0, succeeded: 39, skipped: 2, duration: 96.3s
csharp-sdk [main] > checkout gracefulshutdown
csharp-sdk [main] > dotnet test --filter ModelContextProtocol.Tests.ClientIntegrationTests
...
Test summary: total: 41, failed: 0, succeeded: 39, skipped: 2, duration: 37.8s

@stephentoub
Copy link
Contributor

Yeah, those 15-30s sleeps in the tests were killer.

@halter73 halter73 merged commit 2ab9db0 into modelcontextprotocol:main Mar 31, 2025
8 checks passed
@cristipufu
Copy link

cristipufu commented Mar 31, 2025

@halter73 @stephentoub how should we handle multi-nodes deployments?
eg:

  • session connects to sse on node1
  • session makes tool call request on node2
  • need to send tool call updates for session on node1

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.

4 participants