fastmcp/examples
Jeremiah Lowin ede8ff6703
Convert mounted servers to MountedProvider (#2635)
* Simplify Provider interface and consolidate docket registration

- Remove get_http_routes from Provider (unused)
- Remove ProviderLifespanConfig, _base_lifespan, _register_tasks
- Remove supports_tasks flag from Provider.__init__
- Consolidate all docket registration in server._docket_lifespan()
- Simplify lifespan() to take no parameters
- Move MountedProvider to separate module

* Fix control flow in ComponentService resource methods

* Move providers to server/providers

* Ensure MountedProvider get_* methods go through middleware

* Fix get_resource to only return concrete resources

Reverts template-checking in get_resource that broke task execution.
Tasks need access to the original template, not instantiated resources.

* Move prefix utilities into mounted.py, deprecate import_server

- Add resource prefix functions (add/remove/has_resource_prefix) to mounted.py
- Deprecate import_server with warning to use mount() instead
- Add tool_names uniqueness validation in MountedProvider

* Fix provider iteration order and remove dead _is_mounted flag

- Remove unused _is_mounted flag (MountedProvider.lifespan() calls _lifespan
  not _lifespan_manager, so the flag was never checked)
- Fix provider iteration: change reversed() to forward order in execution
  methods (_call_tool, _read_resource_middleware, _get_prompt_content_middleware)
  to match documented "first non-None wins" semantics
- Fix ComponentService to handle prefix-less mounted servers using
  _strip_tool_prefix()/_strip_resource_prefix() methods
- Update conflict resolution tests to expect first-registered provider wins
- Add regression tests for Docket behavior and prefix-less ComponentService

* Add TaskComponents type and exception handling for provider task registration

- Create TaskComponents dataclass with FunctionTool/FunctionResource/etc. types
  for proper typing of get_tasks() return value
- Add try/except wrapper around provider.get_tasks() in _docket_lifespan for
  consistent error handling (warn + continue or raise based on settings)
- Remove type: ignore comments from server.py task registration loop
2025-12-17 22:21:51 -05:00
..
atproto_mcp Add "High Value" Ruff Rules (#2255) 2025-10-26 10:20:31 -04:00
auth Fix RFC 8414 path-aware authorization server metadata discovery (#2533) 2025-12-03 19:16:59 -05:00
fastmcp_config Implement typed source system for FastMCP configuration (#1607) 2025-08-24 16:32:37 -04:00
fastmcp_config_demo Internal refactor: fastmcp config to mcp server config (#1672) 2025-08-29 21:37:39 -04:00
providers/sqlite Convert mounted servers to MountedProvider (#2635) 2025-12-17 22:21:51 -05:00
sampling Consolidate sampling examples and fix tool_choice bug (#2618) 2025-12-14 20:47:00 -05:00
smart_home 2.14 deprecation removals (#2329) 2025-12-01 14:11:00 -05:00
tasks Remove enable_tasks setting, enable task protocol by default 2025-12-09 09:34:42 -05:00
testing_demo docs: clarify pytest-asyncio dependency and asyncio mode configuration (#2399) 2025-11-15 10:34:29 -05:00
complex_inputs.py Remove empty parens 2025-06-04 15:37:55 -04:00
config_server.py Remove empty parens 2025-06-04 15:37:55 -04:00
desktop.py Remove empty parens 2025-06-04 15:37:55 -04:00
echo.py Remove empty parens 2025-06-04 15:37:55 -04:00
get_file.py Add "High Value" Ruff Rules (#2255) 2025-10-26 10:20:31 -04:00
in_memory_proxy_example.py Add as_proxy improvements and tests 2025-05-17 12:23:48 -04:00
memory.fastmcp.json Update schema path (#1595) 2025-08-23 09:47:58 -04:00
memory.py 2.14 deprecation removals (#2329) 2025-12-01 14:11:00 -05:00
mount_example.fastmcp.json Update schema path (#1595) 2025-08-23 09:47:58 -04:00
mount_example.py Internal refactor of MCP handlers (#2005) 2025-10-05 08:45:10 -04:00
screenshot.fastmcp.json Update schema path (#1595) 2025-08-23 09:47:58 -04:00
screenshot.py 2.14 deprecation removals (#2329) 2025-12-01 14:11:00 -05:00
serializer.py Internal refactor of MCP handlers (#2005) 2025-10-05 08:45:10 -04:00
simple_echo.py Remove empty parens 2025-06-04 15:37:55 -04:00
tags_example.py Add support for RouteMap tags, update docs 2025-05-22 21:59:16 -04:00
text_me.py Basic cleanup 2025-04-05 17:39:51 -04:00
tool_result_echo.py Improve ToolResult and structured output documentation (#2349) 2025-11-02 17:07:48 -05:00