mac-control-mcp CLAUDE.md

Project instructions for a native macOS server that lets coding agents control apps and system features through macOS interfaces. It covers a Swift project, its structure, and how to build and test it.

In plain words
What is it for?
Use it when developing, building, testing, or debugging the macOS control server and its features for windows, menus, Apple apps, hardware, and system information.
Why use it?
It gives an agent the project background and the commands needed to work on the code safely. This reduces confusion when changing or checking the server.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/adelelo13/mac-control-mcp/claude-md
Clone the repo
git clone --depth 1 https://github.com/AdelElo13/mac-control-mcp
Per session 806 This file is loaded in full into every session.
When invoked 806 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00806 $0.00806
Opus 5 $0.00403 $0.00403
Sonnet 5 $0.00161 $0.00161
Haiku 4.5 $0.00081 $0.00081

Measured 2d ago against content hash 66f7f0684b30, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mac-control-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 62 lines

How it starts

The opening of the file, as written. The whole thing — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Project: mac-control-mcp

Context

  • What this builds: Native macOS MCP server (Model Context Protocol) for controlling macOS via Accessibility API, AppleScript, and system frameworks
  • Stack: Swift 6, Swift Package Manager, macOS 14+, AX API (ApplicationServices), AppKit, EventKit, Contacts, CoreLocation, AVFoundation
  • Platform: macOS
  • Phase: Active development / production (v0.8.x)
  • Repo: AdelElo13/mac-control-mcp (public on GitHub)
  • Binary: .build/debug/mac-control-mcp (debug), .build/release/mac-control-mcp (release)

Build

swift build           # debug
swift build -c release # release (for shipping/notarization)
swift test            # run test suite

Architecture

  • Sources/MacControlMCP/ — all source files
    • Tools.swift — main dispatch router + tool registry
    • Tools+V2.swift, Tools+V2Phase*.swift — tool definitions split by phase
    • *Controller.swift — domain controllers (Accessibility, Window, Menu, etc.)
    • AppleAppsController.swift — Messages, Mail, Calendar, Reminders, Contacts
    • SystemInfoController.swift — disk, battery, network, bluetooth, system load
    • HardwareController.swift — brightness, volume, night shift
  • Tests/ — unit + integration tests
  • TestHarness/ — manual test scripts

Tool routing rules

Task Use
macOS UI automation AX API via AccessibilityController
Contacts lookup CNContactStore (NOT AppleScript — Contacts.app may not be running)
Calendar/Reminders EventKit directly
Browser control BrowserController (AppleScript fallback)
Disk/system info SystemInfoController via df -k -P (KB → GB conversion applied)

Known pitfalls

  • df -g on macOS does NOT reliably return GB values — always use df -k and divide by 1024² to get real GB
  • list_menu_titles defaults to frontmost app when pid is omitted — no need to call focused_app first
  • AppleScript tell application "Contacts" fails with -600 when Contacts.app isn't running — use CNContactStore instead
  • parsePID(nil) returns nil same as an invalid pid — check arguments["pid"] == nil to distinguish "not provided" from "invalid"
  • Always wrap framework imports in #if canImport(...) guards (EventKit, Contacts, CoreLocation not available on all platforms)
  • list_windows is NOT a reliable process-liveness probe: its CG fallback can report a residual window-server entry (count:1, minimized:true, empty title) for a window that is already closed. To detect a windowless zombie, walk the AX tree (get_ui_tree) and require an AXWindow node — a zombie exposes only a childless AXApplication root (2026-07-06, ControlZoo pid 19604/38320)

Read the full file on GitHub · 62 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 62 lines · 806 tokens per session scan A 66f7f0684b30

Subscribe to this mod's changes

mac-control-mcp CLAUDE.md is an instructions file published in the GitHub repository AdelElo13/mac-control-mcp (16 stars, last pushed 1mo ago), licensed MIT. It adds 806 tokens to every session, about $0.0040 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

FastLED GEMINI.md

Gemini CLI instructions for FastLED/FastLED, a project described as: The FastLED library for colored LED animation on Arduino. Please direct questions/requests for help to the FastLED Reddit community: http://fastled.io/r We'd like to use github "issues" just for tracking library bugs / enhancements.

FastLED/FastLED · 9 tokens

kicad-happy GEMINI.md

Instructions for aklofas/kicad-happy, covering kicad-happy, agent guidelines, skills, running analysis and schematic analysis.

aklofas/kicad-happy · 1,207 tokens

brilliant_sdk AGENTS.md

Instructions for brilliantlabsAR/brilliant_sdk, covering brilliant sdk — agent guide, how an app works (the pattern behind everything), minimal reading paths, verify without hardware and testing.

brilliantlabsAR/brilliant_sdk · 1,817 tokens

NeoMind CLAUDE.md

Instructions for camthink-ai/NeoMind, covering neomind — edge ai platform for iot, development commands, ecosystem repositories, extension package contract (.nep) and device type template contract (json).

camthink-ai/NeoMind · 4,296 tokens

AMD-BC-250-Windows-Driver AGENTS.md

Instructions for Keshas-dev/AMD-BC-250-Windows-Driver, covering amd bc-250 windows driver — agent notes, host machine, ⚠️ historical-data caution (2026-08-21, strengthened), fresh re-verifications (current build, 2026-08-21) and workspace boundary.

Keshas-dev/AMD-BC-250-Windows-Driver · 48,206 tokens

Nothan-OS CLAUDE.md

Instructions for Vinalinux-Org/Nothan-OS, covering claude.md — nothanos, hard rules, toolchain, driver and design philosophy.

Vinalinux-Org/Nothan-OS · 499 tokens