mirror of
https://github.com/jmagar/unraid-mcp.git
synced 2026-03-01 16:04:24 -08:00
Refactor the entire tool layer to use the consolidated action pattern (action: Literal[...] with QUERIES/MUTATIONS dicts). This reduces LLM context from ~12k to ~5k tokens while adding ~60 new API capabilities. New tools: unraid_info (19 actions), unraid_array (12), unraid_notifications (9), unraid_users (8), unraid_keys (5). Rewritten: unraid_docker (15), unraid_vm (9), unraid_storage (6), unraid_rclone (4), unraid_health (3). Includes 129 tests across 10 test files, code review fixes for 16 issues (severity ordering, PrefixedID regex, sensitive var redaction, etc.). Removes tools/system.py (replaced by tools/info.py). Version bumped to 0.2.0.
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Unraid MCP Server - Entry Point.
|
|
|
|
This is the main entry point for the Unraid MCP Server. It imports and starts
|
|
the modular server implementation from unraid_mcp.server.
|
|
"""
|
|
|
|
import asyncio
|
|
|
|
|
|
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}")
|
|
|
|
|
|
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:
|
|
# Event loop already closed, skip cleanup
|
|
pass
|
|
except Exception as e:
|
|
print(f"Server failed to start: {e}")
|
|
try:
|
|
asyncio.run(shutdown_cleanup())
|
|
except RuntimeError:
|
|
# Event loop already closed, skip cleanup
|
|
pass
|
|
raise
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|