Check if config file exists and is valid.
(config_file="server_config.json")
| 35 | |
| 36 | |
| 37 | def check_config_file(config_file="server_config.json"): |
| 38 | """Check if config file exists and is valid.""" |
| 39 | print(f"📋 Checking config file: {config_file}") |
| 40 | |
| 41 | if not os.path.exists(config_file): |
| 42 | print(f"❌ Config file not found: {config_file}") |
| 43 | return False, [] |
| 44 | |
| 45 | try: |
| 46 | with open(config_file, "r") as f: |
| 47 | config = json.load(f) |
| 48 | |
| 49 | servers = list(config.get("mcpServers", {}).keys()) |
| 50 | print(f"✅ Config valid, found servers: {servers}") |
| 51 | return True, servers |
| 52 | |
| 53 | except json.JSONDecodeError as e: |
| 54 | print(f"❌ Invalid JSON in config: {e}") |
| 55 | return False, [] |
| 56 | except Exception as e: |
| 57 | print(f"❌ Error reading config: {e}") |
| 58 | return False, [] |
| 59 | |
| 60 | |
| 61 | def test_basic_commands(): |