Skip to main content
Glama
applescript-mcp

applescript-mcp

applescript-mcp MCP サーバー

LLMアプリケーションがAppleScriptを介してmacOSと連携できるようにするモデルコンテキストプロトコル(CMP)サーバー。このサーバーは、AIアプリケーションがシステム機能の制御、ファイルの管理、通知の処理などを行うための標準化されたインターフェースを提供します。

Node.js CI

特徴

  • 🗓️ カレンダー管理(イベント、リマインダー)

  • 📋 クリップボード操作

  • 🔍 Finder との統合

  • 🔔 システム通知

  • ⚙️ システムコントロール(音量、ダークモード、アプリ)

  • 📟 iTerm ターミナル統合

  • 📬 メール(新しいメールの作成、メールの一覧表示、メールの取得)

  • 🔄ショートカットの自動化

  • 💬 メッセージ(チャットの一覧表示、メッセージの取得、メッセージの検索、メッセージの送信)

  • 🗒️ メモ(フォーマットされたメモの作成、メモの一覧表示、メモの検索)

  • 📄 Pages(ドキュメントの作成)

計画されている機能

  • 🧭 Safari(Safariで開く、ページコンテンツを保存、選択したページ/タブを取得する)

  • ✅ リマインダー(作成、取得)

Related MCP server: MCP AppleScript

前提条件

  • macOS 10.15以降

  • Node.js 18以降

利用可能なカテゴリ

カレンダー

指示

説明

パラメータ

add

カレンダーイベントを作成

title 、 startDate 、 endDate 、 calendar (オプション)

list

今日のイベントを一覧表示する

なし

例

// Create a new calendar event
Create a calendar event titled "Team Meeting" starting tomorrow at 2pm for 1 hour

// List today's events
What events do I have scheduled for today?

クリップボード

指示

説明

パラメータ

set_clipboard

クリップボードにコピー

content

get_clipboard

クリップボードの内容を取得する

なし

clear_clipboard

クリップボードをクリア

なし

例

// Copy text to clipboard
Copy "Remember to buy groceries" to my clipboard

// Get clipboard contents
What's currently in my clipboard?

// Clear clipboard
Clear my clipboard

ファインダ

指示

説明

パラメータ

get_selected_files

選択したファイルを取得する

なし

search_files

ファイルを検索する

query 、 location (オプション)

quick_look

プレビューファイル

path

例

// Get selected files in Finder
What files do I currently have selected in Finder?

// Search for files
Find all PDF files in my Documents folder

// Preview a file
Show me a preview of ~/Documents/report.pdf

通知

注意: 通知を送信するには、システム設定 > 通知 > スクリプト エディターで通知を有効にする必要があります。

指示

説明

パラメータ

send_notification

通知を表示

title 、 message 、 sound (オプション)

toggle_do_not_disturb

DNDモードを切り替える

なし

例

// Send a notification
Send me a notification with the title "Reminder" and message "Time to take a break"

// Toggle Do Not Disturb
Turn on Do Not Disturb mode

システム

指示

説明

パラメータ

volume

システム音量を設定する

level (0~100)

get_frontmost_app

アクティブアプリを入手

なし

launch_app

アプリケーションを開く

name

quit_app

応募を締め切る

name 、 force (オプション)

toggle_dark_mode

ダークモードを切り替える

なし

例

// Set system volume
Set my Mac's volume to 50%

// Get active application
What app am I currently using?

// Launch an application
Open Safari

// Quit an application
Close Spotify

// Toggle dark mode
Switch to dark mode

iTerm

指示

説明

パラメータ

paste_clipboard

iTermに貼り付け

なし

run

コマンドを実行

command 、 newWindow (オプション)

例

// Paste clipboard to iTerm
Paste my clipboard contents into iTerm

// Run a command in iTerm
Run "ls -la" in iTerm

// Run a command in a new iTerm window
Run "top" in a new iTerm window

ショートカット

指示

説明

パラメータ

run_shortcut

ショートカットを実行する

name 、 input (オプション)

list_shortcuts

利用可能なショートカットをすべて一覧表示する

limit (オプション)

例

// List available shortcuts
List all my available shortcuts

// List with limit
Show me my top 5 shortcuts

// Run a shortcut
Run my "Daily Note in Bear" shortcut

// Run a shortcut with input
Run my "Add to-do" shortcut with input "Buy groceries"

郵便

指示

説明

パラメータ

create_email

Mail.appで新しいメールを作成する

recipient 、 subject 、 body

list_emails

メールボックスからメールを一覧表示する

mailbox (オプション)、 count (オプション)、 unreadOnly (オプション)

get_email

検索で特定のメールを取得する

subject (オプション)、 sender (オプション)、 dateReceived (オプション)、 mailbox (オプション)、 account (オプション)、 unreadOnly (オプション)、 includeBody (オプション)

例

// Create a new email
Compose an email to john@example.com with subject "Meeting Tomorrow" and body "Hi John, Can we meet tomorrow at 2pm?"

// List emails
Show me my 10 most recent unread emails

// Get a specific email
Find the email from sarah@example.com about "Project Update"

メッセージ

指示

説明

パラメータ

list_chats

利用可能なiMessageとSMSチャットを一覧表示する

includeParticipantDetails (オプション、デフォルト: false)

get_messages

メッセージアプリからメッセージを受け取る

limit (オプション、デフォルト: 100)

search_messages

特定のテキストを含むメッセージを検索する

searchText 、 sender (オプション)、 chatId (オプション)、 limit (オプション、デフォルト:50)、 daysBack (オプション、デフォルト:30)

compose_message

事前に入力されたメッセージまたは自動送信でメッセージアプリを開きます

recipient (必須)、 body (オプション)、 auto (オプション、デフォルト:false)

例

// List available chats
Show me my recent message conversations

// Get recent messages
Show me my last 20 messages

// Search messages
Find messages containing "dinner plans" from John in the last week

// Compose a message
Send a message to 555-123-4567 saying "I'll be there in 10 minutes"

注記

指示

説明

パラメータ

create

マークダウンのようなフォーマットでメモを作成する

title 、 content 、 format (書式設定オプションはオプション)

createRawHtml

直接HTMLコンテンツを含むメモを作成する

title 、 html

list

オプションで特定のフォルダからメモを一覧表示します

folder (オプション)

get

タイトルで特定のメモを取得する

title 、 folder (オプション)

search

特定のテキストを含むメモを検索する

query 、 folder (オプション)、 limit (オプション、デフォルト:5)、 includeBody (オプション、デフォルト:true)

例

// Create a new note with markdown formatting
Create a note titled "Meeting Minutes" with content "# Discussion Points\n- Project timeline\n- Budget review\n- Next steps" and format headings and lists

// Create a note with HTML
Create a note titled "Formatted Report" with HTML content "<h1>Quarterly Report</h1><p>Sales increased by <strong>15%</strong></p>"

// List notes
Show me all my notes in the "Work" folder

// Get a specific note
Show me my note titled "Shopping List"

// Search notes
Find notes containing "recipe" in my "Cooking" folder

ページ

指示

説明

パラメータ

create_document

プレーンテキストで新しいPages文書を作成する

content

例

// Create a new Pages document
Create a Pages document with the content "Project Proposal\n\nThis document outlines the scope and timeline for the upcoming project."

建築

applescript-mcp サーバーは TypeScript を使用して構築されており、モジュール アーキテクチャに従います。

コアコンポーネント

  1. AppleScriptFramework ( framework.ts ): 次の機能を果たすメイン サーバー クラス:

    • MCPプロトコル通信を管理する

    • ツールの登録と実行を処理する

    • ログ機能を提供する

    • AppleScriptコマンドを実行する

  2. カテゴリ( src/categories/*.ts ): 機能別に整理されたモジュール式のスクリプト コレクション:

    • 各カテゴリには関連するスクリプト(カレンダー、システム、メモなど)が含まれています。

    • カテゴリはindex.tsでフレームワークに登録されます。

  3. 型( src/types/index.ts ): 以下を定義する TypeScript インターフェース:

    • ScriptDefinition : 個々のスクリプトの構造

    • ScriptCategory : 関連スクリプトのコレクション

    • LogLevel : 標準のログレベル

    • FrameworkOptions : 構成オプション

実行フロー

  1. クライアントはMCPプロトコル経由でツール要求を送信します

  2. サーバーは適切なカテゴリとスクリプトを識別します

  3. スクリプトコンテンツが生成される(静的または関数を介して動的)

  4. AppleScriptはmacOSのosascriptコマンドを介して実行されます

  5. 結果がクライアントに返されます

ログシステム

このフレームワークには、次のような包括的なログ システムが含まれています。

  • stderr と MCP ログプロトコルの両方にログを記録します。

  • 複数の重大度レベル (デバッグ、情報、警告、エラーなど) をサポートします

  • トラブルシューティングのための詳細な実行情報を提供します

発達

設定

# Install dependencies
npm install

# Build the server
npm run build

# Launch MCP Inspector
# See: https://modelcontextprotocol.io/docs/tools/inspector
npx @modelcontextprotocol/inspector node path/to/server/index.js args...

新しい機能の追加

1. カテゴリファイルを作成する

src/categories/newcategory.tsを作成します:

import { ScriptCategory } from "../types/index.js";

export const newCategory: ScriptCategory = {
  name: "category_name",
  description: "Category description",
  scripts: [
    // Scripts will go here
  ],
};

2. スクリプトを追加する

{
  name: "script_name",
  description: "What the script does",
  schema: {
    type: "object",
    properties: {
      paramName: {
        type: "string",
        description: "Parameter description"
      }
    },
    required: ["paramName"]
  },
  script: (args) => `
    tell application "App"
      // AppleScript code using ${args.paramName}
    end tell
  `
}

3. 登録カテゴリー

src/index.tsを更新します:

import { newCategory } from "./categories/newcategory.js";
// ...
server.addCategory(newCategory);

高度なスクリプト開発

より複雑なスクリプトの場合は、次のことが可能です。

  1. 動的スクリプト生成を使用する:

    script: (args) => {
      // Process arguments and build script dynamically
      let scriptContent = `tell application "App"\n`;
      
      if (args.condition) {
        scriptContent += `  // Conditional logic\n`;
      }
      
      scriptContent += `end tell`;
      return scriptContent;
    }
  2. 複雑なデータの処理:

    // Example from Notes category
    function generateNoteHtml(args: any): string {
      // Process markdown-like syntax into HTML
      let processedContent = content;
      
      if (format.headings) {
        processedContent = processedContent.replace(/^# (.+)$/gm, '<h1>$1</h1>');
        // ...
      }
      
      return processedContent;
    }

デバッグ

MCPインスペクターの使用

MCP Inspector は、サーバーのテストとデバッグのための Web インターフェイスを提供します。

npm run inspector

ログ記録

環境変数を設定してデバッグ ログを有効にします。

DEBUG=applescript-mcp* npm start

構成例

npm run buildを実行した後、 mcp.jsonファイルに以下を追加します。

{
  "mcpServers": {
    "applescript-mcp-server": {
      "command": "node",
      "args": ["/path/to/applescript-mcp/dist/index.js"]
    }
  }
}

よくある問題

  • 権限エラー: システム環境設定 > セキュリティとプライバシー > プライバシー > オートメーションを確認してください

  • スクリプトの失敗: 統合前にスクリプトエディタアプリで直接スクリプトをテストする

  • 通信の問題: stdio ストリームがリダイレクトされていないか確認してください

  • データベースアクセス: 一部の機能(メッセージなど)にはフルディスクアクセス権限が必要です

リソース

貢献

  1. リポジトリをフォークする

  2. 機能ブランチを作成する

  3. 変更をコミットする

  4. ブランチにプッシュする

  5. プルリクエストを作成する

ライセンス

MITライセンス - 詳細はライセンスを参照

Available Tools

33 tools
calendar_addC

[Calendar operations] Add a new event to Calendar

Inputs: title (required), startDate (required), endDate (required), calendar.

calendar_listB

[Calendar operations] List all events for today

Inputs: no named parameters.

clipboard_clear_clipboardC

[Clipboard management operations] Clear clipboard content

Inputs: no named parameters.

clipboard_get_clipboardB

[Clipboard management operations] Get current clipboard content

Inputs: type.

clipboard_set_clipboardC

[Clipboard management operations] Set clipboard content

Inputs: content (required).

finder_get_selected_filesB

[Finder and file operations] Get currently selected files in Finder

Inputs: no named parameters.

finder_quick_look_fileB

[Finder and file operations] Preview a file using Quick Look

Inputs: path (required).

finder_search_filesC

[Finder and file operations] Search for files by name

Inputs: query (required), location.

iterm_paste_clipboardB

[iTerm terminal operations] Paste clipboard content into iTerm

Inputs: no named parameters.

iterm_runC

[iTerm terminal operations] Run a command in iTerm

Inputs: command (required), newWindow.

mail_create_emailC

[Mail operations] Create a new email in Mail.app

Inputs: recipient (required), subject (required), body (required).

mail_get_emailC

[Mail operations] Get a specific email by search criteria from Mail.app

Inputs: mailbox, account, subject, sender, +3 more.

mail_list_emailsB

[Mail operations] List emails from a specified mailbox in Mail.app

Inputs: mailbox, account, count, unreadOnly.

messages_compose_messageC

[iMessage operations] Open Messages app with a pre-filled message to a recipient or automatically send a message

Inputs: recipient (required), body, auto.

messages_get_messagesC

[iMessage operations] Get messages from the Messages app

Inputs: limit.

messages_list_chatsC

[iMessage operations] List available iMessage and SMS chats

Inputs: includeParticipantDetails.

messages_search_messagesC

[iMessage operations] Search for messages containing specific text or from a specific sender

Inputs: searchText (required), sender, chatId, limit, +1 more.

notes_createC

[Apple Notes operations] Create a new note with optional formatting

Inputs: title (required), content (required), format.

notes_createRawHtmlC

[Apple Notes operations] Create a new note with direct HTML content

Inputs: title (required), html (required).

notes_getB

[Apple Notes operations] Get a specific note by title

Inputs: title (required), folder.

notes_listC

[Apple Notes operations] List all notes or notes in a specific folder

Inputs: folder.

notifications_send_notificationC

[Notification management] Send a system notification

Inputs: title (required), message (required), sound.

notifications_toggle_do_not_disturbB

[Notification management] Toggle Do Not Disturb mode using keyboard shortcut

Inputs: no named parameters.

pages_create_documentC

[Pages document operations] Create a new Pages document with plain text content (no formatting)

Inputs: content (required).

shortcuts_list_shortcutsC

[Shortcuts operations] List all available shortcuts with optional limit

Inputs: limit.

shortcuts_run_shortcutA

[Shortcuts operations] Run a shortcut with optional input. Uses Shortcuts Events to run in background without opening the app.

Inputs: name (required), input.

system_get_battery_statusB

[System control and information] Get battery level and charging status

Inputs: no named parameters.

system_get_frontmost_appB

[System control and information] Get the name of the frontmost application

Inputs: no named parameters.

system_launch_appC

[System control and information] Launch an application

Inputs: name (required).

system_quit_appC

[System control and information] Quit an application

Inputs: name (required), force.

system_toggle_dark_modeB

[System control and information] Toggle system dark mode

Inputs: no named parameters.

system_volumeC

[System control and information] Set system volume

Inputs: level (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 33 tools

    Disambiguation4/5

    Tools are well-organized into distinct domains (e.g., Calendar, Clipboard, Finder, Mail, Messages, Notes, Notifications, Pages, Shortcuts, System), with clear purposes within each domain. Minor potential confusion exists between 'notes_create' and 'notes_createRawHtml', which both create notes but with different content formats, but descriptions clarify the distinction.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern throughout (e.g., calendar_add, clipboard_get_clipboard, finder_search_files). All tools use snake_case consistently, with no deviations in naming conventions, making them predictable and easy to parse.

    Tool Count3/5

    With 33 tools, the count is borderline high for a single server, potentially overwhelming for agents. However, given the broad scope of automating various macOS applications and system functions, the number is reasonable but could benefit from more modular organization to reduce cognitive load.

    Completeness4/5

    The tool set provides comprehensive coverage across multiple macOS domains, with CRUD operations for key apps like Calendar, Mail, Messages, and Notes. Minor gaps exist, such as no update or delete tools for Calendar events or Pages documents, but agents can work around these with existing tools for most workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI agents to interact with macOS applications (Finder, Mail, Contacts, Reminders, Notes, Calendar, TextEdit) using AppleScript. Allows AI assistants to perform tasks like searching contacts, managing files, checking email, and creating reminders through natural language.
      24
      1
      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
      27 PyPI
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI to dynamically discover and control native macOS applications (like Finder, Mail, Safari) through AppleScript/JXA automation without pre-built integrations.
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude to automate macOS applications, manage files, control music, send messages, and more through AppleScript.
      29 npm
      1
      GPL 3.0