MCPcopy Create free account
hub / github.com/IBM/mcp-cli / check_config_file

Function check_config_file

diagnostics/cli_command_diagnostic.py:37–58  ·  view source on GitHub ↗

Check if config file exists and is valid.

(config_file="server_config.json")

Source from the content-addressed store, hash-verified

35
36
37def 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
61def test_basic_commands():

Callers 1

test_server_commandsFunction · 0.85

Calls 2

loadMethod · 0.45
getMethod · 0.45

Tested by 1

test_server_commandsFunction · 0.68