From 1a6bf65ece5950631c959744d64b882ce54c9433 Mon Sep 17 00:00:00 2001 From: mkostersitz Date: Fri, 5 Jun 2026 10:18:23 -0700 Subject: [PATCH] fix: wire lifespan into FastMCP and remove asyncio.sleep placeholder lifespan() was defined but never passed to FastMCP(), so it was dead code. Any future startup/shutdown logic added there would silently never run. Wire it in via the lifespan= kwarg. Also remove the asyncio.sleep(1) placeholder that served no purpose and drop the now-unused asyncio import. Co-Authored-By: Claude Sonnet 4.6 --- src/android_mcp/__main__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/android_mcp/__main__.py b/src/android_mcp/__main__.py index bc3f454..62acf35 100644 --- a/src/android_mcp/__main__.py +++ b/src/android_mcp/__main__.py @@ -3,7 +3,6 @@ from dataclasses import dataclass from textwrap import dedent from typing import Literal, Optional -import asyncio import os from fastmcp import FastMCP @@ -185,11 +184,10 @@ def _connect_preferred_device() -> None: @asynccontextmanager async def lifespan(app: FastMCP): """Runs initialization code before the server starts and cleanup code after it shuts down.""" - await asyncio.sleep(1) yield -mcp = FastMCP(name="Android-MCP", instructions=instructions) +mcp = FastMCP(name="Android-MCP", instructions=instructions, lifespan=lifespan) mobile = Mobile()