Skip to content

Fix Reconnect handler #290

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

Merged
merged 2 commits into from
Apr 10, 2025
Merged

Conversation

cliffhall
Copy link
Contributor

@cliffhall cliffhall commented Apr 9, 2025

This fixes #273

  • In Sidebar.tsx
    • In Reconnect button handler, call onDisconnect before onConnect

Motivation and Context

The Reconnect button was creating a new connection, but subsequent messages sent to the server went with the previous sessionId, and were therefore rejected. See #273

How Has This Been Tested?

  • Connect to the server-everything server via SSE

    • List Resources, List Tools
    • Click Reconnect
    • Repeat
  • Connect to the server-everything server via STDIO

    • List Resources, List Tools
    • Click Reconnect
    • Repeat

Server Everything SSE

Screenshot 2025-04-09 at 12 05 55 PM

Server Everything STDIO

Screenshot 2025-04-09 at 12 08 06 PM

Breaking Changes

Nope.

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

The troubleshooting that led to this fix.
See: #273 (comment)

* In Sidebar.tsx
  - In Reconnect button handler, call onDisconnect before onConnect

See: modelcontextprotocol#273 (comment)
@cliffhall cliffhall added the bug Something isn't working label Apr 9, 2025
@cliffhall cliffhall self-assigned this Apr 9, 2025
@cliffhall cliffhall requested review from jspahrsummers, ashwin-ant, dsp-ant and dend and removed request for jspahrsummers April 9, 2025 16:03
@pulkitsharma07
Copy link
Contributor

Nice one @cliffhall !

Copy link
Contributor

@tadasant tadasant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it out before/after - works great with the fix!

@tadasant tadasant merged commit 4a2ba7c into modelcontextprotocol:main Apr 10, 2025
2 checks passed
@cliffhall cliffhall deleted the fix-reconnect branch April 10, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On second reconnection Inspector errors out
3 participants