chore: refactors components composing StreamableHttpRunner into their own files and moves nested function to their own methods#972
Open
himanshusinghs wants to merge 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the StreamableHttpRunner module by splitting the monolithic src/transports/streamableHttp.ts file into a directory structure with individual files for each component. It also converts nested functions within the setupRoutes method of MCPHttpServer into proper class methods.
Changes:
- Splits
streamableHttp.tsinto four files:streamableHttpRunner.ts,mcpHttpServer.ts,healthCheckServer.ts, andexpressBasedHttpServer.tsundersrc/transports/streamableHttp/. - Converts nested functions (
reportSessionError,handleSessionRequest,initializeServer) inMCPHttpServer.setupRoutesinto private class methods. - Updates all import paths across source and test files to reference the new file locations.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/transports/streamableHttp.ts |
Deleted — original monolithic file removed |
src/transports/streamableHttp/streamableHttpRunner.ts |
New file containing the StreamableHttpRunner class |
src/transports/streamableHttp/httpServers/mcpHttpServer.ts |
New file containing MCPHttpServer with nested functions refactored to methods |
src/transports/streamableHttp/httpServers/healthCheckServer.ts |
New file containing the HealthCheckServer class |
src/transports/streamableHttp/httpServers/expressBasedHttpServer.ts |
New file containing the ExpressBasedHttpServer abstract base class |
src/lib.ts |
Updated import path for StreamableHttpRunner |
src/index.ts |
Updated import path for StreamableHttpRunner |
tests/integration/transports/*.test.ts |
Updated import paths for StreamableHttpRunner (4 files) |
You can also share your feedback on Copilot code review. Take the survey.
Collaborator
Pull Request Test Coverage Report for Build 23048488605Details
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
The StreamableHttpRunner starts a HealthCheckServer and an McpHttpServer both based on Express. All these components currently live in the same file. This PR splits the inidividual components into their own files and moves the nested function created in setupRoutes method to their own class methods.
The PR has no logic changes, pure refactor.
Please review the PR commit by commit:
Checklist