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
65 lines
1.7 KiB
Python
65 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script for Serial Monitor functionality
|
|
Tests connection, reading, and cursor-based pagination
|
|
"""
|
|
|
|
import asyncio
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Add src to path for imports
|
|
sys.path.insert(0, str(Path(__file__).parent / "src"))
|
|
|
|
from fastmcp import Context
|
|
|
|
from mcp_arduino_server.components.serial_monitor import (
|
|
SerialListPortsParams,
|
|
SerialListPortsTool,
|
|
SerialMonitorContext,
|
|
)
|
|
|
|
|
|
async def test_serial_monitor():
|
|
"""Test serial monitor functionality"""
|
|
print("🧪 Testing Serial Monitor Components\n")
|
|
|
|
# Create context
|
|
ctx = Context()
|
|
monitor = SerialMonitorContext()
|
|
await monitor.initialize()
|
|
ctx.state["serial_monitor"] = monitor
|
|
|
|
print("✅ Serial monitor initialized")
|
|
|
|
# Test listing ports
|
|
print("\n📡 Testing port listing...")
|
|
list_tool = SerialListPortsTool()
|
|
params = SerialListPortsParams(arduino_only=False)
|
|
|
|
result = await list_tool.run(params, ctx)
|
|
|
|
if result["success"]:
|
|
print(f"✅ Found {len(result['ports'])} ports:")
|
|
for port in result["ports"]:
|
|
arduino_badge = "🟢 Arduino" if port["is_arduino"] else "⚪ Other"
|
|
print(f" {arduino_badge} {port['device']}: {port['description']}")
|
|
if port["vid"] and port["pid"]:
|
|
print(f" VID:PID = {port['vid']:04x}:{port['pid']:04x}")
|
|
else:
|
|
print("❌ Failed to list ports")
|
|
|
|
# Get monitor state
|
|
print("\n📊 Serial Monitor State:")
|
|
state = monitor.get_state()
|
|
print(json.dumps(state, indent=2))
|
|
|
|
# Cleanup
|
|
await monitor.cleanup()
|
|
print("\n✅ Test complete!")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test_serial_monitor())
|