Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Henri Bonamy commited on
Commit ·
b6c2de6
1
Parent(s): 0c21cf1
removed test
Browse files- test_mcp_connection.py +0 -45
test_mcp_connection.py
DELETED
|
@@ -1,45 +0,0 @@
|
|
| 1 |
-
"""Test script to check MCP server connection"""
|
| 2 |
-
import asyncio
|
| 3 |
-
from pathlib import Path
|
| 4 |
-
from agent.config import load_config
|
| 5 |
-
from agent.core.tools import ToolRouter
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
async def test_mcp():
|
| 9 |
-
print("Loading config...")
|
| 10 |
-
config_path = Path(__file__).parent / "configs" / "main_agent_config.json"
|
| 11 |
-
config = load_config(config_path)
|
| 12 |
-
|
| 13 |
-
print(f"MCP Servers configured: {list(config.mcpServers.keys())}")
|
| 14 |
-
print(f"\nInitializing ToolRouter...")
|
| 15 |
-
|
| 16 |
-
tool_router = ToolRouter(config.mcpServers)
|
| 17 |
-
|
| 18 |
-
print("Entering async context (this will init MCP servers)...")
|
| 19 |
-
try:
|
| 20 |
-
async with tool_router as router:
|
| 21 |
-
print("✓ MCP initialization successful!")
|
| 22 |
-
tools = router.get_tool_specs_for_llm()
|
| 23 |
-
print(f"\nTotal tools available: {len(tools)}")
|
| 24 |
-
|
| 25 |
-
builtin = [t for t in tools if t['function']['name'] in ['hf_jobs', 'hf_private_repos', 'hf_doc_search', 'plan_tool']]
|
| 26 |
-
mcp = [t for t in tools if t not in builtin]
|
| 27 |
-
|
| 28 |
-
print(f"Built-in tools: {len(builtin)}")
|
| 29 |
-
for tool in builtin:
|
| 30 |
-
print(f" - {tool['function']['name']}")
|
| 31 |
-
|
| 32 |
-
print(f"\nMCP tools: {len(mcp)}")
|
| 33 |
-
for tool in mcp[:5]: # Show first 5
|
| 34 |
-
print(f" - {tool['function']['name']}")
|
| 35 |
-
if len(mcp) > 5:
|
| 36 |
-
print(f" ... and {len(mcp) - 5} more")
|
| 37 |
-
|
| 38 |
-
except Exception as e:
|
| 39 |
-
print(f"✗ Error during MCP initialization: {e}")
|
| 40 |
-
import traceback
|
| 41 |
-
traceback.print_exc()
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
if __name__ == "__main__":
|
| 45 |
-
asyncio.run(test_mcp())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|