forked from HomeLab/unraid-mcp
feat: harden API safety and expand command docs with full test coverage
This commit is contained in:
@@ -13,6 +13,7 @@ async def shutdown_cleanup() -> None:
|
||||
"""Cleanup resources on server shutdown."""
|
||||
try:
|
||||
from .core.client import close_http_client
|
||||
|
||||
await close_http_client()
|
||||
except Exception as e:
|
||||
print(f"Error during cleanup: {e}")
|
||||
@@ -22,13 +23,17 @@ def main() -> None:
|
||||
"""Main entry point for the Unraid MCP Server."""
|
||||
try:
|
||||
from .server import run_server
|
||||
|
||||
run_server()
|
||||
except KeyboardInterrupt:
|
||||
print("\nServer stopped by user")
|
||||
try:
|
||||
asyncio.run(shutdown_cleanup())
|
||||
except RuntimeError as e:
|
||||
if "event loop is closed" in str(e).lower() or "no running event loop" in str(e).lower():
|
||||
if (
|
||||
"event loop is closed" in str(e).lower()
|
||||
or "no running event loop" in str(e).lower()
|
||||
):
|
||||
pass # Expected during shutdown
|
||||
else:
|
||||
print(f"WARNING: Unexpected error during cleanup: {e}", file=sys.stderr)
|
||||
@@ -37,7 +42,10 @@ def main() -> None:
|
||||
try:
|
||||
asyncio.run(shutdown_cleanup())
|
||||
except RuntimeError as e:
|
||||
if "event loop is closed" in str(e).lower() or "no running event loop" in str(e).lower():
|
||||
if (
|
||||
"event loop is closed" in str(e).lower()
|
||||
or "no running event loop" in str(e).lower()
|
||||
):
|
||||
pass # Expected during shutdown
|
||||
else:
|
||||
print(f"WARNING: Unexpected error during cleanup: {e}", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user