-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest_dashboard_sdk.py
More file actions
executable file
·71 lines (59 loc) · 2.21 KB
/
test_dashboard_sdk.py
File metadata and controls
executable file
·71 lines (59 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python3
"""
Test script for MCP Dashboard with SDK improvements
This script starts the MCP dashboard and opens it in a browser to demonstrate
the JavaScript SDK integration.
"""
import os
import sys
import time
import webbrowser
from threading import Thread
# Add parent directory to path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def start_dashboard():
"""Start the MCP dashboard server."""
try:
from ipfs_accelerate_py.mcp_dashboard import MCPDashboard
print("🚀 Starting MCP Dashboard with SDK Integration...")
print("=" * 60)
# Create dashboard instance with unified registry
dashboard = MCPDashboard(
port=8899,
host='127.0.0.1',
use_unified_registry=True
)
print("✅ Dashboard initialized")
print("📍 URL: http://127.0.0.1:8899")
print("🎮 SDK Playground: http://127.0.0.1:8899 (click 'SDK Playground' tab)")
print("🔧 MCP Tools: http://127.0.0.1:8899 (click 'MCP Tools' tab)")
print()
print("Features to test:")
print(" 1. SDK Playground - Interactive SDK examples")
print(" 2. SDK Statistics - Real-time call tracking")
print(" 3. Tool Execution - All tools use SDK")
print(" 4. Batch Operations - Parallel execution demo")
print()
print("Press Ctrl+C to stop the server")
print("=" * 60)
# Open browser after a delay
def open_browser():
time.sleep(2)
webbrowser.open('http://127.0.0.1:8899')
Thread(target=open_browser, daemon=True).start()
# Start the dashboard
dashboard.run()
except ImportError as e:
print(f"❌ Error: Failed to import dashboard: {e}")
print("Make sure Flask and Flask-CORS are installed:")
print(" pip install flask flask-cors")
sys.exit(1)
except Exception as e:
print(f"❌ Error starting dashboard: {e}")
sys.exit(1)
if __name__ == '__main__':
try:
start_dashboard()
except KeyboardInterrupt:
print("\n\n👋 Dashboard stopped")
sys.exit(0)