simple_restart.pyโข2.07 kB
#!/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()