feat: reintegrate MCP server with proper session manager lifecycle, nginx /mcp proxy, docker.sock mount

This commit is contained in:
Agent Zero
2026-07-13 03:42:13 +02:00
parent 1221350ed6
commit 6483453437
4 changed files with 21 additions and 14 deletions
+7
View File
@@ -11,6 +11,7 @@ from app.cache import cache
from app.routers import equipment, health, admin, rental_requests, contact
from app.services.sync_service import SyncService
from app.services.email_service import EmailService
from app.mcp_server import get_mcp_app, mcp_session_manager
logger = logging.getLogger(__name__)
settings = get_settings()
@@ -41,6 +42,9 @@ async def lifespan(app: FastAPI):
await init_db()
await cache.connect()
_mcp_cm = mcp_session_manager.run()
await _mcp_cm.__aenter__()
scheduler.add_job(run_equipment_sync, trigger="cron", hour="*/6", id="equipment_sync", replace_existing=True)
scheduler.add_job(run_email_retry, trigger="cron", minute="*/15", id="email_retry", replace_existing=True)
scheduler.start()
@@ -49,6 +53,7 @@ async def lifespan(app: FastAPI):
yield
scheduler.shutdown(wait=False)
await _mcp_cm.__aexit__(None, None, None)
await cache.disconnect()
await engine.dispose()
@@ -63,3 +68,5 @@ app.include_router(health.router)
app.include_router(admin.router)
app.include_router(rental_requests.router)
app.include_router(contact.router)
app.mount("/mcp", get_mcp_app())