agentleFS
CursorTouchCursorTouch/MacOS-MCP/CLAUDE.md

MacOS-MCP

CLAUDE.md192 starsChanged 3 months agoMITView on GitHub

macOS-MCP is a lightweight, open-source MCP (Model Context Protocol) server that enables AI agents to seamlessly integrate with and automate macOS through the Accessibility API. It provides tools for file navigation, application control, UI interaction, browser automation, and system command execution. The project is organized into modular services: ⚠️ Important: macOS-MCP has full system access with no sandboxing. It executes real actions directly on the macOS system.

The file

We split this CLAUDE.md into the rules it gives an agent

9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use double quotes for strings

    line 64
  2. Very specific:

    Follow PEP 8 naming conventions (snake_case functions, PascalCase classes, UPPER_CASE constants)

    line 65
  3. Distinctive:

    Use pytest for unit and integration tests

    line 68
  4. Distinctive:

    Add tests for new features

    line 69
  5. Distinctive:

    Ensure all tests pass before submitting PRs

    line 70
  6. Distinctive:

    Document Args, Returns, and Raises sections

    line 74
  7. Distinctive:

    Consider deployment only in virtual machines or isolated environments

    line 84
  8. Distinctive:

    Add your terminal application (Terminal, iTerm2, VS Code, etc.)

    line 102
  9. Distinctive:

    Consider areas for improvement and extension:

    line 135

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

macOS-MCP: Project Documentation for Claude

Project Overview

macOS-MCP is a lightweight, open-source MCP (Model Context Protocol) server that enables AI agents to seamlessly integrate with and automate macOS through the Accessibility API. It provides tools for file navigation, application control, UI interaction, browser automation, and system command execution.

Tech Stack

  • Language: Python 3.11+
  • Package Manager: UV
  • Build System: Hatchling
  • Code Quality: Ruff (formatter/linter at 100 character line length)

Architecture

The project is organized into modular services:

Entry Point (src/macos_mcp/__main__.py)

  • Registers all MCP tools
  • Initializes core services
  • Manages server lifecycle

Desktop Service (src/macos_mcp/desktop/service.py)

  • High-level automation orchestrator
  • Handles window management, screenshots, input actions, and clipboard operations
  • Coordinates with Tree service for UI discovery

Tree Service (src/macos_mcp/tree/service.py)

  • Captures the macOS accessibility tree from active and background windows
  • Traverses UI elements and identifies interactive components
  • Scans multiple sources concurrently (focused app, dock, menu bar, control center, etc.)

Supporting Modules

  • Config modules: Constants for interactive roles, actions, and UI configuration
  • Views modules: Data classes for structured representation of desktop and tree state

Key Features

  • Native macOS Integration: Uses Accessibility API (ApplicationServices) for native UI interaction
  • Vision-Optional: Works with any LLM, no requirement for specialized vision models
  • Parallel Scanning: Scans multiple UI sources concurrently for improved performance
  • Smart Context Awareness: Detects application state (Launchpad, Control Center, etc.) and adjusts behavior
  • Screenshot Annotations: Generates visual references with numbered bounding boxes

Tools Provided

ToolPurpose
ClickClick at coordinates (left/right/double)
TypeType text, optionally clearing existing text
ScrollScroll vertically or horizontally
MoveMove or drag mouse pointer
ShortcutPress keyboard shortcuts (Cmd+C, etc.)
WaitPause execution for defined duration
SnapshotCapture desktop state with optional visual annotations
AppLaunch/manage applications
ShellExecute shell commands or AppleScript
ScrapeExtract and convert webpage content to Markdown

Development Guidelines

Code Style

  • Line length: 100 characters maximum
  • Use double quotes for strings
  • Follow PEP 8 naming conventions (snake_case functions, PascalCase classes, UPPER_CASE constants)

Testing

  • Use pytest for unit and integration tests
  • Add tests for new features
  • Ensure all tests pass before submitting PRs

Documentation

  • Include Google-style docstrings for public functions
  • Document Args, Returns, and Raises sections
  • Include type hints

Security Considerations

⚠️ Important: macOS-MCP has full system access with no sandboxing. It executes real actions directly on the macOS system.

  • Grant accessibility permissions only to trusted applications
  • Be cautious when using the Shell tool with elevated commands
  • Review and understand actions being performed by AI agents
  • Consider deployment only in virtual machines or isolated environments

Deployment Recommendations

  • Safe: Virtual machines with snapshots, macOS VMs, isolated test systems
  • Unsafe: Production systems, machines with irreplaceable data, shared systems

System Requirements

  • macOS 12 (Monterey) or later
  • Python 3.11+
  • UV package manager
  • Accessibility permissions granted to the terminal/application

Grant Accessibility Permissions

  1. Open System Settings > Privacy & Security > Accessibility
  2. Click the lock icon and authenticate
  3. Add your terminal application (Terminal, iTerm2, VS Code, etc.)
  4. Restart the terminal after granting permissions

Running the Server

# Direct execution
uvx macos-mcp

# In Claude Desktop config
{
  "mcpServers": {
    "macos-mcp": {
      "command": "uvx",
      "args": ["macos-mcp"]
    }
  }
}

Dependencies

Key dependencies and their purposes:

  • pyobjc-framework-ApplicationServices: Accessibility API bridge
  • pyobjc-framework-Cocoa: Cocoa framework access
  • pyobjc-framework-Quartz: Quartz/CoreGraphics access
  • pillow: Image processing for screenshots
  • fastmcp: MCP protocol implementation
  • markdownify: HTML to Markdown conversion
  • requests: HTTP client for web scraping

Future Enhancements

Consider areas for improvement and extension:

  • Enhanced multi-monitor support
  • Improved performance optimization for large UI trees
  • Additional browser automation tools
  • System preference management

Contributing

See CONTRIBUTING.md for detailed contribution guidelines.

Security Policy

See SECURITY.md for comprehensive security information and responsible disclosure process.

License

MIT License - see LICENSE file for details

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.