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

Function test_basic_functionality

diagnostics/mcp_cli_diagnostics.py:125–168  ·  view source on GitHub ↗

Test basic MCP CLI functionality.

()

Source from the content-addressed store, hash-verified

123
124
125def test_basic_functionality():
126 """Test basic MCP CLI functionality."""
127 print("\n4. Basic Functionality Test")
128 print("-" * 28)
129
130 # Test help command
131 try:
132 result = subprocess.run(
133 [sys.executable, "-m", "mcp_cli", "--help"],
134 capture_output=True,
135 text=True,
136 timeout=10,
137 )
138 if result.returncode == 0:
139 print(" ✅ mcp-cli --help works")
140 else:
141 print(f" ❌ mcp-cli --help failed: {result.stderr}")
142 return False
143 except Exception as e:
144 print(f" ❌ Cannot run mcp-cli help: {e}")
145 return False
146
147 # Test tools list with a simple server
148 try:
149 env = os.environ.copy()
150 env["MCP_TOOL_TIMEOUT"] = "30"
151
152 result = subprocess.run(
153 [sys.executable, "-m", "mcp_cli", "tools", "list", "--server", "sqlite"],
154 capture_output=True,
155 text=True,
156 timeout=15,
157 env=env,
158 )
159 if result.returncode == 0:
160 print(" ✅ tools list works with sqlite")
161 if "tool" in result.stdout.lower():
162 print(" ✅ Tools are listed correctly")
163 else:
164 print(f" ⚠️ tools list failed: {result.stderr}")
165 except Exception as e:
166 print(f" ⚠️ Cannot test tools list: {e}")
167
168 return True
169
170
171def check_environment_variables():

Callers 1

mainFunction · 0.85

Calls 1

runMethod · 0.80

Tested by

no test coverage detected