File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,9 +185,18 @@ async def get_tenant(token: str) -> str:
185185async def utils () -> mcp_utils :
186186 try :
187187 if INMYDATA_USE_OAUTH :
188- # OAuth flow - use bearer token and extract tenant from token
189- headers = get_http_headers (include = {"authorization" })
190- api_key = headers .get ('authorization' , '' ).replace ('Bearer ' , '' )
188+ # OAuth flow - use bearer token and extract tenant from token.
189+ # get_http_headers() strips the authorization header by default; the
190+ # include= kwarg to keep it only exists in fastmcp 3.x, but the pinned
191+ # runtime is 2.12.4. Read the bearer token straight off the request so
192+ # this works regardless of fastmcp version. The non-authorization
193+ # x-inmydata-* headers are not stripped, so get_http_headers() is fine
194+ # for those.
195+ req = get_http_request ()
196+ api_key = (
197+ req .headers .get ('authorization' , '' ) if req is not None else ''
198+ ).replace ('Bearer ' , '' )
199+ headers = get_http_headers ()
191200 tenant = await get_tenant (api_key )
192201 server = headers .get ('x-inmydata-server' , await get_server ())
193202 calendar = headers .get ('x-inmydata-calendar' , 'Default' )
You can’t perform that action at this time.
0 commit comments