A secure Model Context Protocol (MCP) server for macOS command execution with AI assistant integration.
- Secure Command Execution: Validated and authorized macOS command execution
- Command History: Persistent storage and recall of previous commands
- Critical Command Editing: Safe editing interface with validation and warnings
- Multi-Client Support: Concurrent support for Claude Code, Codex, and Factory Droid
- Comprehensive Audit Logging: Complete audit trail for all operations
- Real-time Validation: Input sanitization and security policy enforcement
-
Install Rust (if not already installed):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Clone and build:
git clone <repository-url> cd macos-mcp-server cargo build --release
-
Configure:
cp config.example.toml config.toml # Edit config.toml to customize settings -
Run the server:
cargo run --bin macos-mcp-server
The server is configured via config.toml. Key settings include:
- Server: Listen address, client limits, timeouts
- Security: Sandbox settings, allowed directories, blocked commands
- Execution: Concurrent command limits, resource constraints
- History: Command history retention and search settings
- Audit: Logging configuration and security event tracking
- Command Validation: All commands are validated against security policies
- Sandboxing: Restricted file system access and process execution
- Authorization: macOS Authorization Services integration
- Audit Trail: Complete logging of all operations and security events
- Risk Assessment: Automatic classification of command risk levels
Configure Claude Code to connect to the MCP server:
{
"mcpServers": {
"macos-commands": {
"command": "/path/to/macos-mcp-server",
"args": ["--config", "/path/to/config.toml"]
}
}
}Similar configuration patterns apply to other AI clients.
cargo build
cargo build --release # Optimized buildcargo test # Unit tests
cargo test --test integration # Integration tests
cargo clippy # Linting
cargo fmt # Formattingsrc/lib.rs- Main library and server implementationsrc/bin/server.rs- Server binary entry pointsrc/mcp/- MCP protocol implementationsrc/security/- Security validation and policiessrc/execution/- Command execution enginesrc/history/- Command history and recallsrc/tools/- Tool registry and implementationssrc/client/- Multi-client session managementsrc/audit/- Comprehensive logging systemsrc/config/- Configuration management
MIT License - see LICENSE file for details.
Please see CONTRIBUTING.md for contribution guidelines.# Rust_mcp