[FEATURE] sse attempt #2
User description
So, I thought, yeah we can just use the MCP library and it should just work..
CodeAnt-AI Description
- Introduces a new Express-based HTTP server (
src/http-server.ts) supporting Server-Sent Events (SSE) for the MCP protocol, with robust session management, CORS, and compatibility with multiple MCP clients. - Integrates HTTP/SSE server startup into the main entrypoint (
src/index.ts), allowing command-line configuration for port and mode (HTTP/SSE-only or dual). - Adds a new CLI script (
src/start-sse-server.ts) to simplify launching the server in SSE/HTTP mode, with signal handling and argument parsing. - Updates the README to document SSE support, usage instructions, and new features, including changelog and roadmap updates.
- Upgrades dependencies in
package.jsonandpackage-lock.jsonto support Express 5.x, @types/express, and the latest MCP SDK, ensuring compatibility and stability. - Adds logging to server request handlers for better traceability.
This PR adds full Server-Sent Events (SSE) support to Desktop Commander, enabling remote connections via HTTP and compatibility with modern MCP clients. It provides a robust, session-aware HTTP server, updated documentation, and improved developer experience for running and managing the server in various modes.
Changes walkthrough
| Relevant files | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement |
| ||||||||||
| Documentation |
| ||||||||||
| Dependencies |
|
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
@codeant-ai ask: Your question here
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
@codeant-ai: review
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by CodeRabbit
-
New Features
- Added support for Server-Sent Events (SSE), allowing remote connections via HTTP for real-time streaming and compatibility with various MCP clients.
- Introduced new commands and scripts to start the server in SSE or dual mode, with customizable ports.
-
Documentation
- Updated documentation to describe SSE capabilities, usage instructions, endpoints, and upcoming related features.
-
Chores
- Updated dependencies and keywords to support and reflect SSE functionality.
CodeAnt AI is reviewing your PR.
Walkthrough
The changes add Server-Sent Events (SSE) support to Desktop Commander MCP, enabling remote connectivity via HTTP. Documentation in the README is updated to describe SSE usage. New scripts, dependencies, and a dedicated HTTP server using Express are introduced. Command-line options allow running in STDIO, HTTP/SSE, or combined modes, with session management and protocol support.
Changes
| File(s) | Change Summary |
|---|---|
| README.md | Updated documentation to announce and detail new SSE support, including usage instructions, endpoint descriptions, and planned features. |
| package.json | Added SSE-related executable and scripts, updated keywords, bumped @modelcontextprotocol/sdk, and added Express dependencies for HTTP/SSE server support. |
| src/http-server.ts | New Express-based HTTP/SSE server implementation supporting MCP StreamableHTTP transport, session management, CORS, and JSON-RPC request handling. |
| src/start-sse-server.ts | New CLI script to launch the server in SSE/HTTP-only or combined modes, handling process arguments and signal forwarding to child process. |
| src/index.ts | Added command-line parsing for HTTP/SSE modes and ports; integrated HTTP/SSE server startup and conditional STDIO server startup based on flags. |
| src/server.ts | Modified resource and prompt list request handlers to accept and log the incoming request object for debugging. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant CLI
participant MainServer
participant HTTPServer
User->>CLI: Run desktop-commander-sse [--sse-only] [--port=PORT]
CLI->>MainServer: Spawn with --sse [--sse-only] --port=PORT
MainServer->>HTTPServer: Start HTTP/SSE server on PORT
User->>HTTPServer: Connect via /mcp (GET/POST)
HTTPServer->>MainServer: Establish MCP session/transport
HTTPServer-->>User: Stream events/responses via SSE
User->>HTTPServer: Send JSON-RPC requests (POST)
HTTPServer->>MainServer: Route requests to session transport
MainServer-->>HTTPServer: Respond with results/errors
HTTPServer-->>User: Send JSON-RPC responses/events
Poem
In the warren, code now streams,
SSE hops in, fulfilling dreams.
With ports and flags, the server’s new,
Express and MCP in a clever brew.
Rabbits cheer—connections flow,
On HTTP, events now go!
🐇✨
[!TIP]
⚡️ Faster reviews with caching
- CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure
Review - Disable Cacheat either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off theData Retentionsetting under your Organization Settings.Enjoy the performance boost—your workflow just got faster.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Explain this complex logic. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai explain this code block. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and explain its main purpose. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Pull Request Feedback 🔍
| 🔒 Security concerns The SSE endpoints are configured with "Access-Control-Allow-Origin: |
| ⚡ Recommended areas for review Code Duplication Error Handling Fragility Logging Overuse Dependency Upgrade Impact |
CodeAnt AI finished reviewing your PR.
That is not how its done There are sse and other server implementations Check documentation for SDK https://github.com/modelcontextprotocol/typescript-sdk
you just need alternative to stdio server from sdk and should work
I really like the idea of having this running on multiple remote dev systems (containers or LCXs)