Skip to content

feat: SSE transport for Poke.com and remote agents#3

Merged
meimakes merged 3 commits intomainfrom
feat/sse-transport
Feb 14, 2026
Merged

feat: SSE transport for Poke.com and remote agents#3
meimakes merged 3 commits intomainfrom
feat/sse-transport

Conversation

@robutsume
Copy link
Collaborator

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

  • New src/sse.rs — axum-based HTTP server with:
    • GET /sse — SSE event stream with per-session channels
    • POST /message?sessionId=<id> — JSON-RPC request endpoint
    • GET /health — health check
    • CORS headers for remote access
  • Refactored src/mcp.rs — extracted handle_request() so both transports share the same handler logic
  • Updated serve command — new flags: --transport (stdio|sse|both), --port, --host
  • Env var supportCHOMP_PORT, CHOMP_HOST for deployment config
  • Feature flagsse feature (default on), can be disabled for minimal builds

Usage

# Existing behavior unchanged
chomp serve

# SSE for Poke.com / Railway
chomp serve --transport sse --port 3000 --host 0.0.0.0

# Both simultaneously
chomp serve --transport both

Testing

Tested locally with a Python SSE client:

  • ✅ SSE connection + session ID via endpoint event
  • ✅ initialize, tools/list, tools/call (get_today, search_food)
  • ✅ Notifications handled correctly (no response for notifications/initialized)
  • ✅ Invalid session returns 404
  • ✅ All responses received via SSE message events
  • ✅ Health endpoint returns server info
  • ✅ Zero clippy warnings

robutsume and others added 2 commits February 14, 2026 07:49
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>
Copy link

Copilot AI left a 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 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>
@meimakes meimakes merged commit b6eb95c into main Feb 14, 2026
1 check passed
@meimakes meimakes deleted the feat/sse-transport branch February 14, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants