Skip to content

Comments

Adds SSE (Server-Sent Events) Support#140

Open
JorySchossau wants to merge 3 commits intoguzba:masterfrom
JorySchossau:master
Open

Adds SSE (Server-Sent Events) Support#140
JorySchossau wants to merge 3 commits intoguzba:masterfrom
JorySchossau:master

Conversation

@JorySchossau
Copy link

@JorySchossau JorySchossau commented Feb 8, 2026

  • Implementation canonical with the rest of mummy (unlike mummyx)
  • User-facing syntax inspired by mummyx
  • New examples
  • New test

Stress-Testing

  • Default mm:ORC
  • Ran hundreds of thousands of streaming queries with opening and closing connections with the incredible speed of mummy
  • RSS memory stabilized in an expected range (no leaks)

Potential Opinion Points

  • SSEEvent and SSERawEvent now implemented on this PR. We could have 2 different Objects: SSEEvent and SSEEventRaw so folks who want an automatic 'data :' prefix can have it, and those who don't can have theirs.
  • SSEEvent prefixes event stream chunks with 'data: ' as normal
  • SSERawEvent does not - useful for NDJSON format and others.

@ThomasTJdev
Copy link
Contributor

Hi @JorySchossau

Really nice PR! Personally I would love mummy to support it.

Have you tested or set up a real MCP server with "tools" using the code in PR?

@JorySchossau
Copy link
Author

JorySchossau commented Feb 11, 2026

I've not tested or set up an MCP server. However, I'm making a multi-provider inference relay with tools and vision support and conversion between all provider formats, and it works already (with the above PR code) for several of the providers: OpenAI (& DeepSeek variant), Anthropic, Github Copilot, Ollama, Gemini. So I point my local tool like VSCode or Claude Code at the local relay server, and it proxies some other service such as ChatGPT. It's like Claude Code Router but more flexible and a single binary. Cohere format is what I'm working on now as it is the odd one out having non-standard SSE without 'data: ' prefix.

I'm curious if you have opinions on the SSEEvent / SSEEventRaw solution?

@ThomasTJdev
Copy link
Contributor

@JorySchossau,

My current MCP is based on a fork of nimcp and then a fork of mummyx.

I'm not the right person to do a review on the SSE implementation, so no input on that from me (for now).

@JorySchossau
Copy link
Author

@ThomasTJdev Curious what you needed that wasn't in mummyx for MCP?

I Implemented what I suggested earlier.

  • connection.send(SSEEvent(... that prefixes data: to the message (the original proposal for this PR)
  • connection.send(SSERawEvent(... that allows sending anything - suitable for NDJSON formats.

I'm unsure if the raw event would benefit from id and event fields, so I just left all that intact like its SSEEvent sibling. They're not required anyway.

My in-progress project now fully utilizes both of these and the code is cleaner now.

@JorySchossau
Copy link
Author

JorySchossau commented Feb 19, 2026

I got an email from another nim user attempting SSE with mummyx. They're now using this branch and their code is working and they're asking me to update the branch with examples.

I'd rather help maintain mummy than maintain my own fork.
What would be needed to get this PR approved? Tagging @guzba and anyone else.

Perhaps:

  • docs update
  • quick example on the main README.md

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.

2 participants