Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mcp-use.com/llms.txt

Use this file to discover all available pages before exploring further.

Authentication middleware for mcp-use server.

AuthMiddleware

from mcp_use.server.auth.middleware import AuthMiddleware

method init

Initialize auth middleware.Parameters
app
ASGIApp
required
The ASGI application
auth_provider
BearerAuthProvider
required
Provider to validate tokens
exclude_paths
list[str] | None
default:"None"
Paths to exclude from authentication
protected_paths
list[str] | None
default:"None"
Paths that require authentication (default: /mcp)
Signature
def __init__(app: ASGIApp, auth_provider: BearerAuthProvider, exclude_paths: list[str] | None = None, protected_paths: list[str] | None = None):