-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_server.py
More file actions
executable file
·33 lines (26 loc) · 841 Bytes
/
run_server.py
File metadata and controls
executable file
·33 lines (26 loc) · 841 Bytes
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
#!/usr/bin/env python3
"""Run coordination-mcp in SSE mode on configurable host/port (defaults to Tailscale IP).
Host selection priority:
1) MCP_HOST env
2) first IPv4 from `tailscale ip -4`
3) 127.0.0.1 fallback
"""
import os
import sys
import subprocess
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parent
os.chdir(REPO_ROOT)
sys.path.insert(0, str(REPO_ROOT))
def get_tailscale_ip():
try:
out = subprocess.check_output(["tailscale", "ip", "-4"], text=True)
ip = out.strip().splitlines()[0]
return ip or None
except Exception:
return None
host = os.environ.get("MCP_HOST") or get_tailscale_ip() or "127.0.0.1"
port = int(os.environ.get("MCP_PORT", "8321"))
from coordination_mcp.server import app
if __name__ == "__main__":
app.run(transport="sse", host=host, port=port)