Skip to content

Conversation

@funwarioisii
Copy link
Owner

close: #22

I'm planning to checkout from this branch and proceed with the SSE implementation
Additionally:

  • Fix the tests
  • Complete the implementation related to SSE

@kfischer-okarin
Copy link
Contributor

kfischer-okarin commented Mar 23, 2025

I realize that with my ClientConnection refactor I made the wrong assumption about the control flow, i.e. which object is in control of application flow

sequenceDiagram
    participant M as main
    participant S as Server
    participant C as ClientConnection

   M->>S: serve
    loop While server is running
        S->>C: read_next_message
        C-->>S: message
        S->>S: process_input
        S->>C: send_message
        C-->>S: OK
    end
Loading

But it's probably more fitting to have something like this

sequenceDiagram
    participant M as main
    participant S as Server
    participant H as MessageHandler

   M->>S: serve
    loop While server is running
        S->>H: handle_message
        H-->>S: response
    end
Loading

where MessageHandler would basically what the server is right now except for the serve method - which is transport agnostic... And then all the Transport logic would be handled by the Server object - and there would be StdIoServer and an HttpSseServer etc

Maybe it would be better to first refactor it to this easier to handle form before starting SSE 🤔

@kfischer-okarin
Copy link
Contributor

kfischer-okarin commented Mar 23, 2025

Basically like this
kfischer-okarin@610e6cb

Server#process_input became public method MessageHandler#handle_message

just did the initial extract commit to show practically what I mean - didn't touch the tests - but then renaming/moving most of them to equivalent MessageHandler tests should be trivial - they should become quite a bit simpler too - since we wouldn't have to do the Fiber hacks anymore to circumvent the serve loop inside the tests.....

@martinemde
Copy link
Contributor

Hey, just noting that a new spec dropped today and it changed the implementation. I haven't looked closely.

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.

Remote MCP Server

4 participants