MCPcopy Create free account
hub / github.com/MiniMax-AI/Mini-Agent / test_git_mcp_loading

Function test_git_mcp_loading

tests/test_mcp.py:360–418  ·  view source on GitHub ↗

Test loading MCP Server from Git repository (minimax_search).

(mcp_config)

Source from the content-addressed store, hash-verified

358
359@pytest.mark.asyncio
360async def test_git_mcp_loading(mcp_config):
361 """Test loading MCP Server from Git repository (minimax_search)."""
362 print("\n" + "=" * 70)
363 print("Testing: Loading MiniMax Search MCP Server from Git repository")
364 print("=" * 70)
365
366 git_url = mcp_config["mcpServers"]["minimax_search"]["args"][1]
367 print(f"\n📍 Git repository: {git_url}")
368 print("⏳ Cloning and installing...\n")
369
370 try:
371 # Load MCP tools
372 tools = await load_mcp_tools_async("mini_agent/config/mcp.json")
373
374 print("\n✅ Loaded successfully!")
375 print("\n📊 Statistics:")
376 print(f" • Total tools loaded: {len(tools)}")
377
378 # Verify tools list is not empty
379 assert isinstance(tools, list), "Should return a list of tools"
380
381 if tools:
382 print("\n🔧 Available tools:")
383 for tool in tools:
384 desc = tool.description[:80] + "..." if len(tool.description) > 80 else tool.description
385 print(f" • {tool.name}")
386 print(f" {desc}")
387
388 # Verify expected tools from minimax_search
389 expected_tools = ["search", "parallel_search", "browse"]
390 loaded_tool_names = [t.name for t in tools]
391
392 print("\n🔍 Function verification:")
393 found_count = 0
394 for expected in expected_tools:
395 if expected in loaded_tool_names:
396 print(f" ✅ {expected} - OK")
397 found_count += 1
398 else:
399 print(f" ❌ {expected} - Missing")
400
401 # If no expected tools found, minimax_search connection failed
402 if found_count == 0:
403 print("\n⚠️ Warning: minimax_search MCP Server connection failed")
404 print("This may be due to SSH key authentication requirements or network issues")
405 pytest.skip("minimax_search MCP Server connection failed, skipping test")
406
407 # Assert all expected tools exist
408 missing_tools = [t for t in expected_tools if t not in loaded_tool_names]
409 assert len(missing_tools) == 0, f"Missing tools: {missing_tools}"
410
411 print("\n" + "=" * 70)
412 print("✅ All tests passed! MCP Server loaded from Git repository successfully!")
413 print("=" * 70)
414
415 finally:
416 # Cleanup MCP connections
417 print("\n🧹 Cleaning up MCP connections...")

Callers

nothing calls this directly

Calls 2

load_mcp_tools_asyncFunction · 0.90
cleanup_mcp_connectionsFunction · 0.90

Tested by

no test coverage detected