I have a MCPClient in my Mastra agent accessing tools from my MPC server.
Everything works well until my MPC server goes offline and then comes back online. After this, the MCPClient fails to connect to my MPC server returning errors like the one shown below.
How can I handle graceful restoration of connectivity?
[MCP debug] [cindra] Executing tool: get_patient_information
Error: Error POSTing to endpoint (HTTP 400): Bad Request: No valid session ID provided
at StreamableHTTPClientTransport.send (file:///Users/andy/karuna/projects/portal/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js:284:23)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
[MCP debug] [cindra] Executing tool: get_patient_information