fastmcp/docs/servers
Xing 03b62d2e3d
feat: handle error from the initialize middleware (#2531)
* 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.

* docs update

* test: use McpError assertions now that exception propagation is fixed

- Update tests to catch McpError specifically instead of generic Exception
- Remove commented-out code in low_level.py

---------

Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-12-10 15:51:51 -05:00
..
auth Fix RFC 8414 path-aware authorization server metadata discovery (#2533) 2025-12-03 19:16:59 -05:00
composition.mdx 2.14 deprecation removals (#2329) 2025-12-01 14:11:00 -05:00
context.mdx [2.14] SEP-1686 tasks (#2378) 2025-12-04 20:10:35 -05:00
elicitation.mdx SEP-1330 enum schema support (#2549) 2025-12-09 12:22:30 -05:00
icons.mdx Fix version number in VersionBadge: change 2.14.0 to 2.13.0 (#2491) 2025-11-26 16:51:18 -05:00
logging.mdx Also push client messages (info/warn/debug) to server debug log (#2063) 2025-10-14 11:38:26 -07:00
middleware.mdx feat: handle error from the initialize middleware (#2531) 2025-12-10 15:51:51 -05:00
progress.mdx Update parameter capitalization 2025-06-28 15:06:16 -04:00
prompts.mdx Fix version badges for icons and website_url; add Discord example (#2509) 2025-12-01 13:39:43 -05:00
proxy.mdx 2.14 deprecation removals (#2329) 2025-12-01 14:11:00 -05:00
resources.mdx Fix version badges for icons and website_url; add Discord example (#2509) 2025-12-01 13:39:43 -05:00
sampling.mdx Move sampling fallback handler docs to server section (#2163) 2025-10-21 10:02:11 -04:00
server.mdx 2.14 deprecation removals (#2329) 2025-12-01 14:11:00 -05:00
storage-backends.mdx Add maturity warnings for py-key-value backends 2025-10-29 21:43:31 +00:00
tasks.mdx Remove TaskConfig and client from root exports (#2580) 2025-12-09 12:28:01 -05:00
tools.mdx [Draft] Add documentation for read-only tool patterns (#2536) 2025-12-09 13:47:29 -05:00