mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-23 05:54:19 +02:00
Docs: add example of more concise way to use bearer auth (#1055)
This commit is contained in:
parent
f9a698dcf9
commit
fe1eddc252
1 changed files with 13 additions and 1 deletions
|
|
@ -88,6 +88,18 @@ transport = StreamableHttpTransport(
|
|||
client = Client(transport)
|
||||
```
|
||||
|
||||
This can be written more concisely using the `BearerAuth` helper function:
|
||||
|
||||
```python
|
||||
from fastmcp import Client
|
||||
from fastmcp.client.auth import BearerAuth
|
||||
|
||||
client = Client(
|
||||
"https://example.com/mcp",
|
||||
auth=BearerAuth("your-token-here"),
|
||||
)
|
||||
```
|
||||
|
||||
### SSE (Server-Sent Events)
|
||||
|
||||
<VersionBadge version="2.0.0" />
|
||||
|
|
@ -434,4 +446,4 @@ If your configuration has only a single server, the client will connect directly
|
|||
|
||||
<Note>
|
||||
The MCPConfig format is an emerging standard for MCP server configuration and may change as the MCP ecosystem evolves. While FastMCP aims to maintain compatibility with future versions, be aware that field names or structure might change.
|
||||
</Note>
|
||||
</Note>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue