Jeremiah Lowin commited on
Commit
3b0bb58
·
unverified ·
2 Parent(s): 995d9e906ebcb9

Merge pull request #809 from jlowin/welcome

Browse files
Files changed (1) hide show
  1. docs/clients/auth/bearer.mdx +6 -3
docs/clients/auth/bearer.mdx CHANGED
@@ -73,14 +73,17 @@ async with Client(
73
 
74
  ## Custom Headers
75
 
76
- 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:
77
 
78
  ```python {5}
79
  from fastmcp import Client
 
80
 
81
  async with Client(
82
- "https://fastmcp.cloud/mcp",
83
- headers={"X-API-Key": "<your-token>"},
 
 
84
  ) as client:
85
  await client.ping()
86
  ```
 
73
 
74
  ## Custom Headers
75
 
76
+ 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:
77
 
78
  ```python {5}
79
  from fastmcp import Client
80
+ from fastmcp.client.transports import StreamableHttpTransport
81
 
82
  async with Client(
83
+ transport=StreamableHttpTransport(
84
+ "https://fastmcp.cloud/mcp",
85
+ headers={"X-API-Key": "<your-token>"},
86
+ ),
87
  ) as client:
88
  await client.ping()
89
  ```