New in versionDocumentation Index
Fetch the complete documentation index at: https://fastmcp-transfer-to-prefecthq.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
2.6.0
You can configure your FastMCP client to use bearer authentication by supplying a valid access token. This is most appropriate for service accounts, long-lived API keys, CI/CD, applications where authentication is managed separately, or other non-interactive authentication methods.
A Bearer token is a JSON Web Token (JWT) that is used to authenticate a request. It is most commonly used in the Authorization header of an HTTP request, using the Bearer scheme:
Client Usage
The most straightforward way to use a pre-existing Bearer token is to provide it as a string to theauth parameter of the fastmcp.Client or transport instance. FastMCP will automatically format it correctly for the Authorization header and bearer scheme.
StreamableHttpTransport or SSETransport:
BearerAuth Helper
If you prefer to be more explicit and not rely on FastMCP to transform your string token, you can use the BearerAuth class yourself, which implements the httpx.Auth interface.
Custom Headers
If the MCP server expects a custom header or token scheme, you can manually set the client’sheaders instead of using the auth parameter by setting them on your transport:

