Skip to content

MultiAuth breaks EntraOBOToken dependency injection #3605

@npeham

Description

@npeham

What happened?

Follow-up to #3035 (closed). Using EntraOBOToken as a tool dependency fails at runtime when the server is configured with MultiAuth, even if MultiAuth wraps an AzureProvider.

MRE:

from fastmcp import FastMCP
from fastmcp.server.auth.providers.azure import AzureProvider, EntraOBOToken
from fastmcp.server.auth import MultiAuth

azure_provider = AzureProvider(...)  # valid AzureProvider config
server = FastMCP("demo", auth=MultiAuth(azure_provider))

@server.tool()
async def call_graph(token: EntraOBOToken) -> str:
    # calling any tool that injects EntraOBOToken raises at startup/request time
    ...

Actual:

RuntimeError: EntraOBOToken requires an AzureProvider as the auth provider. Current provider: MultiAuth

Expected: EntraOBOToken resolves successfully when MultiAuth wraps an AzureProvider.

The failure is in _EntraOBOToken (fastmcp/server/auth/providers/azure.py), which does a hard isinstance(server.auth, AzureProvider) check that doesn't look through MultiAuth — not obvious from the public API.

Version Information

FastMCP version:                                                               3.1.1
MCP version:                                                                  1.26.0
Python version:                                                               3.14.3
Platform:                                          macOS-26.2-arm64-arm-64bit-Mach-O
FastMCP root path: /Users/npeham/.pyenv/versions/3.14.3/lib/python3.14/site-packages

Metadata

Metadata

Assignees

No one assigned

    Labels

    authRelated to authentication (Bearer, JWT, OAuth, WorkOS) for client or server.bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.serverRelated to FastMCP server implementation or server-side functionality.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions