|
@@ -8,7 +8,12 @@ from starlette.applications import Starlette
|
|
|
from starlette.routing import Mount
|
|
|
from starlette.types import Receive, Scope, Send
|
|
|
|
|
|
-from applications.config import ES_HOSTS, ELASTIC_SEARCH_INDEX, ES_PASSWORD, MILVUS_CONFIG
|
|
|
+from applications.config import (
|
|
|
+ ES_HOSTS,
|
|
|
+ ELASTIC_SEARCH_INDEX,
|
|
|
+ ES_PASSWORD,
|
|
|
+ MILVUS_CONFIG,
|
|
|
+)
|
|
|
from applications.resource import init_resource_manager
|
|
|
from mcp_server.server import create_mcp_server
|
|
|
|
|
@@ -47,7 +52,9 @@ def main(port: int, host: str, json_response: bool) -> int:
|
|
|
)
|
|
|
|
|
|
# 处理Streamable HTTP请求
|
|
|
- async def handle_streamable_http(scope: Scope, receive: Receive, send: Send) -> None:
|
|
|
+ async def handle_streamable_http(
|
|
|
+ scope: Scope, receive: Receive, send: Send
|
|
|
+ ) -> None:
|
|
|
await session_manager.handle_request(scope, receive, send)
|
|
|
|
|
|
# 定义生命周期管理
|
|
@@ -66,6 +73,7 @@ def main(port: int, host: str, json_response: bool) -> int:
|
|
|
|
|
|
# 启动服务器
|
|
|
import uvicorn
|
|
|
+
|
|
|
uvicorn.run(starlette_app, host=host, port=port)
|
|
|
return 0
|
|
|
|