Commit graph

20 commits

Author SHA1 Message Date
Jeremiah Lowin
3163e61ee4
Replace FastMCP.as_proxy() with create_proxy() function (#2829) 2026-01-10 11:39:06 -05:00
Jeremiah Lowin
1ed1032ca5
Fix Proxy provider to return all resource contents (#2742) 2025-12-25 22:33:45 -05:00
Jeremiah Lowin
648684d2bb
Introduce ResourceResult as canonical resource return type (#2734) 2025-12-25 21:21:55 -05:00
Jeremiah Lowin
125f79ff39
Consolidate get_* and _list_* methods into single API (#2719) 2025-12-24 22:26:52 -05:00
Jeremiah Lowin
7a1796fbdf
Add VisibilityFilter for hierarchical enable/disable (#2708) 2025-12-24 14:43:41 -05:00
Jeremiah Lowin
748d25eede
Refactor FastMCPProxy into ProxyProvider (#2669)
* Refactor FastMCPProxy into ProxyProvider

Move proxy functionality from custom manager classes to the Provider pattern:

- Create ProxyProvider that implements the Provider interface
- Move all proxy code to src/fastmcp/server/providers/proxy.py
- Keep FastMCPProxy as a convenience wrapper using ProxyProvider
- Add deprecation warning when importing from old location
- Convert handler classmethods to module-level functions
- Remove redundant get_* methods (base class defaults work)

* Remove unused Components class, simplify TaskComponents()
2025-12-21 21:30:03 -05:00
Jeremiah Lowin
049bd22827
Replace type: ignore[attr-defined] with isinstance assertions in tests (#2665)
* Replace type: ignore[attr-defined] with isinstance assertions in tests

* Fix isinstance assertions in failing tests

- Fix enum test to check for ResponseEnum instead of str
- Fix binary resource test to check for BlobResourceContents instead of TextResourceContents
- Fix Root type tests to check attributes directly instead of isinstance checks

* Fix type errors without using type: ignore

- Remove execution methods from TransformingProvider (only handles transformations)
- Add execution methods to base Provider class with default implementations
- Fix type narrowing in tests using cast() instead of type: ignore
- Fix PromptResult type handling in prompt render tests
- Fix type narrowing in middleware test for arguments and structured_content
2025-12-21 16:37:20 -05:00
Dusty Herrman
95fb8b4894
Fix proxy tool result meta attribute forwarding (#2526)
Proxied tool results now properly forward the meta attribute from upstream servers through ProxyToolManager and ProxyTool.

Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-12-09 13:58:38 -05:00
Jeremiah Lowin
07750efaab
Fix type errors for ty 0.0.1-alpha.31 upgrade (#2561)
* Fix type errors for ty 0.0.1-alpha.31 upgrade

Add type ignores and fixes for ty's stricter checking:
- Path(None) guards in cli.py
- isinstance checks for ElicitRequestFormParams (URL elicitation support)
- TODO(ty) comments for match/isinstance narrowing bugs
- Method override type ignores for generic covariance
- Starlette Middleware typing workarounds
- Dynamic type construction ignores in json_schema_type.py

* Fix remaining type errors for ty 0.0.1-alpha.31

- Add asserts for optional attribute access in tests
- Add type ignores for dynamic httpx transport internals
- Add TODO(ty) comments for `in` operator on str|bytes
- Add TODO(ty) comments for Starlette Middleware typing
- Use cast for prompt.fn async validation in server.py

* Upgrade ty to 0.0.1-alpha.31

Fixes additional test file type errors discovered after upgrade.
2025-12-05 21:29:14 -05:00
Jeremiah Lowin
3341c0c893
Add icons support to proxy classes (#2502) 2025-12-01 08:55:51 -05:00
Muspi Merol
adbb7d6e53
Add title attribute to ProxyTool, ProxyResource, … (#2497)
* fix: add title attribute to ProxyTool, ProxyResource, ProxyTemplate, and ProxyPrompt

* test: add title assertions for proxy tools, resources, and prompts
2025-12-01 08:48:42 -05:00
Jeremiah Lowin
91af3cd2ae
Internal refactor of MCP handlers (#2005) 2025-10-05 08:45:10 -04:00
William Easton
185bb47713
Updates to tests 2025-08-24 10:59:01 -05:00
marvin-context-protocol[bot]
9822024424 feat: improve debugging for nested servers with server/client names and hierarchy visualization
- Add random ID generation for unnamed FastMCP servers (FastMCP-xxxxxx format)
- Add name field to Client class with random ID support
- Update all server/client logging to include server/client names in brackets
- Add generate_hierarchy_diagram() method to visualize server/proxy/client relationships
- Handle proxy classes automatically through inheritance
- Update tests to accommodate new random naming behavior

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: William Easton <strawgate@users.noreply.github.com>
2025-08-24 01:09:43 +00:00
bianning
78e9bab244
Add async support to client_factory in FastMCPProxy (#1286) (#1375)
Co-authored-by: bianning <bianning@vv.cn>
2025-08-06 13:11:48 -04:00
Jeremiah Lowin
0691701951
Add _fastmcp meta namespace (#1290) 2025-07-29 15:07:53 -04:00
Jeremiah Lowin
0adb317361
Ensure proxy components forward meta dicts (#1282) 2025-07-29 10:34:41 -04:00
William Easton
1b953820b3
[🐶] Transform MCP Server Tools (#1132)
Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-07-19 15:52:47 -04:00
Jeremiah Lowin
f25bef7e21 Add mirrored component support for proxy servers
Prevents enable/disable operations on mirrored components (tools, resources, prompts retrieved from proxy servers). Users must create local copies with .copy() and add them to their server to modify them. Local components take precedence over mirrored ones.

Closes #1102

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 17:54:40 -04:00
Jeremiah Lowin
c452164e86
Fix concurrent proxy client operations with session isolation (#1083)
* Refactor Client session state with ClientSessionState dataclass

Fixes #1068 by introducing ClientSessionState to encapsulate session management
attributes, simplifying Client.new() and preventing concurrent proxy client
context mixing through client factory pattern.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update proxy documentation for new client factory pattern

Documents the new session management behavior, client_factory parameter,
and concurrent operation safety introduced in v2.10.3 to fix #1068.

* Remove deprecation of client parameter and update documentation

- Undeprecated FastMCPProxy client parameter
- Made client_factory the advanced option for custom control
- Added detailed explanation of how client factories work internally
- Removed outdated note about proxy feature limitations
- Removed fabricated Advanced Usage section

* Re-do proxy documentation

* Fix deprecated client parameter to provide session isolation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-08 17:22:43 -04:00
Renamed from tests/server/test_proxy.py (Browse further)