launch_mcp.pyā¢3.67 kB
#!/usr/bin/env python3
"""
MCP System Launcher - Quick start for your MCP ecosystem
"""
import asyncio
import sys
import os
import subprocess
import webbrowser
import time
import requests
from pathlib import Path
def quick_start():
"""Quick start the entire MCP system."""
print("š MCP SYSTEM QUICK LAUNCHER")
print("=" * 50)
print("šÆ Starting your complete MCP ecosystem...")
print("")
# Start server
print("1ļøā£ Starting MCP Server...")
server_process = None
try:
if Path("start_mcp_server.py").exists():
server_process = subprocess.Popen(
[sys.executable, "start_mcp_server.py"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
elif Path("enhanced_mcp_server.py").exists():
server_process = subprocess.Popen(
[sys.executable, "enhanced_mcp_server.py"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
else:
print("ā MCP Server not found!")
return
print(" ā³ Waiting for server to start...")
time.sleep(5)
# Check if server is running
try:
response = requests.get("http://localhost:8000/api/health", timeout=5)
if response.status_code == 200:
print(" ā
MCP Server running!")
else:
print(" ā ļø Server started but not fully ready")
except:
print(" ā ļø Server starting (may take a moment)")
# Open web interfaces
print("\n2ļøā£ Opening Web Interfaces...")
# Main server interface
try:
webbrowser.open("http://localhost:8000")
print(" ā
Main Interface: http://localhost:8000")
except:
print(" ā ļø Could not open main interface")
# Client interface
client_path = Path("mcp_client/web_client.html")
if client_path.exists():
try:
client_url = f"file:///{client_path.absolute()}"
webbrowser.open(client_url)
print(" ā
Client Interface opened")
except:
print(" ā ļø Could not open client interface")
print("\n3ļøā£ System Ready!")
print("=" * 50)
print("š Web Interfaces:")
print(" ⢠Main Server: http://localhost:8000")
print(" ⢠API Docs: http://localhost:8000/docs")
print(" ⢠Client Interface: mcp_client/web_client.html")
print("")
print("š» Command Line:")
print(" ⢠CLI Client: python mcp_client/cli_client.py")
print(" ⢠Interactive: python start_mcp_client.py")
print(" ⢠Test System: python test_mcp_system.py")
print("")
print("š Agents:")
print(" ⢠Drop agents in: agents/custom/")
print(" ⢠Templates in: agents/templates/")
print("")
print("š Press Ctrl+C to stop the server")
print("=" * 50)
# Keep running
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
print("\n\nš Stopping MCP Server...")
if server_process:
server_process.terminate()
server_process.wait()
print("ā
MCP System stopped")
except Exception as e:
print(f"ā Error: {e}")
if server_process:
server_process.terminate()
if __name__ == "__main__":
quick_start()