Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Fix documentation: use StreamableHttpTransport for headers in testing (#1702)

Jeremiah Lowinbe17a18420a6
diff --git a/docs/deployment/testing.mdx b/docs/deployment/testing.mdx
index f5db67b58..a7bb63a57 100644
--- a/docs/deployment/testing.mdx
+++ b/docs/deployment/testing.mdx
@@ -133,11 +133,15 @@ async def test_deployed_server():
The FastMCP Client handles authentication transparently, making it easy to test secured servers:
```python
+from fastmcp.client.transports import StreamableHttpTransport
+
async def test_authenticated_server():
# Bearer token authentication
async with Client(
- "https://api.example.com/mcp",
- headers={"Authorization": "Bearer test-token"}
+ StreamableHttpTransport(
+ "https://api.example.com/mcp",
+ headers={"Authorization": "Bearer test-token"}
+ )
) as client:
await client.ping()
tools = await client.list_tools()