Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Nov 8, 2025

Summary

This PR attempts to address Issue #9120. Feedback and guidance are welcome.

Problem

MCP servers fail to connect when the URL includes a trailing slash (e.g., https://api.githubcopilot.com/mcp/), returning a 405 non-200 response error. This creates friction for developers migrating from Cursor, which automatically normalizes URLs by removing trailing slashes.

Solution

Implemented URL normalization for both streamable-http and SSE type MCP servers by removing trailing slashes before creating the transport connections.

Changes

  • src/services/mcp/McpHub.ts: Added URL normalization for streamable-http connections (line 747) and SSE connections (line 773)
  • src/services/mcp/tests/McpHub.spec.ts: Added comprehensive test suite for URL normalization covering:
    • Single trailing slash removal
    • Multiple trailing slashes removal
    • URLs without trailing slashes remain unchanged
    • Both streamable-http and SSE server types

Testing

All tests pass successfully:

  • Added 4 new test cases for URL normalization
  • Existing test suite continues to pass (46 tests total)
  • Linting and type checking pass

Fixes

Fixes #9120


Important

Normalize MCP server URLs by removing trailing slashes to prevent connection errors, with comprehensive tests added.

  • Behavior:
    • Normalize MCP server URLs by removing trailing slashes in McpHub.ts for streamable-http and sse connections.
    • Handles URLs with single, multiple, and no trailing slashes.
  • Testing:
    • Added tests in McpHub.spec.ts for URL normalization.
    • Tests cover single and multiple trailing slashes, and URLs without trailing slashes.
    • Ensures both streamable-http and sse server types are tested.

This description was created by Ellipsis for f1990ff. You can customize this summary. It will automatically update as commits are pushed.

- Remove trailing slashes from streamable-http URLs to avoid 405 errors
- Apply same normalization to SSE URLs for consistency
- Add comprehensive tests for URL normalization

Fixes #9120
@roomote roomote bot requested review from cte, jr and mrubens as code owners November 8, 2025 08:09
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Nov 8, 2025
@roomote
Copy link
Author

roomote bot commented Nov 8, 2025

Rooviewer Clock   See task on Roo Cloud

Review completed successfully. No issues found.

This PR properly addresses issue #9120 by normalizing MCP server URLs to remove trailing slashes before creating transport connections. The implementation is clean, well-tested, and follows existing code patterns.

Changes reviewed:

  • URL normalization for streamable-http connections (line 747)
  • URL normalization for SSE connections (line 775)
  • Comprehensive test coverage for all edge cases

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] MCP server URL with trailing slash causes 405 error instead of auto-normalizing

3 participants