Commit graph

5 commits

Author SHA1 Message Date
Jeremiah Lowin
329a0987b4 test: use McpError assertions now that exception propagation is fixed 2025-12-10 15:40:16 -05:00
tonyxwz
60a6f349d9 docs update 2025-12-10 15:37:48 -05:00
tonyxwz
95cc494e61 feat: handle error from the initialize middleware
In some situation, the initialize middleware can check the status of the
server and decide to raise an error.

Example use case: in a FastMCPProxy, an initialization middleware
overrides the on_initialize method and connect to the underlying proxied
client. When client respond with error, I want to pass this error to the
client.
2025-12-10 15:37:48 -05:00
Jeremiah Lowin
54692c361e
Expose InitializeResult to middleware (#2516)
Wrap responder.respond() to capture the InitializeResult before it's
sent to the write stream, then return it through the middleware chain.
This allows middleware (e.g., logging) to access the server's initialize
response, not just the client's request.
2025-12-01 20:55:29 -05:00
Jeremiah Lowin
ba1ba86a64
Support initialize requests in middleware (#1546) 2025-10-05 10:20:13 -04:00