Skip to content

chore: Routing fragment only when connected #638

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

richardkmichael
Copy link
Contributor

@richardkmichael richardkmichael commented Jul 23, 2025

  • Only display the routing fragment when connected
  • Route to the first tab which the server provides, not always #resources

Note:

  • I had quite a few test failures in CI, but not locally, due test order execution differences. By formally randomizing test order (instead of a difference due to shell globbing or other CI-specific differences), Jest will output a seed value which can be used locally.

  • Future work can refactor the tests, there is now duplication

Motivation and Context

The tabs for MCP components only display when connected to a server, so there is no Resources tab available on initial open of the Inspector. The Inspector has numerous configuration options and also remembers state (via localStorage), so displaying a routing fragment when it is not relevant can be confusing and suggest a state or configuration bug.

How Has This Been Tested?

React and Playwright tests added. Tested locally as well.

Breaking Changes

Seems unlikely.

Types of changes

Not sure how to categorize; I consider this a "UX bug".

  • 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

@richardkmichael richardkmichael changed the title Routing fragment only when connected WIP: Routing fragment only when connected Jul 23, 2025
@richardkmichael richardkmichael marked this pull request as draft July 23, 2025 23:10
@richardkmichael richardkmichael force-pushed the routing-fragment-cleanup branch 10 times, most recently from 183143f to 3ab4ddc Compare July 24, 2025 07:13
richardkmichael and others added 3 commits July 24, 2025 13:13
- Only set URL fragment when mcpClient is connected
- Set default fragment based on server capabilities priority (resources > prompts > tools > ping)
- Clear fragment when disconnected to prevent stale routing state

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ndow mocking

  - Add tests for hash routing based on server capabilities priority
  - Test that no hash is set when disconnected
  - Add e2e test verifying startup has no hash fragment
  - Use Jest module mocking for useConnection hook states

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@richardkmichael richardkmichael force-pushed the routing-fragment-cleanup branch from bd39459 to 8de1122 Compare July 24, 2025 20:30
@richardkmichael richardkmichael changed the title WIP: Routing fragment only when connected Routing fragment only when connected Jul 24, 2025
@richardkmichael richardkmichael marked this pull request as ready for review July 24, 2025 20:32
@richardkmichael richardkmichael marked this pull request as draft July 24, 2025 20:32
@richardkmichael richardkmichael marked this pull request as ready for review July 24, 2025 20:35
@richardkmichael richardkmichael changed the title Routing fragment only when connected chore: Routing fragment only when connected Jul 25, 2025
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