Replace FastMCP.as_proxy() with create_proxy() function (#2829)

This commit is contained in:
Jeremiah Lowin 2026-01-10 11:39:06 -05:00 committed by GitHub
commit 3163e61ee4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 341 additions and 124 deletions

View file

@ -263,11 +263,11 @@ Users on Claude Pro, Max, Team, and Enterprise plans have first-class remote ser
Create a proxy server that connects to a remote HTTP server:
```python proxy_server.py
from fastmcp import FastMCP
from fastmcp.server import create_proxy
# Create a proxy to a remote server
proxy = FastMCP.as_proxy(
"https://example.com/mcp/sse",
proxy = create_proxy(
"https://example.com/mcp/sse",
name="Remote Server Proxy"
)
@ -280,8 +280,9 @@ if __name__ == "__main__":
For authenticated remote servers, create an authenticated client following the guidance in the [client auth documentation](/clients/auth/bearer) and pass it to the proxy:
```python auth_proxy_server.py {7}
from fastmcp import FastMCP, Client
from fastmcp import Client
from fastmcp.client.auth import BearerAuth
from fastmcp.server import create_proxy
# Create authenticated client
client = Client(
@ -290,7 +291,7 @@ client = Client(
)
# Create proxy using the authenticated client
proxy = FastMCP.as_proxy(client, name="Authenticated Proxy")
proxy = create_proxy(client, name="Authenticated Proxy")
if __name__ == "__main__":
proxy.run()