-
Notifications
You must be signed in to change notification settings - Fork 297
Server: Added Streamable HTTP & Bump MCP SDK version #166
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
Open
AhmedElhadidii
wants to merge
8
commits into
mobile-next:main
Choose a base branch
from
AhmedElhadidii:feat/streamable-http-transport
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4b62a4e
Server: migrate SSE to Streamable HTTP; unify /mcp; Linux-safe iOS si…
AhmedElhadidii 56710a0
Initial plan
Copilot 0b41683
Fix syntax errors in server.ts
Copilot 8df1ae9
Add support for both Streamable HTTP and SSE transports
Copilot 1d6e235
Merge pull request #2 from AhmedElhadidii/fix-6f821e86-029c-4b03-b812…
AhmedElhadidii af9a917
Delete src/types/mcp-sdk.d.ts
gmegidish 385b9c7
Remove iOS Simulator platform checks
gmegidish 3b6859b
Merge branch 'main' into feat/streamable-http-transport
AhmedElhadidii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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.
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.
Potential memory leak if
server.connect()fails.The transport is added to the
transportsmap on line 106 beforeserver.connect()is called on line 113. Ifconnect()throws, the entry remains in the map sinceres.on("close")may not fire for an incompletely established SSE connection.🔎 Proposed fix: store transport after successful connection
app.get("/sse", async (req, res) => { console.log("Received GET request to /sse (SSE transport)"); try { const transport = new SSEServerTransport("/messages", res); - transports[transport.sessionId] = transport; res.on("close", () => { delete transports[transport.sessionId]; }); const server = createMcpServer(); await server.connect(transport); + transports[transport.sessionId] = transport; } catch (error: any) { console.error("Error setting up SSE transport:", error); if (!res.headersSent) { res.status(500).send("Failed to establish SSE connection"); } } });📝 Committable suggestion
🤖 Prompt for AI Agents