mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 13:34:17 +02:00
feat: Move the Starlette context middleware to the front (#1812)
This commit is contained in:
parent
9d17aba5b6
commit
ed0931de8e
1 changed files with 2 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
from collections.abc import AsyncGenerator, Callable, Generator
|
||||
from contextlib import asynccontextmanager, contextmanager
|
||||
from contextvars import ContextVar
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Union
|
||||
|
||||
from mcp.server.auth.middleware.bearer_auth import RequireAuthMiddleware
|
||||
from mcp.server.lowlevel.server import LifespanResultT
|
||||
|
|
@ -113,7 +113,7 @@ def create_base_app(
|
|||
A Starlette application
|
||||
"""
|
||||
# Always add RequestContextMiddleware as the outermost middleware
|
||||
middleware.append(Middleware(RequestContextMiddleware))
|
||||
middleware.insert(0, Middleware(RequestContextMiddleware))
|
||||
|
||||
return StarletteWithLifespan(
|
||||
routes=routes,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue