BREAKING CHANGES: - Package renamed from mcp-arduino-server to mcp-arduino - Command changed to 'mcp-arduino' (was 'mcp-arduino-server') - Repository moved to git.supported.systems/MCP/mcp-arduino NEW FEATURES: ✨ Smart client capability detection and dual-mode sampling support ✨ Intelligent WireViz templates with component-specific circuits (LED, motor, sensor, button, display) ✨ Client debug tools for MCP capability inspection ✨ Enhanced error handling with progressive enhancement patterns IMPROVEMENTS: 🧹 Major repository cleanup - removed 14+ experimental files and tests 📝 Consolidated and reorganized documentation 🐛 Fixed import issues and applied comprehensive linting with ruff 📦 Updated author information to Ryan Malloy (ryan@supported.systems) 🔧 Fixed package version references in startup code TECHNICAL DETAILS: - Added dual-mode WireViz: AI generation for sampling clients, smart templates for others - Implemented client capability detection via MCP handshake inspection - Created progressive enhancement pattern for universal MCP client compatibility - Organized test files into proper structure (tests/examples/) - Applied comprehensive code formatting and lint fixes The server now provides excellent functionality for ALL MCP clients regardless of their sampling capabilities, while preserving advanced features for clients that support them. Version: 2025.09.27.1
66 lines
1.6 KiB
Python
66 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Development server with hot-reloading for MCP Arduino Server
|
|
"""
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
|
|
from watchdog.events import FileSystemEventHandler
|
|
from watchdog.observers import Observer
|
|
|
|
|
|
class ReloadHandler(FileSystemEventHandler):
|
|
def __init__(self):
|
|
self.process = None
|
|
self.start_server()
|
|
|
|
def start_server(self):
|
|
"""Start the MCP Arduino server"""
|
|
if self.process:
|
|
print("🔄 Restarting server...")
|
|
self.process.terminate()
|
|
self.process.wait()
|
|
else:
|
|
print("🚀 Starting MCP Arduino Server in development mode...")
|
|
|
|
env = os.environ.copy()
|
|
env['LOG_LEVEL'] = 'DEBUG'
|
|
|
|
self.process = subprocess.Popen(
|
|
[sys.executable, "-m", "mcp_arduino_server.server"],
|
|
env=env,
|
|
cwd=Path(__file__).parent.parent
|
|
)
|
|
|
|
def on_modified(self, event):
|
|
if event.src_path.endswith('.py'):
|
|
print(f"📝 Detected change in {event.src_path}")
|
|
self.start_server()
|
|
|
|
def main():
|
|
handler = ReloadHandler()
|
|
observer = Observer()
|
|
|
|
# Watch the source directory
|
|
src_path = Path(__file__).parent.parent / "src"
|
|
observer.schedule(handler, str(src_path), recursive=True)
|
|
observer.start()
|
|
|
|
print(f"👁️ Watching {src_path} for changes...")
|
|
print("Press Ctrl+C to stop")
|
|
|
|
try:
|
|
while True:
|
|
time.sleep(1)
|
|
except KeyboardInterrupt:
|
|
observer.stop()
|
|
if handler.process:
|
|
handler.process.terminate()
|
|
observer.join()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|