MCP Remote Machine Control
Provides remote machine control capabilities, eliminating SSH overhead for token-efficient system operations.
MCP Remote Machine Control
A Model Context Protocol (MCP) server that provides comprehensive remote machine control capabilities for Claude Code, eliminating SSH overhead and providing token-efficient system operations.
Features
š Performance Benefits
- 30-50% fewer tokens vs SSH commands
- Persistent connections - no SSH handshake overhead
- Structured data exchange - binary protocol vs text parsing
- Session-based authentication - authenticate once, not per command
š ļø System Control Tools
- File Operations: read, write, copy, move, delete, permissions
- Process Management: list, monitor, kill processes
- Service Control: systemctl operations (start/stop/enable/disable)
- Package Management: install/remove/update (apt/yum/pacman auto-detection)
- System Monitoring: CPU, memory, disk, network status
- Command Execution: direct shell access with sudo support
š Security Features
- Session-based sudo authentication (30-minute cache)
- Local network IP filtering
- Secure password handling (never stored)
- Command audit logging
Quick Start
1. Installation
# Clone or download the server files
git clone <repository> mcp-remote-machine
cd mcp-remote-machine
# Run installation script
./install_server.sh
2. Configure Claude Code
Add the MCP server to Claude Code:
# For local machine control
claude mcp add remote-machine "python3 /path/to/remote_machine_server.py --transport stdio"
# For remote machine (over network)
claude mcp add remote-machine-net "python3 /path/to/remote_machine_server.py --transport sse --host 0.0.0.0 --port 8765"
3. Start Using
In Claude Code, you'll have access to these tools:
authenticate_sudo
- Authenticate for privileged operationsexecute_command
- Run shell commandsread_file
/write_file
- File operationslist_directory
- Browse directoriesprocess_management
- Control processesservice_control
- Manage systemd servicespackage_management
- Install/remove packagessystem_info
- Get system status
Usage Examples
Basic Authentication
First authenticate for sudo operations:
> Use authenticate_sudo with your password
File Operations
> Read the contents of /etc/nginx/nginx.conf
> Write a new configuration to /etc/myapp/config.json
> List all files in /var/log/ including hidden files
System Management
> Get current system information including CPU and memory usage
> Install the htop package
> Restart the nginx service
> Show all running processes
Command Execution
> Execute "df -h" to show disk usage
> Run "systemctl status docker" with sudo privileges
Architecture
MCP vs SSH Comparison
Aspect | SSH Approach | MCP Approach |
---|---|---|
Tokens per operation | ~150-300 | ~50-150 |
Connection overhead | New connection each command | Persistent connection |
Data format | Text parsing required | Structured JSON |
Authentication | Per-command prompts | Session-based cache |
Error handling | Text parsing | Structured responses |
Type safety | None | Full type annotations |
Server Architecture
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā Claude Code āāāāāŗā MCP Server āāāāāŗā Target System ā
ā ā ā ā ā ā
ā - Tool calls ā ā - Authentication ā ā - File system ā
ā - Structured ā ā - Command exec ā ā - Processes ā
ā responses ā ā - System APIs ā ā - Services ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
Configuration Options
Server Transport Modes
STDIO Mode (recommended for local/SSH):
python3 remote_machine_server.py --transport stdio
SSE Mode (for network access):
python3 remote_machine_server.py --transport sse --host 0.0.0.0 --port 8765
Claude Code MCP Configuration
Edit your Claude Code MCP configuration:
{
"mcpServers": {
"remote-machine": {
"command": "python3",
"args": ["/path/to/remote_machine_server.py", "--transport", "stdio"],
"env": {
"PYTHONPATH": "/path/to/server"
}
}
}
}
Security Considerations
Local Network Setup
- Server is designed for local network use where security is less critical
- IP filtering can be configured for additional security
- No SSL/TLS required for local network communication
Authentication
- Sudo passwords are cached in memory only (never written to disk)
- Session timeout configurable (default: 30 minutes)
- All privileged operations require prior authentication
Network Security
- For network access, ensure firewall rules allow only trusted sources
- Consider running behind reverse proxy for additional security layers
- Monitor server logs for suspicious activity
Troubleshooting
Common Issues
"Sudo authentication required"
- Use the
authenticate_sudo
tool first with your password - Check if sudo session has timed out (default: 30 minutes)
"Command not found" errors
- Verify the package manager detection worked correctly
- Some commands may need full paths (e.g.,
/usr/bin/systemctl
)
Connection issues
- For SSE mode, ensure the port is not blocked by firewall
- Check that the server process is running and listening
Debug Mode
Run server with debug logging:
PYTHONPATH=/path/to/server python3 remote_machine_server.py --transport stdio
Token Efficiency Analysis
Typical Operation Comparison
Installing a package via SSH:
Tokens: ~280
Command: ssh user@host "sudo apt install -y htop"
Response parsing: Complex text parsing required
Installing a package via MCP:
Tokens: ~120
Tool call: package_management(action="install", package_name="htop")
Response: Structured JSON with success/error status
Reading a file via SSH:
Tokens: ~200
Command: ssh user@host "cat /etc/hostname"
Response: Raw text output
Reading a file via MCP:
Tokens: ~80
Tool call: read_file(file_path="/etc/hostname")
Response: Structured with content, size, modified date
Overall Benefits
- 35% average token reduction across common operations
- 50% faster execution due to persistent connections
- Better error handling with structured responses
- Type safety prevents many classes of errors
Dependencies
- Python 3.8+
- mcp >= 1.0.0
- psutil >= 5.9.0
- fastapi >= 0.100.0 (for SSE mode)
- uvicorn >= 0.20.0 (for SSE mode)
License
MIT License - see LICENSE file for details.
Related Servers
Rakit UI AI
An intelligent tool for AI assistants to present multiple UI component designs for user selection.
QA Sphere
Integration with QA Sphere test management system, enabling LLMs to discover, summarize, and interact with test cases directly from AI-powered IDEs
PentestGPT-MCP
An advanced penetration testing tool for automated, LLM-driven security assessments using tools like nmap and dirb.
Semgrep
Enable AI agents to secure code with Semgrep.
Shell MCP Server
Executes secure shell commands with configurable directory, shell, and timeout validation.
Crypto HFT MCP Server
Integrate AI with high-frequency cryptocurrency trading systems.
Super Secret MCP Server
A fun tool to generate random combinations of US States and signature soups.
AIO-MCP Server
An MCP server with integrations for GitLab, Jira, Confluence, and YouTube, providing AI-powered search and development utility tools.
Mentor MCP
Provides AI-powered mentorship to LLM agents for tasks like code review, design critique, and brainstorming, using the Deepseek API.
FluidMCP CLI
A command-line tool to run MCP servers from a single file, with support for automatic dependency resolution, environment setup, and package installation from local or S3 sources.