Minimal MCP server that exposes macOS Shortcuts execution to ChatGPT-compatible clients.
- macOS host
- Python 3.12+ and uv for dependency management
- FastMCP (installed automatically via
uv) for the streamlined MCP runner
uv syncRun uv sync again whenever you git pull new commits. The command reads the
project's pyproject.toml/uv.lock and makes sure the virtual environment
matches exactly, installing new dependencies, updating existing ones, and
removing anything that is no longer required. No additional cleanup steps are
needed unless you intentionally want to clear your cached wheels (use uv cache prune) or recreate the environment from scratch.
- STDIO:
uv run fastmcp run src/mac_shortcuts_mcp/server.py --transport stdio - Streamable HTTP/SSE (defaults to
0.0.0.0:8000):uv run fastmcp run src/mac_shortcuts_mcp/server.py \ --transport streamable-http \ --host 0.0.0.0 \ --port 8000
- Pass
--transport httpto serve JSON responses instead of SSE
- Pass
Most MCP clients expect one of two transport styles. The FastMCP runner exposes both, using the following connection details:
- STDIO transport – launch the server with the stdio command above and configure the client to execute the exact command. The client should read and write JSON-RPC frames over the spawned process' stdin/stdout streams.
- HTTP / SSE transport – start the server with the HTTP example and point
the client at
http://$HOST:$PORT/mcp(for JSON responses use the same path over HTTPS/HTTP). The SSE variant also uses the/mcpmount for the stream.
Run the MCP client of choice and provide the client with the following payload:
{
"shortcutName": "Show Content",
"textInput": "testing output",
"timeoutSeconds": 30
}Providing textInput pipes the supplied text to the shortcut's standard input,
mirroring `echo "value" | shortcuts run "Shortcut Name"`.
The FastMCP runner currently binds without TLS and leaves DNS-rebinding
protection disabled. For HTTPS termination or to enforce an
allowed_hosts/allowed_origins policy, invoke the Typer-based CLI
instead:
uv run python -m mac_shortcuts_mcp http \
--host 0.0.0.0 \
--port 8443 \
--allowed-host example.com \
--allowed-origin https://example.com \
--certfile /path/to/fullchain.pem \
--keyfile /path/to/privkey.pem- Omit
--certfile/--keyfileto serve HTTP only, or change--hostto127.0.0.1when terminating TLS via a reverse proxy. - Provide multiple
--allowed-host/--allowed-originflags as needed to re-enable FastMCP's DNS-rebinding protection.
