fix(auth): normalize default resource URL ports

Closed
DE
3mo ago
+44-1

Summary

  • Normalize explicit HTTP port 80 and HTTPS port 443 when canonicalizing resource URLs.
  • Preserve non-default ports, existing URL components, and authority edge cases.

Fixes #3297

Testing

  • uv run --frozen pytest tests/shared/test_auth_utils.py (19 passed)
  • uv run --frozen pyright src/mcp/shared/auth_utils.py tests/shared/test_auth_utils.py (0 errors)
  • uv run --frozen ruff check .
  • uv run --frozen ruff format --check .
  • Full coverage/matrix checks delegated to CI because the local Windows environment has no Bash; bash scripts/test could not run.

AI assistance

AI assistance was used during investigation and implementation. I reviewed the change, reproduced the issue, and understand the code and tests being submitted.