forked from excelsier/things-fastmcp
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy paththings_fast_server.py
More file actions
42 lines (35 loc) · 1.08 KB
/
Copy paththings_fast_server.py
File metadata and controls
42 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
"""
Main entry point for running the Things MCP server.
This version uses the modern FastMCP pattern for better maintainability.
"""
import logging
import sys
from rich.console import Console
from rich.logging import RichHandler
from src.things_mcp.fast_server import run_things_mcp_server
from src.things_mcp.shutdown import setup_interrupt_handler
# Configure rich logging
console = Console()
logging.basicConfig(
level=logging.INFO,
format="%(message)s",
datefmt="[%X]",
handlers=[RichHandler(console=console, rich_tracebacks=True)],
)
logger = logging.getLogger("things_fast_server")
# Exit immediately on Ctrl+C even if connections remain
setup_interrupt_handler(logger)
def main():
"""Main entry point for the Things FastMCP Server"""
logger.info("Starting Things FastMCP Server")
try:
run_things_mcp_server()
except KeyboardInterrupt:
logger.info("Server stopped by user")
sys.exit(0)
except Exception:
logger.exception("Error running server")
sys.exit(1)
if __name__ == "__main__":
main()