-
Notifications
You must be signed in to change notification settings - Fork 636
feat: support HTTP streaming #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces HTTP streaming support by refactoring the request handling logic and replacing the legacy mount-based handler with dedicated serveSSE and serve endpoints. Key changes include:
- Removal of the mcpHandler variable and switching to direct calls to MyMCP.serveSSE()/serve.
- Renaming the streaming check variable from isSse to isStreamMethod for clarity.
- Bumping dependency versions in package.json.
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/index.ts | Refactored stream handling logic and variable renaming for HTTP streaming support. |
| package.json | Upgraded @modelcontextprotocol/sdk and agents dependencies to newer versions. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
src/index.ts:161
- [nitpick] Consider renaming this variable to something like 'isGetRequest' to avoid confusion with the previously renamed 'isStreamMethod', which indicates the overall streaming condition.
const isSse = request.method === "GET";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for HTTP streaming by refactoring the request handling logic and updating associated dependencies. Key changes include:
- Refactoring of the request parsing in MyMCP to use a new property (requestUrl).
- Adjusting the logic for streaming requests by renaming and re-routing requests to the proper streaming handler.
- Updating dependency versions in package.json and changing the DefaultRepoHandler parameter schema from undefined to an empty object.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/index.ts | Refactored request handling and streaming routing logic in the MyMCP class. |
| src/api/tools/repoHandlers/DefaultRepoHandler.ts | Revised parameter schema assignment to improve type consistency. |
| package.json | Updated dependency versions to align with current releases. |
Comments suppressed due to low confidence (2)
src/index.ts:140
- [nitpick] The variable 'isStreamMethod' is introduced while a similarly purposed variable 'isSse' is defined later. For clarity, consider using a consistent naming convention (e.g., renaming 'isSse' to 'isGetMethod').
const isStreamMethod = request.headers.get("accept")?.includes("text/event-stream") &&
src/api/tools/repoHandlers/DefaultRepoHandler.ts:33
- Changing 'paramsSchema' from undefined to an empty object assumes that the callback (fetchDocumentation) correctly handles a defined schema. Please confirm that the behavior remains consistent with expected schema validation or usage.
paramsSchema: {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for HTTP streaming, enhancing the handling of server‐sent events and related request routing while updating dependency versions and tool schemas.
- Introduces streaming support and updates SSE handling logic in src/index.ts.
- Refactors tool parameter schema handling in DefaultRepoHandler.ts.
- Updates dependency versions in package.json.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/index.ts | Adjusts request URL parsing, updates streaming and SSE routing, and renames variables to clarify processing method. |
| src/api/tools/repoHandlers/DefaultRepoHandler.ts | Updates the tool’s parameter schema from undefined to a union type to explicitly allow an empty object or null. |
| package.json | Bumps version numbers for @modelcontextprotocol/sdk, agents, @cloudflare/workers-types, and wrangler to support new features. |
Comments suppressed due to low confidence (1)
src/index.ts:156
- [nitpick] The variable 'isSse' here solely checks if the request method is GET, which may cause confusion given its earlier use in determining SSE support via headers. Consider renaming it to 'isGetMethod' or a similar name for clearer intent.
const isSse = request.method === "GET";
No description provided.