-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The condition in this line https://github.com/modelcontextprotocol/typescript-sdk/blob/main/src/client/streamableHttp.ts#L281 leads to infinite retries when set to 0
// Check if we've exceeded maximum retry attempts
if (maxRetries > 0 && attemptCount >= maxRetries) {
this.onerror?.(new Error(`Maximum reconnection attempts (${maxRetries}) exceeded.`));
return;
}To Reproduce
Steps to reproduce the behavior:
- Start a StreamableHttpServer demo
- Change the StreamableHttpClientTransport's
reconnectionOptionsto the following:
reconnectionOptions: {
maxRetries: 0
}
Expected behavior
Two options:
A - Fix the code to handle 0 to disable retry from client side
B - Document clearly the behavior when set to 0 (although, one could argue -1 to be an appropriate value for it)
Logs
If applicable, add logs to help explain your problem.
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working