Mac MCP
A local macOS MCP server for AI Agents that exposes safe endpoints for shell commands, files, processes, macOS automation, browser control, and more.
README
Mac MCP
Screenshots
<p align="center"> <img src="assets/screenshots/mac-mcp-system-info.png" alt="Mac MCP checking CPU, RAM, battery, and disk from a Custom GPT" width="48%"> <img src="assets/screenshots/mac-mcp-git-commits.png" alt="Mac MCP listing latest Git commits from a local repository" width="48%"> </p>
Mac MCP is a local macOS MCP server for AI Agents, mainly for CustomGPT (ChatGPT). It exposes safe, structured HTTP endpoints and MCP tools for common desktop tasks: shell commands, files, processes, background jobs, macOS automation, browser control, screenshots, search, HTTP requests, and interactive user prompts.
It is designed for four common setups:
- MCP clients that can connect to the
/mcpendpoint. - Custom GPT Actions that need an OpenAPI schema and a public HTTPS URL, usually through ngrok.
- Ability to handle all the things done just from your phone (app).
- Replacing the Codex, with nearly unlimited prompt limits (3000 Thinking 'prompt' limits, not request.)
Security note: this server can control your Mac. Do not expose it without authentication. Use a strong
MCP_API_KEY, keepMCP_ALLOW_NO_AUTH=false, and only share your ngrok URL with clients you trust.
Features
- Run zsh commands and inspect running processes.
- Start, monitor, read, and stop long-running background jobs.
- Read, write, move, copy, delete, search, and inspect files.
- Run AppleScript, open apps/URLs, use clipboard, notifications, reminders, screenshots, volume, and brightness.
- Control Safari or Google Chrome tabs, selectors, JavaScript, screenshots, scrolling, keys, coordinate clicks, and DOM snapshots.
- Ask the local user a question with a native macOS dialog during autonomous workflows.
- Use the same backend through MCP or REST endpoints for Custom GPT Actions.
Requirements
- macOS
- Python 3.10+
- Git
- ngrok account, if you want a public HTTPS URL for Custom GPT Actions
- Optional:
brightnessCLI for brightness control
brew install python git ngrok
brew install brightness # optional
Installation
git clone https://github.com/bulutarkan/mac-mcp.git
cd mac-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
cp mcp_server/.env.example mcp_server/.env
Edit mcp_server/.env:
MCP_API_KEY=replace-with-a-long-random-token
MCP_ALLOW_NO_AUTH=false
MCP_ALLOW_SHELL=true
RATE_LIMIT_PER_MINUTE=120
# Paste your static ngrok domain here. Use only the domain, not https://
NGROK_DOMAIN=your-domain.ngrok-free.dev
Generate a token with:
python3 - <<'PY'
import secrets
print(secrets.token_urlsafe(48))
PY
Start, stop, restart, and status
After pip install -e ., the mac-mcp command is available inside the virtual environment:
mac-mcp start # local server only
mac-mcp start --ngrok # local server + ngrok tunnel
mac-mcp status
mac-mcp restart --ngrok
mac-mcp stop
Useful options:
mac-mcp start --host 127.0.0.1 --port 8000
mac-mcp start --ngrok --ngrok-domain your-domain.ngrok-free.dev
mac-mcp start --reload
mac-mcp stop --force
mac-mcp start starts only the local server on 127.0.0.1:8000. mac-mcp start --ngrok starts the local server and a managed ngrok tunnel in the background.
Logs are written to:
~/.mac-mcp/mac-mcp.log
You can also run the server directly:
uvicorn mcp_server.main:app --host 127.0.0.1 --port 8000
Local endpoints
The server exposes:
MCP: http://127.0.0.1:8000/mcp
REST: http://127.0.0.1:8000/api/*
Example REST request:
curl -X POST http://127.0.0.1:8000/api/system_info \
-H "Authorization: Bearer $MCP_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Example command request:
curl -X POST http://127.0.0.1:8000/api/run \
-H "Authorization: Bearer $MCP_API_KEY" \
-H "Content-Type: application/json" \
-d '{"command":"pwd && sw_vers","timeout_s":10}'
Getting a static ngrok dev domain
Custom GPT Actions require a public HTTPS URL. For local development, ngrok is the easiest option.
- Sign in or create an ngrok account.
- Install and authenticate ngrok:
ngrok config add-authtoken YOUR_NGROK_AUTHTOKEN
- Create a static domain in the ngrok dashboard:
Cloud Edge / Domains -> New Domain
You will get a domain like:
your-domain.ngrok-free.dev
- Paste the static domain into
mcp_server/.env:
NGROK_DOMAIN=your-domain.ngrok-free.dev
Use only the domain. Do not include https:// in NGROK_DOMAIN.
- Start Mac MCP and ngrok together:
mac-mcp start --ngrok
This starts the local server at http://127.0.0.1:8000 and the public ngrok tunnel at:
https://your-domain.ngrok-free.dev
You can also override the domain from the command line:
mac-mcp start --ngrok --ngrok-domain your-domain.ngrok-free.dev
Custom GPT Actions setup
Use the included OpenAPI file:
openapi/custom-gpt-actions.json
Before importing it into the GPT builder, replace the placeholder server URL:
"servers": [
{
"url": "https://your-static-ngrok-domain.ngrok-free.dev"
}
]
with your own ngrok domain:
"servers": [
{
"url": "https://your-domain.ngrok-free.dev"
}
]
In the GPT builder:
- Open your GPT.
- Go to Configure -> Actions.
- Create a new action.
- Import
openapi/custom-gpt-actions.json. - Set Authentication to API Key or Bearer token, depending on the UI.
- Use this header format:
Authorization: Bearer YOUR_MCP_API_KEY
The REST endpoints are all under /api, and the operation IDs are stable. For example:
POST /api/run -> run_command
POST /api/system_info -> get_system_info
POST /api/files -> files_operation
POST /api/macos -> macos_operation
POST /api/browser -> browser_operation
POST /api/search -> search_operation
POST /api/interactive -> ask_user
OpenAPI format
A Custom GPT Action schema needs three main pieces:
{
"openapi": "3.1.1",
"info": {
"title": "Mac MCP Server",
"version": "1.0.0"
},
"servers": [
{
"url": "https://your-domain.ngrok-free.dev"
}
],
"paths": {
"/api/system_info": {
"post": {
"operationId": "get_system_info",
"summary": "Get macOS system information",
"responses": {
"200": {
"description": "Successful response."
}
}
}
}
}
}
For grouped endpoints such as /api/files, /api/macos, /api/browser, and /api/search, the tool field selects the internal operation. Example:
{
"tool": "read_file",
"path": "~/Desktop/example.txt"
}
Browser example:
{
"tool": "browser_open_url",
"browser": "Google Chrome",
"url": "https://example.com",
"new_tab": true
}
MCP endpoint
Clients that support MCP over streamable HTTP can connect to:
https://your-domain.ngrok-free.dev/mcp
Use the same bearer token if authentication is enabled.
Security recommendations
- Keep
MCP_ALLOW_NO_AUTH=falsewhen using ngrok. - Use a long random
MCP_API_KEY. - Prefer
127.0.0.1for the local bind address. - Do not commit
.env, logs, job outputs, screenshots, or personal files. - Review every tool you expose to AI clients. Shell, file, browser, and AppleScript tools are powerful.
- Stop the server and the managed ngrok tunnel when you are not using them:
mac-mcp stop
Repository structure
mcp_server/ Python server and tool implementations
openapi/custom-gpt-actions.json
pyproject.toml Package metadata and mac-mcp CLI entry point
README.md
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。