Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mcp/blob/main/tools/register_merge.py # omega-mcp aien-dev/omega-mcp Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mcp / tools / register_merge.py` 62 lines ยท 2321 bytes Raw Blame History 1 #!/usr/bin/env python3 2 """Write an MCP client file that names the two agent servers. 3 4 The current file, when given, must be a JSON object. mcpServers.agent-maintenance and 5 mcpServers.agent-qa are set to the stdio entries for this prefix. Every other key is left 6 as it was. The result is written only to --out, which the caller stages outside the lock. 7 Prints `unchanged` when --out would match the current bytes, otherwise `changed`. 8 Exit 2 when the current file is not a JSON object or mcpServers is not an object. 9 """ 10 import argparse, json, os, sys 11 12 13 def load(path): 14 if path is None: 15 return {} 16 with open(path, "r", encoding="utf-8") as f: 17 data = json.load(f) 18 if not isinstance(data, dict): 19 raise SystemExit(f"register_merge: {path} is not a JSON object") 20 return data 21 22 23 def main(): 24 ap = argparse.ArgumentParser() 25 ap.add_argument("--current") 26 ap.add_argument("--out", required=True) 27 ap.add_argument("--root", required=True) 28 ap.add_argument("--prefix", required=True) 29 ap.add_argument("--store", required=True) 30 ap.add_argument("--consent", required=True) 31 ap.add_argument("--agent", required=True) 32 a = ap.parse_args() 33 for p in (a.root, a.prefix, a.store, a.consent): 34 if not p.startswith("/"): 35 raise SystemExit(f"register_merge: {p} is not absolute") 36 data = load(a.current) 37 servers = data.get("mcpServers", {}) 38 if not isinstance(servers, dict): 39 raise SystemExit("register_merge: mcpServers is not a JSON object") 40 servers["agent-maintenance"] = { 41 "type": "stdio", 42 "command": os.path.join(a.prefix, "agent-maintenance-mcp"), 43 "args": ["--root", a.root], 44 } 45 servers["agent-qa"] = { 46 "type": "stdio", 47 "command": os.path.join(a.prefix, "agent-qa-mcp"), 48 "args": ["--store", a.store, "--agent", a.agent, "--consent", a.consent], 49 } 50 data["mcpServers"] = servers 51 raw = json.dumps(data, indent=2) + "\n" 52 current = "" 53 if a.current is not None and os.path.exists(a.current): 54 with open(a.current, "r", encoding="utf-8") as f: 55 current = f.read() 56 with open(a.out, "w", encoding="utf-8") as f: 57 f.write(raw) 58 print("unchanged" if raw == current else "changed") 59 60 61 if __name__ == "__main__": 62 sys.exit(main())