Skip to main content
Glama

MCP macOS

A Model Context Protocol (MCP) server that provides macOS system integration capabilities to LLMs via AppleScript. Built with Effect TS for robust error handling and resource management.

Features

  • 🍎 macOS Native Notifications: Uses AppleScript's display notification for system-native notifications

  • πŸ›‘οΈ Type-Safe & Robust: Built with Effect TS and comprehensive error handling

  • πŸ”’ Rate Limited: Prevents notification spam with configurable rate limiting (default: 5 per 10 seconds)

  • πŸ—οΈ Reproducible Builds: Uses Nix flakes for reproducible dependency management

  • πŸ“ MCP Compliant: Implements the full MCP specification with proper tool definitions

  • ⚑ Single Binary: Compiles to a standalone executable for easy deployment

Related MCP server: Notifications MCP Server

Requirements

  • macOS: This server only works on macOS systems

  • Node.js 24+: Required for native TypeScript support

  • osascript: Must be available in PATH (comes with macOS)

  • Nix (for building): Install Nix with flakes enabled

Quick Start

# Clone and enter the project
git clone <repository-url>
cd macos-mcp

# Enter development environment
nix develop

# Install dependencies
npm install

# Run in development mode
npm run dev

# Or build and run
nix build
nix run

Manual Setup

# Install Node.js 24+ and dependencies
npm install

# Run the server directly (no build needed!)
npm start

# Or run TypeScript directly
node --experimental-strip-types src/index.ts

Tools

notify

Display a native macOS notification.

Input Schema:

{
  "title": "string (required)",
  "message": "string (required)",
  "subtitle": "string (optional)",
  "sound": "string (optional)",
  "group": "string (optional)"
}

Example:

{
  "title": "Build Complete",
  "message": "Your project built successfully!",
  "subtitle": "No errors found",
  "sound": "Hero"
}

Output:

{
  "success": true,
  "message": "Notification sent successfully",
  "title": "Build Complete",
  "subtitle": "No errors found"
}

checkEnvironment

Verify the system supports notifications.

Input: None

Output:

{
  "environment": {
    "ok": true,
    "platform": "darwin",
    "hasOsascript": true,
    "notes": "Environment is ready for notifications"
  },
  "recommendations": [
    "Your system is ready to send notifications"
  ]
}

Integration

Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "macos-notify": {
      "command": "nix",
      "args": ["run", "/path/to/macos-mcp#default"]
    }
  }
}

For development (local directory):

{
  "mcpServers": {
    "macos-notify": {
      "command": "nix",
      "args": ["run", "."]
    }
  }
}

MCP Inspector

Test the server interactively:

# Install mcp-inspector
npm install -g @modelcontextprotocol/inspector

# Run with Nix
npx @modelcontextprotocol/inspector nix run /path/to/macos-mcp#default

# Or from local directory
npx @modelcontextprotocol/inspector nix run .

Configuration

Environment Variables

  • NOTIFY_MAX_PER_10S: Maximum notifications per 10-second window (default: 5)

Rate Limiting

The server implements in-memory rate limiting to prevent notification spam:

  • Default: 5 notifications per 10 seconds

  • Configurable via NOTIFY_MAX_PER_10S environment variable

  • Exceeding limits returns structured error responses

Development

Commands

npm run dev          # Run in watch mode
npm start           # Run the server directly
npm test            # Run tests
npm run test:run    # Run tests once
npm run typecheck   # Type checking (no emission)
npm run lint        # Run ESLint

Project Structure

src/
β”œβ”€β”€ index.ts              # CLI entrypoint (executable with Node 24)
β”œβ”€β”€ server.ts             # MCP server implementation
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ applescript.ts    # AppleScript utilities & escaping
β”‚   β”œβ”€β”€ clipboard.ts      # Clipboard operations
β”‚   β”œβ”€β”€ notification.ts   # NotificationService with Effect
β”‚   └── layer.ts          # Effect layers
β”œβ”€β”€ tools/
β”‚   β”œβ”€β”€ notify.ts         # Notify tool handler
β”‚   β”œβ”€β”€ check-env.ts      # Environment check tool
β”‚   └── clipboard/        # Clipboard tool handlers
β”œβ”€β”€ schemas/
β”‚   β”œβ”€β”€ notify.ts         # Notification schemas
β”‚   └── clipboard.ts      # Clipboard schemas
└── __tests__/
    β”œβ”€β”€ applescript.test.ts  # AppleScript escaping tests
    β”œβ”€β”€ clipboard.test.ts    # Clipboard tests
    └── tools.test.ts        # Tool integration tests

Testing

The project includes comprehensive tests:

  • Unit tests: AppleScript string escaping with edge cases

  • Integration tests: MCP tool handlers with mocked services

  • Manual testing: Instructions for mcp-inspector and Claude Desktop

npm test    # Run all tests with Vitest

Nix Development

Build System

This project uses Nix flakes with Node.js 24's native TypeScript support:

  • Node version: 24 (with --experimental-strip-types support)

  • No build step: TypeScript runs directly without transpilation

  • Simple packaging: Direct execution of source files

Available Nix Commands

nix develop          # Enter development shell
nix build           # Build the package
nix run             # Run the server
nix flake check     # Validate the flake

Development Shell

The nix develop shell provides:

  • Node.js 24 with native TypeScript support

  • TypeScript language server for IDE support

  • Development utilities (jq)

  • All required development dependencies

Security & Safety

AppleScript Injection Prevention

The server implements robust AppleScript string escaping:

  • Escapes double quotes (" β†’ \")

  • Escapes backslashes (\ β†’ \\)

  • Handles newlines and tabs safely

  • Uses execFile instead of exec for subprocess safety

Error Handling

All operations use Effect TS for structured error handling:

  • Type-safe error propagation

  • Resource cleanup guarantees

  • Graceful degradation on unsupported platforms

Troubleshooting

Common Issues

"Notifications are only supported on macOS"

  • This server only works on macOS systems

  • Other platforms will receive structured error responses

"osascript command not found"

  • Ensure you're on macOS with Command Line Tools installed

  • Run: xcode-select --install

"Rate limit exceeded"

  • Default limit: 5 notifications per 10 seconds

  • Adjust with NOTIFY_MAX_PER_10S environment variable

  • Wait for the rate limit window to reset

Notifications attributed to "osascript"

  • This is normal macOS behavior

  • You may need to allow notifications for Terminal or your MCP client

  • Go to System Settings β†’ Notifications β†’ [Application]

Debugging

Enable verbose logging:

DEBUG=1 nix run .

Test notification manually:

echo '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"notify","arguments":{"title":"Test","message":"Hello World"}},"id":1}' | nix run .

License

MIT - see LICENSE file for details.

Contributing

  1. Ensure you have Nix with flakes enabled

  2. Run nix develop to enter the development environment

  3. Make your changes and add tests

  4. Run npm test to verify everything works

  5. Submit a pull request

Roadmap

  • Support for notification actions/buttons

  • Notification history and management

  • Custom notification icons

  • Integration with macOS Focus modes

  • Batch notification operations

Available Tools

5 tools
checkEnvironmentA

Check if the environment supports macOS notifications

Inputs: no named parameters.

clipboard.clearB

Clear the macOS clipboard

Inputs: no named parameters.

clipboard.copyA

Copy text to the macOS clipboard

Inputs: text (required).

clipboard.pasteA

Get current text from the macOS clipboard

Inputs: no named parameters.

notifyA

Display a macOS notification via AppleScript

Inputs: title (required), message (required), group, sound, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 5 tools

    Disambiguation4/5

    Each tool targets a distinct operation: notification display, environment capability check, and three separate clipboard actions. The only mild ambiguity is clipboard.paste, whose name suggests writing into an app but actually reads the clipboard; the description resolves this.

    Naming Consistency3/5

    Three conventions coexist: bare verbs (notify), camelCase (checkEnvironment), and dot-namespaced methods (clipboard.copy/paste/clear). The clipboard group is internally consistent, but the overall set mixes styles.

    Tool Count5/5

    Five tools is a tight, well-scoped surface for a notifications-plus-clipboard utility. Every tool maps to a concrete capability with no filler.

    Completeness4/5

    Clipboard coverage is complete (copy, read, clear), and notifications include a capability probe. Notification handling is thinβ€”no schedule, dismiss, or listβ€”but that is a minor gap agents can work around.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to send native macOS notifications for task completion alerts and reminders. Supports interactive features like custom system sounds, action buttons, and user replies directly from the notification center.
      201 npm
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables Large Language Models to automate macOS applications and execute AppleScript commands through natural language. It features built-in security protections including application allowlists and dangerous pattern detection to prevent unauthorized or risky system operations.
      2
      1
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to send desktop notifications on macOS with rich formatting, urgency levels, and sound options.
      1
      11 npm
      1
      MIT