mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 21:44:18 +02:00
commit
b622e426ff
1 changed files with 6 additions and 3 deletions
|
|
@ -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": "<your-token>"},
|
||||
transport=StreamableHttpTransport(
|
||||
"https://fastmcp.cloud/mcp",
|
||||
headers={"X-API-Key": "<your-token>"},
|
||||
),
|
||||
) as client:
|
||||
await client.ping()
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue