UnitMCP package for MCP hardware integration with Ollama LLM and Raspberry Pi hardware control.
Project description
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: 6 major subsystems
- Examples: 15+ demonstration scripts
- Test Coverage: Full client/server tests
๐๏ธ Architecture
Core Components
-
Client System
MCPHardwareClient: Async client for hardware controlMCPShell: Interactive command-line interface- Pipeline execution support
-
Server System
MCPServer: Main server framework- Hardware-specific servers (GPIO, Input, Audio, Camera)
- Protocol handling and routing
-
Security Layer
- Permission management system
- Client authentication
- Operation auditing
-
Pipeline System
- Automated command sequences
- Conditional execution
- Error handling and retries
- Variable substitution
๐ก 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. AI Integration
- Ollama LLM Support: Natural language hardware control
- Voice Assistant: Speech recognition and synthesis
- Automated Agents: AI-driven hardware automation
3. Interactive Shell
mcp> led_setup led1 17
mcp> led led1 on
mcp> type "Hello from MCP!"
mcp> pipeline_create automation
mcp> pipeline_run automation
4. Pipeline Automation
steps = [
PipelineStep("setup", "gpio.setupLED", {"pin": 17}),
PipelineStep("blink", "gpio.controlLED", {"action": "blink"}),
PipelineStep("wait", "system.sleep", {"duration": 5})
]
pipeline = Pipeline("demo", steps)
await pipeline.execute(client)
๐ Project Structure
mcp-hardware/
โโโ audio/ # Audio-related scripts
โโโ build/ # Build-related files
โโโ hardware/ # Hardware configuration scripts
โโโ install/ # Installation scripts and utilities
โโโ misc/ # Miscellaneous utilities
โโโ nlp/ # Natural Language Processing scripts
โโโ python/ # Python-related utilities
โโโ rpi/ # Raspberry Pi specific scripts
โโโ service/ # Service setup scripts
โโโ ssh/ # SSH connection utilities
โโโ test/ # Testing utilities
โโโ update/ # Update and upgrade scripts
โโโ src/unitmcp/ # Main package
โ โโโ client/ # Client implementations
โ โโโ server/ # Hardware servers
โ โโโ pipeline/ # Pipeline system
โ โโโ protocols/ # MCP protocol
โ โโโ security/ # Permission system
โ โโโ utils/ # Utilities
โโโ examples/ # Usage examples
โ โโโ Basic Controls # LED, keyboard, mouse
โ โโโ Automation # Pipelines, scripts
โ โโโ AI Integration # Ollama, voice
โ โโโ Complete Systems # Traffic light, security
โโโ tests/ # Test suite
๐ Quick Start
Installation
git clone https://github.com/example/mcp-hardware.git
cd mcp-hardware
pip install -e .
Start Server
python examples/start_server.py
Run Examples
# Basic LED control
python examples/led_control.py
# Interactive shell
python -m unitmcp.client.shell
# Pipeline automation
python examples/pipeline_demo.py
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
๐ง Supported Platforms
- Raspberry Pi: Full GPIO and hardware support
- Linux: Input automation, audio, camera
- Windows: Keyboard/mouse control, audio
- macOS: Input devices, limited hardware
๐ก๏ธ Security Features
- Fine-grained permission system
- Client authentication
- Operation auditing
- Secure protocol communication
- Input validation and sanitization
๐ Performance
- Asynchronous architecture
- Efficient protocol handling
- Resource pooling
- Optimized for real-time control
๐ Integration Options
Python Applications
from unitmcp import MCPHardwareClient
async with MCPHardwareClient() as client:
await client.control_led("led1", "on")
Shell Scripts
#!/bin/bash
echo "led_setup led1 17" | python -m unitmcp.client.shell
echo "led led1 on" | python -m unitmcp.client.shell
AI Agents
from unitmcp.examples.ollama_integration import OllamaHardwareAgent
agent = OllamaHardwareAgent()
await agent.process_command("Turn on the lights")
๐ฏ Use Cases
- Home Automation: Control lights, sensors, and devices
- Robotics: Motor control, sensor integration
- Testing Automation: UI testing, hardware validation
- Education: Learning hardware programming
- Prototyping: Rapid hardware development
- Accessibility: Voice-controlled systems
๐ฎ Future Enhancements
- Web interface dashboard
- Cloud integration
- Mobile app control
- More hardware support
- Machine learning integration
- Distributed systems support
๐ Getting Help
- Documentation: See README.md and examples
- Issues: GitHub issue tracker
- Community: Discussion forums
- Support: support@example.com
๐ Acknowledgments
- Anthropic MCP team for the protocol
- Raspberry Pi Foundation for hardware libraries
- Open source community for contributions
The MCP Hardware project provides a robust foundation for building hardware automation systems, AI-controlled devices, and interactive hardware applications. With its modular architecture and comprehensive examples, developers can quickly create sophisticated hardware control solutions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unitmcp-0.1.42.tar.gz.
File metadata
- Download URL: unitmcp-0.1.42.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28c9f7251ae5c3d85afe6e3c2b63caf3e14e9f951874286c5bfb6a9746c257b6
|
|
| MD5 |
e3c932871f11e61c94c3af5c8ffb9c8c
|
|
| BLAKE2b-256 |
ab6e86588d8ec81296ac86821fdcc5f7b3482f13305c4313d01fe1152017366a
|
File details
Details for the file unitmcp-0.1.42-py3-none-any.whl.
File metadata
- Download URL: unitmcp-0.1.42-py3-none-any.whl
- Upload date:
- Size: 216.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5212aba1aa231922efe6d41eb2e578e5f989300caa1cb9eee3a1b32710bad8d
|
|
| MD5 |
70d278b088310aec8f33517d69446f16
|
|
| BLAKE2b-256 |
f2db97ab9a869f365dca03cc0dd664931456064d61253ad12375e4f1a5a44a30
|