Skip to content

Conversation

@richardkmichael
Copy link
Collaborator

@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 <[email protected]>
…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 <[email protected]>
@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
@olaservo olaservo enabled auto-merge July 26, 2025 17:48
Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I tested with a combination of:

  • connected server with no Resources
  • connected server with Resources
  • not connected to a server

and this all looks good to me.

@olaservo olaservo merged commit 21aa917 into modelcontextprotocol:main Jul 26, 2025
4 checks passed
@richardkmichael richardkmichael deleted the routing-fragment-cleanup branch August 1, 2025 20:37
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.

2 participants