-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
77 lines (65 loc) · 2.18 KB
/
install.py
File metadata and controls
77 lines (65 loc) · 2.18 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
"""Control Tower Lite — One-command MCP server registration.
Usage:
python install.py # Install for current user
python install.py --global # Install globally
python install.py --remove # Remove registration
"""
import json
import os
import sys
from pathlib import Path
MCP_SERVER_NAME = "control-tower-lite"
CLAUDE_CONFIG = Path.home() / ".claude.json"
SCRIPT_DIR = Path(__file__).parent.resolve()
def get_config():
"""Read existing claude.json or return empty structure."""
if CLAUDE_CONFIG.exists():
try:
return json.loads(CLAUDE_CONFIG.read_text())
except json.JSONDecodeError:
return {}
return {}
def save_config(config):
"""Write claude.json."""
CLAUDE_CONFIG.write_text(json.dumps(config, indent=2))
def install(global_install=False):
"""Register the MCP server in claude.json."""
config = get_config()
if "mcpServers" not in config:
config["mcpServers"] = {}
python_path = sys.executable
server_path = str(SCRIPT_DIR / "mcp_server.py")
config["mcpServers"][MCP_SERVER_NAME] = {
"command": python_path,
"args": [server_path],
"env": {}
}
save_config(config)
print(f"✓ Registered '{MCP_SERVER_NAME}' in {CLAUDE_CONFIG}")
print(f" Python: {python_path}")
print(f" Server: {server_path}")
print()
print("Next steps:")
print(" 1. Start the broker: python launch.py")
print(" 2. Open Claude Code in a new terminal")
print(" 3. Use the 'join' tool to register as architect or worker")
def remove():
"""Remove MCP server registration."""
config = get_config()
if "mcpServers" in config and MCP_SERVER_NAME in config["mcpServers"]:
del config["mcpServers"][MCP_SERVER_NAME]
save_config(config)
print(f"✓ Removed '{MCP_SERVER_NAME}' from {CLAUDE_CONFIG}")
else:
print(f"'{MCP_SERVER_NAME}' not found in {CLAUDE_CONFIG}")
def main():
args = sys.argv[1:]
if "--remove" in args:
remove()
elif "--help" in args or "-h" in args:
print(__doc__)
else:
install(global_install="--global" in args)
if __name__ == "__main__":
main()