From 45d031a577057109dbaa60aac1580b37bcaf0cb2 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Wed, 11 Jun 2025 20:20:14 -0400 Subject: [PATCH] Update headers in docs --- docs/clients/auth/bearer.mdx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/clients/auth/bearer.mdx b/docs/clients/auth/bearer.mdx index e194a7fe5..edc41e32d 100644 --- a/docs/clients/auth/bearer.mdx +++ b/docs/clients/auth/bearer.mdx @@ -73,14 +73,17 @@ async with Client( ## Custom Headers -If the MCP server expects a custom header or token scheme, you can manually set the client's `headers` instead of using the `auth` parameter: +If the MCP server expects a custom header or token scheme, you can manually set the client's `headers` instead of using the `auth` parameter by setting them on your transport: ```python {5} from fastmcp import Client +from fastmcp.client.transports import StreamableHttpTransport async with Client( - "https://fastmcp.cloud/mcp", - headers={"X-API-Key": ""}, + transport=StreamableHttpTransport( + "https://fastmcp.cloud/mcp", + headers={"X-API-Key": ""}, + ), ) as client: await client.ping() ```