feat: SSE transport for Poke.com and remote agents#3
Merged
Conversation
Add Server-Sent Events (SSE) transport alongside existing stdio transport, enabling chomp's MCP server to work with Poke.com and other remote AI clients. Changes: - New SSE transport module (src/sse.rs) using axum - GET /sse: SSE event stream with session management - POST /message?sessionId=<id>: JSON-RPC request endpoint - GET /health: health check endpoint - CORS headers for remote access - Refactored mcp.rs: extracted handle_request() for shared use by both transports - Updated serve command with --transport (stdio|sse|both), --port, --host flags - Environment variable support: CHOMP_PORT, CHOMP_HOST - SSE feature flag (enabled by default, can be disabled for minimal builds) - Updated README with transport documentation Co-authored-by: Mei Park <hey@meimakes.com>
There was a problem hiding this comment.
Pull request overview
This PR adds SSE (Server-Sent Events) transport support to the chomp MCP server, enabling remote AI clients like Poke.com to interact with the server over HTTP, complementing the existing stdio transport used by Claude Desktop.
Changes:
- Added SSE HTTP server with session-based event streaming and JSON-RPC request handling
- Refactored MCP request handling to be transport-agnostic, extracting shared logic into reusable functions
- Extended CLI with transport selection options (stdio, sse, both) and environment variable support for deployment configuration
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sse.rs | New SSE transport implementation with axum-based HTTP server, session management, and three endpoints (SSE stream, message POST, health check) |
| src/mcp.rs | Refactored to extract handle_request() for shared request handling across transports; added parse_request() helper; renamed serve() to serve_stdio() |
| src/main.rs | Updated serve command with transport mode flags, port/host configuration, environment variable support, and logic to run both transports simultaneously |
| Cargo.toml | Added sse feature flag (enabled by default) with optional dependencies: axum, tokio-stream, uuid, tower-http; enabled clap "env" feature; added tokio rt-multi-thread feature |
| Cargo.lock | Added dependencies for SSE support |
| README.md | Updated documentation with transport options, SSE endpoint details, environment variables, and usage examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add error logging for DB and serialization failures - Fix session cleanup (lazy removal of dead sessions) - Handle SSE send failures explicitly - Fix JSON-RPC spec compliance for notifications - Remove duplicate notification handler - Fix race condition in both transport mode Co-authored-by: Mei Park <hey@meimakes.com>
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.
What
Adds SSE (Server-Sent Events) transport to chomp's MCP server, so it works with Poke.com and other remote AI clients — not just Claude Desktop's stdio.
Changes
src/sse.rs— axum-based HTTP server with:GET /sse— SSE event stream with per-session channelsPOST /message?sessionId=<id>— JSON-RPC request endpointGET /health— health checksrc/mcp.rs— extractedhandle_request()so both transports share the same handler logicservecommand — new flags:--transport(stdio|sse|both),--port,--hostCHOMP_PORT,CHOMP_HOSTfor deployment configssefeature (default on), can be disabled for minimal buildsUsage
Testing
Tested locally with a Python SSE client: