Testing out resumability
There’s actually an example implementation in the SDK for resumability. Let’s try that code out and see how it differs. You can find a simplified version of it at https://github.com/PacktPublishing/Learn-Model-Context-Protocol-with-Python/blob/main/Chapter05/solutions/resumability/README.md.
What the code does is define a server with one tool, process-files. Upon calling the tool, you get three notifications and one final response. The easiest way to test the server out is by using cURL. With cURL, we can perform the handshake process, call a tool, and even do the needed bespoke request so it replays events. Let’s take it step by step:
- Start the server first.
- Start a second terminal and call curlwith the following payload to exchange what features the client and the server both have:curl -X POST "http://127.0.0.1:8000/mcp" -H "Accept: text/event-stream, application/json" -H "Content...
 
                                             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
     
         
                 
                 
                 
                 
                 
                 
                 
                 
                