Repoint tests and examples off removed deprecations

Replaces FastMCP.as_proxy() helper calls with create_proxy(), rewrites the
mount() as_proxy=/prefix= kwarg tests to plain mount() (the params are gone),
and deletes deprecation-only tests for as_proxy() and remove_tool().
This commit is contained in:
Jeremiah Lowin 2026-07-06 21:32:54 -04:00
commit 6a6fdcb2bb
No known key found for this signature in database
11 changed files with 39 additions and 176 deletions

View file

@ -3,7 +3,7 @@ This example demonstrates how to set up and use an in-memory FastMCP proxy.
It illustrates the pattern:
1. Create an original FastMCP server with some tools.
2. Create a proxy FastMCP server using ``FastMCP.as_proxy(original_server)``.
2. Create a proxy FastMCP server using ``create_proxy(original_server)``.
3. Use another Client to connect to the proxy server (in-memory) and interact with the original server's tools through the proxy.
"""
@ -13,6 +13,7 @@ from mcp.types import TextContent
from fastmcp import FastMCP
from fastmcp.client import Client
from fastmcp.server import create_proxy
class EchoService:
@ -38,9 +39,9 @@ async def main():
# 2. Proxy Server Creation
print("\nStep 2: Creating the Proxy Server (InMemoryProxy)...")
print(
f" (Using FastMCP.as_proxy to wrap '{original_server.name}' directly)"
f" (Using create_proxy to wrap '{original_server.name}' directly)"
)
proxy_server = FastMCP.as_proxy(original_server, name="InMemoryProxy")
proxy_server = create_proxy(original_server, name="InMemoryProxy")
print(
f" -> Proxy Server '{proxy_server.name}' created, proxying '{original_server.name}'."
)