#!/usr/bin/env python3
"""
Simple Restart Script for MCP Servers
"""
import subprocess
import time
import sys
def stop_servers():
"""Stop running servers using taskkill."""
print("π Stopping existing servers...")
try:
# Kill Python processes that might be our servers
subprocess.run(['taskkill', '/f', '/im', 'python.exe'],
capture_output=True, text=True)
print("β
Stopped Python processes")
except FileNotFoundError:
print("β οΈ taskkill not available")
# Wait for cleanup
time.sleep(2)
def start_enhanced_harness():
"""Start the enhanced MCP harness."""
print("\nπ Starting Enhanced MCP Harness...")
try:
# Start the enhanced harness in background
subprocess.Popen([sys.executable, 'enhanced_mcp_harness.py'])
print("β
Enhanced MCP Harness started on localhost:8000")
# Wait a moment
time.sleep(3)
# Start the enhanced web interface in background
print("\nπ Starting Enhanced Web Interface...")
subprocess.Popen([sys.executable, 'enhanced_web_interface.py'])
print("β
Enhanced Web Interface started on localhost:3003")
print("\nπ All servers started successfully!")
print("\nπ Available URLs:")
print(" β’ Enhanced Web Interface: http://localhost:3003")
print(" β’ MCP Server: localhost:8000")
print("\nπ‘ You can now:")
print(" β’ Open http://localhost:3003 in your browser")
print(" β’ Test with: py -3 test_client.py")
except Exception as e:
print(f"β Error starting servers: {e}")
def main():
"""Main function."""
print("π Simple MCP Server Restart")
print("=" * 30)
# Stop servers
stop_servers()
# Start enhanced harness
start_enhanced_harness()
print("\nβ
Restart completed!")
if __name__ == "__main__":
main()