@@ -164,6 +164,16 @@ async def on_rerank(
164164 return await endpoint_registry .execute_rerank (body , request )
165165
166166
167+ @router .get ("/custom" )
168+ async def get_custom_prefixes (
169+ request : Request , # noqa: ARG001
170+ _ : Annotated [str , Depends (auth_server )],
171+ endpoint_registry : Annotated [EndpointRegistry , Depends (get_endpoint_registry )],
172+ ) -> list [str ]:
173+ """Process custom endpoint request."""
174+ return [model .props .prefix for model in endpoint_registry .custom_endpoints .list_models () if model .props .prefix ]
175+
176+
167177# Replacement from router.api_route which is kind bugged in swagger.
168178# Also FastAPI creators doesn't recommend using api_route method.
169179@router .get ("/custom/{full_path:path}" )
@@ -183,6 +193,16 @@ async def on_custom_endpoint(
183193 return await endpoint_registry .execute_custom_endpoints (full_path , request )
184194
185195
196+ @router .get ("/mcp" )
197+ async def get_mcp_prefixes (
198+ request : Request , # noqa: ARG001
199+ _ : Annotated [str , Depends (auth_server )],
200+ endpoint_registry : Annotated [EndpointRegistry , Depends (get_endpoint_registry )],
201+ ) -> list [str ]:
202+ """Process custom endpoint request."""
203+ return [model .props .prefix for model in endpoint_registry .mcp_endpoints .list_models () if model .props .prefix ]
204+
205+
186206# Replacement from router.api_route which is kind bugged in swagger.
187207# Also FastAPI creators doesn't recommend using api_route method.
188208@router .get ("/mcp/{full_path:path}" )
0 commit comments