Unraid MCP Server

by jmagar
Verified
# Active Context: Unraid MCP Server Implementation ## What We're Working On Now - Successfully debugged and fixed critical issues in the Unraid MCP server - Fixed timeout issues with disk operations by increasing request timeout - Resolved GraphQL schema validation errors by simplifying queries - Enhanced error handling and logging for better diagnostics - Successfully integrated the MCP server with Claude/Cline - Made server use stdio transport mode exclusively - Commented out all SSE-related code to simplify the codebase - Modified server.py and run_server.py to use stdio transport by default - Updated .env.template to remove SSE-related configuration - Verified resources and tools are working correctly with real Unraid server - Implemented read-only API features: - User management (get_users) - API key management (get_api_keys) - Unassigned devices (get_unassigned_devices) - Parity history (get_parity_history) - Updated README with proper JSON configuration for stdio mode integration - Added comprehensive "Use at Your Own Risk" disclaimer to README - Removed all potentially dangerous tools and methods for security - Improved all tools with proper human-readable formatting - Removed duplicate tools to simplify the codebase ## Recent Changes - Fixed HTTP timeout errors in the Unraid client: - Increased timeout from 30 to 60 seconds for API requests - Added better error handling for timeout conditions - Resolved GraphQL schema validation errors: - Simplified queries to avoid fields that might be null or missing - Removed problematic fields like `interfaceType` and `fsType` that caused validation errors - Improved handling of nested field paths in GraphQL responses - Enhanced logging system: - Added both console and file outputs for better visibility - Improved error context in log messages - Added detailed diagnostic information for debugging - Updated Docker tools implementation: - Fixed container query execution by using direct query instead of helper methods - Improved error handling for Docker operations - Enhanced UnraidClient with better error handling based on API documentation - Reorganized resource URIs to follow FastMCP patterns - Added templated resources for individual VMs and containers - Added resources for shares and plugins information - Enhanced documentation with tables of available resources and tools - Successfully integrated with Claude using stdio mode - Configured server using mcpServers JSON configuration - Tested end-to-end functionality with Claude - Removed potentially dangerous tools and methods: - Removed system management tools (shutdown_server, reboot_server) - Removed array management tools (start_array, stop_array) - Removed disk management tools (mount_disk, unmount_disk) - Removed user management tools (add_user, delete_user) - Removed API key management tools (create_api_key) - Removed remote access configuration tools (setup_remote_access, enable_dynamic_remote_access) - Removed all corresponding methods from unraid_client.py - Updated documentation to reflect read-only nature of the server - Updated README.md: - Removed references to SSE transport mode - Added detailed instructions for stdio mode integration - Added JSON configuration examples for Anthropic API and Cursor - Simplified usage instructions to focus on stdio mode - Organized available tools by category for better readability - Updated "Use at Your Own Risk" disclaimer to emphasize read-only nature - Updated Features section to reflect read-only capabilities - Modified code to use stdio transport exclusively: - Updated server.py to always use stdio transport - Commented out all SSE-related code in server.py - Modified run_server.py to default to stdio transport - Commented out SSE-related command line arguments - Updated .env.template to clarify that SSE transport is not used - Improved all tools with proper human-readable formatting: - Added consistent formatting patterns across all tools - Used emojis and clear section headers for better readability - Organized information in a logical, easy-to-read format - Added status indicators (🟢/🔴) for running/stopped services - Included summary statistics where applicable - Improved error messages with more context - Removed duplicate tools to simplify the codebase: - Removed `get_vms` (keeping the formatted `list_vms`) - Removed `get_array_status` (keeping the formatted `format_array_status`) - Removed `get_docker_containers` (keeping the formatted `list_containers`) - Removed `archive_notification` (was not working correctly) ## Next Steps 1. Continue testing and improving the read-only tools: - Test with various Unraid server configurations - Verify error handling under different failure scenarios - Optimize queries for better performance 2. Add security enhancements: - User authentication for the MCP server - Role-based access control - Secure token handling 3. Implement advanced features: - Caching layer for improved performance - Metrics and monitoring - Connection pooling for API requests 4. Deployment improvements: - Create Docker container for easy deployment - Add systemd service configuration - Implement automatic updates