Skip to content

refactor: extract transport mode selection#544

Open
zereight wants to merge 1 commit into
mainfrom
refactor/transport-mode
Open

refactor: extract transport mode selection#544
zereight wants to merge 1 commit into
mainfrom
refactor/transport-mode

Conversation

@zereight

@zereight zereight commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

Part of #516.

This is a small behavior-preserving server refactor:

  • moves TransportMode and transport selection priority into server/transport-mode.ts
  • keeps all startup functions in index.ts
  • preserves the existing priority: Streamable HTTP > SSE > stdio

Verification

  • rtk npm run build
  • rtk npm run test:remote-auth
  • rtk npm run test:mcp-oauth
  • node --import tsx/esm --test test/streamable-http-static-token-auth.test.ts

Note

Low Risk
Behavior-preserving refactor with no changes to startup wiring or transport priority; only module boundaries moved.

Overview
Moves MCP transport mode selection out of index.ts into a new server/transport-mode.ts module.

The TransportMode enum and determineTransportMode() (priority: Streamable HTTP → SSE → stdio) are exported from there; index.ts imports them and still owns all startup paths (startStdioServer, SSE, Streamable HTTP). Selection logic is unchanged—only location and a slightly tighter determineTransportMode implementation.

Reviewed by Cursor Bugbot for commit 1ec3708. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The TransportMode enum and determineTransportMode() function are extracted from index.ts into a new server/transport-mode.ts module. index.ts removes its inline definitions (−32 lines) and adds a single import from the new module.

Changes

Transport Mode Module Extraction

Layer / File(s) Summary
New transport-mode module and index.ts import
server/transport-mode.ts, index.ts
server/transport-mode.ts exports TransportMode enum (stdio, sse, streamable-http) and determineTransportMode() with streamable-httpssestdio priority fallback. index.ts removes the equivalent inline definitions and replaces them with an import from the new module.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor: extract transport mode selection' clearly and concisely summarizes the main change - extracting transport mode logic into a separate module.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly relates to the changeset, explaining the refactor of transport mode selection into a new module while preserving behavior.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/transport-mode
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch refactor/transport-mode

Comment @coderabbitai help to get the list of available commands and usage tips.

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