Skip to content

hotaq/Rust_mcp

Repository files navigation

macOS MCP Server

A secure Model Context Protocol (MCP) server for macOS command execution with AI assistant integration.

Features

  • 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

Quick Start

  1. Install Rust (if not already installed):

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Clone and build:

    git clone <repository-url>
    cd macos-mcp-server
    cargo build --release
  3. Configure:

    cp config.example.toml config.toml
    # Edit config.toml to customize settings
  4. Run the server:

    cargo run --bin macos-mcp-server

Configuration

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

Security Features

  • 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

Client Integration

Claude Code

Configure Claude Code to connect to the MCP server:

{
  "mcpServers": {
    "macos-commands": {
      "command": "/path/to/macos-mcp-server",
      "args": ["--config", "/path/to/config.toml"]
    }
  }
}

Codex and Factory Droid

Similar configuration patterns apply to other AI clients.

Development

Building

cargo build
cargo build --release  # Optimized build

Testing

cargo test                     # Unit tests
cargo test --test integration  # Integration tests
cargo clippy                   # Linting
cargo fmt                      # Formatting

Project Structure

  • src/lib.rs - Main library and server implementation
  • src/bin/server.rs - Server binary entry point
  • src/mcp/ - MCP protocol implementation
  • src/security/ - Security validation and policies
  • src/execution/ - Command execution engine
  • src/history/ - Command history and recall
  • src/tools/ - Tool registry and implementations
  • src/client/ - Multi-client session management
  • src/audit/ - Comprehensive logging system
  • src/config/ - Configuration management

License

MIT License - see LICENSE file for details.

Contributing

Please see CONTRIBUTING.md for contribution guidelines.# Rust_mcp

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •