Fix invalid async context manager usage in proxy documentation (#1246)

This commit is contained in:
nate nowack 2025-07-23 16:37:57 -05:00 committed by GitHub
commit d19166d4bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -261,18 +261,17 @@ my_server = FastMCP("MyServer")
# Get a proxy server
proxy = FastMCP.as_proxy("backend_server.py")
# Add mirrored components to your server
async with proxy:
mirrored_tool = await proxy.get_tool("useful_tool")
# Create a local copy that you can modify
local_tool = mirrored_tool.copy()
# Add the local copy to your server
my_server.add_tool(local_tool)
# Now you can disable YOUR copy
local_tool.disable()
# Get mirrored components from proxy
mirrored_tool = await proxy.get_tool("useful_tool")
# Create a local copy that you can modify
local_tool = mirrored_tool.copy()
# Add the local copy to your server
my_server.add_tool(local_tool)
# Now you can disable YOUR copy
local_tool.disable()
```