Enables input automation, audio control, and camera functionality on Linux systems
Provides control for input devices with limited hardware support on macOS
Integrates with Ollama LLMs to enable natural language hardware control through OllamaHardwareAgent
Provides a Python framework for hardware control and automation with MCPHardwareClient
Offers comprehensive GPIO and hardware support for controlling LEDs, buttons, and sensors on Raspberry Pi devices
MCP Hardware Project Summary
🚀 Project Overview
The MCP Hardware Access Library is a comprehensive Python framework that enables secure hardware control through the Model Context Protocol (MCP). It provides AI agents and automation systems with the ability to interact with physical devices across multiple platforms.
📊 Project Statistics
- Total Files: 40+ files
- Lines of Code: ~5,000+ lines
- Components: 7 major subsystems
- Examples: 15+ demonstration scripts
- Test Coverage: Full client/server tests
🆕 Latest Updates (May 2025)
- Project Reorganization: Improved directory structure for better organization and clarity
- Unified Documentation: Consolidated documentation in a structured format
- Standardized Configuration: Reorganized configuration files for consistency
- Simulation Mode: Enhanced simulation capabilities for development without hardware
- DSL Integration: Fixed and improved Domain-Specific Language support
- Claude 3.7 Integration: Added natural language processing for device control
- Mock Device Factory: Created mock implementations for testing
- Comprehensive Testing: All integration tests now passing
- Claude UnitMCP Plugin: New plugin for advanced natural language hardware control
- Remote Device Control: Enhanced shell CLI for interactive remote device control
- GPIO Streaming: Added real-time GPIO streaming from Raspberry Pi to client PC
- SSH/TCP Support: Added support for both SSH and TCP connections to remote devices
📦 Dependency Management
We now use Conda for dependency management to ensure consistent environments across different platforms:
- Cross-platform compatibility: Works on Windows, Linux, macOS, and Raspberry Pi
- Isolated environments: Prevents dependency conflicts
- Binary package management: Handles both Python packages and system libraries
To set up your environment:
For more details, see INSTALLATION.md.
🚀 Quick Start with Auto-Installation
We've added convenient runner scripts that automatically detect if the UnitMCP package is installed and install it if needed:
These scripts will:
- Check if the UnitMCP package is installed
- Install it automatically if it's not found
- Run the UnitMCP orchestrator with any provided options
This is especially useful for:
- First-time setup on new devices
- Running on Raspberry Pi without manual installation
- Quick deployment in development environments
All command-line options are passed through to the UnitMCP orchestrator, so you can use them exactly as you would with the standard command:
For more details on installation and running options, see INSTALLATION.md.
📚 Documentation
📁 New Project Structure
The project has been reorganized to improve clarity and reduce duplication:
- Documentation: All documentation is now in the
docs/
directory with clear sections - Configuration: Configuration files are now in the
configs/
directory - Source Code: Source code is organized into logical categories in
src/unitmcp/
- Examples: Examples are categorized by functionality
- Tests: Test structure aligns with the source code structure
See the Migration Guide for details on the changes and how to update your code.
🏗️ Architecture
Core Components
- Client System
MCPHardwareClient
: Async client for hardware controlMCPShell
: Interactive command-line interface- Pipeline execution support
- Server System
MCPServer
: Main server frameworkDeviceManager
: Hardware device managementSecurityManager
: Authentication and authorization
- Hardware Abstraction
- Platform-specific implementations
- Simulation support for development
- Device discovery and configuration
- Remote Control
- Shell-based remote control interface
- WebSocket-based real-time updates
- SSH and TCP connection options
- GPIO streaming from Raspberry Pi to client PC
- Domain-Specific Language
- YAML-based device configuration
- Natural language command processing
- Pipeline definition language
- Security Layer
- Permission management system
- Client authentication
- Operation auditing
- Pipeline System
- Automated command sequences
- Conditional execution
- Error handling and retries
- Variable substitution
- DSL System
- Domain-Specific Language for hardware configuration
- YAML-based device definitions
- Natural language command processing via Claude 3.7
- Command parsing and execution
- Claude UnitMCP Plugin
- Advanced natural language processing for hardware control
- Multi-turn conversation support with context awareness
- Robust error handling with conversational recovery
- Integration with DSL system and MockDeviceFactory
- Simulation mode for testing without hardware
📊 Architecture Diagrams
System Architecture
For more detailed architecture documentation, see the Architecture Documentation.
Project Structure
The project has been reorganized with the following structure:
🔌 Remote Device Control and GPIO Streaming
UnitMCP provides powerful capabilities for remote device control and real-time GPIO streaming:
Interactive Shell Control
The shell_cli
module provides an interactive shell interface for controlling remote devices:
For simpler implementations, a lightweight shell is also available:
Real-time GPIO Streaming
The rpi_control
module enables real-time streaming of GPIO pin states from a Raspberry Pi to a client PC:
This provides:
- Low-latency updates when GPIO states change
- Bidirectional communication for remote control
- Event-driven architecture for responsive applications
- Support for multiple clients monitoring the same GPIO pins
See the examples/rpi_control/README.md for detailed documentation.
💡 Key Features
1. Hardware Control
- GPIO Operations: LEDs, buttons, sensors (Raspberry Pi)
- Input Devices: Keyboard and mouse automation
- Audio System: Recording, playback, TTS/STT
- Camera Control: Image capture, face detection, motion detection
- USB Devices: Device enumeration and management
2. Hardware Abstraction Layer
- Unified Interface: Consistent API across all device types
- Multi-mode Operation: Hardware, simulation, remote, and mock modes
- Device Types: LEDs, buttons, traffic lights, displays, and more
- Event-driven Architecture: Callback system for device events
- Configuration-based Setup: Create devices from configuration files
- Factory Pattern: Extensible device creation system
3. Remote Hardware Setup
- Automated Setup Scripts: Configure and test hardware components remotely
- Component-specific Setup: Individual scripts for OLED, LCD, sensors, etc.
- Simulation Mode: Test setup scripts without physical hardware or sudo privileges
- Remote Deployment: SSH-based installation and configuration
4. AI Integration
- Ollama LLM Support: Natural language hardware control
- Voice Assistant: Speech recognition and synthesis
- Automated Agents: AI-driven hardware automation
5. Interactive Shell
6. Pipeline Automation
📁 Project Structure
🚀 Quick Start
Installation
Hardware Setup
Start Server
Run Examples
Hardware Abstraction Layer Usage
AI Agent <-> MCP Client <-> MCP Servers <-> Hardware Drivers
📚 Example Applications
1. Traffic Light System
- Simulates complete traffic light with LEDs
- Pedestrian crossing functionality
- Timing control and sequencing
2. Security System
- Motion detection alerts
- Camera surveillance
- Multi-sensor integration
- Automated responses
3. Voice Assistant
- Natural language commands
- Hardware control via speech
- Voice feedback and confirmation
4. Automation Workflows
- Automated testing sequences
- Data entry automation
- System monitoring and alerts
🛠️ Practical Examples
LED Control Example
This example demonstrates controlling an LED using the hardware abstraction layer:
Button with Event Callbacks
This example shows how to use a button with event callbacks:
Traffic Light Control
This example demonstrates controlling a traffic light sequence:
Display Text and Counter
This example shows how to use a display device:
Device Factory Usage
This example demonstrates using the device factory to create devices:
Complete Interactive System Example
This example demonstrates a complete interactive system that combines multiple hardware devices to create a traffic light controller with button input and display feedback:
This complete example demonstrates:
- Configuration-based device creation
- Event-driven architecture with callbacks
- Integration of multiple device types (traffic light, button, display)
- State management and transitions
- User interaction through button presses
- Visual feedback through display updates
- Proper initialization and cleanup
- Environment-based mode selection (hardware vs. simulation)
- Error handling and graceful shutdown
The system simulates a traffic light at an intersection with a pedestrian crossing button. When a pedestrian presses the button, the system acknowledges the request and adjusts the traffic light cycle to allow for pedestrian crossing.
🔧 Supported Platforms
Documentation Links
Below you'll find links to documentation throughout the project:
Main Documentation
- Main Documentation - Project documentation overview
- API Documentation - API reference and usage guides
- Architecture Documentation - System architecture and design patterns
- Hardware Guides - Hardware setup and configuration guides
- Installation Guides - Installation instructions for different platforms
- Refactoring Guide - Guide for standardized utilities and refactoring practices
Examples
- Examples Overview - Overview of all example projects
- Basic Examples - Simple examples for getting started
- Advanced Examples - Advanced usage patterns and techniques
- Shell CLI - Interactive shell for remote device control
- Orchestrator - Tool for managing examples and servers
- Raspberry Pi Control - Examples for controlling Raspberry Pi hardware
- Server Examples - Server implementation examples
- Hardware Demos - Demonstrations of hardware functionality
- Input Devices - Working with input devices like buttons and sensors
- Integrated Demo - Comprehensive demo integrating multiple components
- Runner Examples - Examples using the runner framework
AI and Voice Integration
- AI Examples - Artificial intelligence integration examples
- Object Recognition - Computer vision and object detection
- Voice Assistant - Voice command and control examples
- Text-to-Speech - Text-to-speech integration examples
- LLM Integration - Large Language Model integration
- Ollama Integration - Integration with Ollama for local LLMs
Platform-Specific Documentation
- Raspberry Pi Platform - Raspberry Pi specific documentation
- Platforms Overview - Supported hardware platforms
- Ubuntu - Ubuntu-specific setup and configuration
- Fedora - Fedora-specific setup and configuration
- macOS - macOS-specific setup and configuration
System Components
- Hardware - Hardware component documentation
- Audio - Audio processing and playback
- NLP - Natural Language Processing components
- Service - Service management and deployment
- SSH - Secure Shell configuration and usage
- Docker - Docker containerization support
- Python - Python environment and dependencies
Utilities and Tools
- Installation Tools - Installation utilities
- Update Tools - System update utilities
- Testing - Testing framework and procedures
Specialized Examples
- Automation - Automation and scheduling examples
- DSL Examples - Domain-Specific Language examples
- Plugin System - Plugin architecture and extension examples
- Security Examples - Security implementation examples
- UnitMCP Core - Core UnitMCP functionality examples
- UnitMCP Bridges - Integration bridges to external systems
Mermaid Diagrams
UnitMCP documentation uses Mermaid for creating diagrams. Below are examples of different diagram types you can create:
Sequence Diagram
Flowchart
Class Diagram
State Diagram
Entity Relationship Diagram
Gantt Chart
Pie Chart
Git Graph
User Journey
These diagrams can be used throughout the documentation to visualize system architecture, processes, and relationships between components.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A Python framework that enables secure hardware control through the Model Context Protocol, allowing AI agents and automation systems to interact with physical devices across multiple platforms.
Related MCP Servers
- AsecurityFlicenseAqualityA Model Context Protocol server that allows secure execution of pre-approved commands, enabling AI assistants to safely interact with the user's system.Last updated -1318JavaScript
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants like Claude to perform Python development tasks through file operations, code analysis, project management, and safe code execution.Last updated -1Python
- -securityAlicense-qualityA streamlined foundation for building Model Context Protocol servers in Python, designed to make AI-assisted development of MCP tools easier and more efficient.Last updated -15PythonMIT License
- AsecurityAlicenseAqualityA secure Model Context Protocol server that allows AI models to safely interact with Windows command-line functionality, enabling controlled execution of system commands, project creation, and system information retrieval.Last updated -83TypeScriptMIT License