MA

mediar-ai/mcp-server-macos-use

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

355 stars 42 forks 质量 67 趋势 33NOASSERTION

一个用操作系统级工具控制计算机、兼容MCP的AI代理,能支持任何模型

概览

官方网站:https://macos-use.dev/ Swift中的模型上下文协议(MCP)服务器。它通过利用无障碍API,主要通过MacosUseSDK来控制macOS应用程序。 你可以在Claude Desktop或其他兼容的MCP客户端中使用它。 服务器通过标准输入/输出(stdio)监听MCP命令,并暴露多个工具以与应用程序交互。 https://github.com/user-attachments/assets/cd203171-bac6-4124-9a58-59947a25be07 https://github.com/user-attachments/assets/f274560a-559f-4140-b133-c0b5c500a02d 服务器通过 CallTool MCP 方法暴露以下工具: 1. * 打开或激活指定的应用程序,然后遍历其可访问性树。* * 标识符(字符串,必需):应用程序名称、捆绑 ID 或文件路径。

概述(AI 翻译)

官方网站:https://macos-use.dev/

Swift 中的模型上下文协议(MCP)服务器。它通过利用无障碍 API,主要通过 MacosUseSDK 来控制 macOS 应用程序。

你可以在Claude Desktop或其他兼容的MCP客户端中使用它。

服务器通过标准输入/输出(stdio)监听MCP命令,并开放多个工具与应用程序交互。

https://github.com/user-attachments/assets/cd203171-bac6-4124-9a58-59947a25be07

https://github.com/user-attachments/assets/f274560a-559f-4140-b133-c0b5c500a02d

可用工具

服务器通过 CallTool MCP 方法暴露以下工具:

  1. macos-use_open_application_and_traverse
  • 描述: 打开或激活指定的应用程序,然后遍历其可访问性树。
  • 参数:
  • identifier(字符串,必需):应用程序名称、捆绑ID,或文件路径。
  1. macos-use_click_and_traverse
  • 描述: 模拟在目标应用窗口内的特定坐标点击(由PID标识),然后遍历其可访问树。
  • 参数:

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

mcp-server-macos-use

Official website: https://macos-use.dev/

Model Context Protocol (MCP) server in Swift. It allows controlling macOS applications by leveraging the accessibility APIs, primarily through the MacosUseSDK.

You can use it in Claude Desktop or other compatible MCP-client.

The server listens for MCP commands over standard input/output (stdio) and exposes several tools to interact with applications.

https://github.com/user-attachments/assets/cd203171-bac6-4124-9a58-59947a25be07

https://github.com/user-attachments/assets/f274560a-559f-4140-b133-c0b5c500a02d

Available Tools

The server exposes the following tools via the CallTool MCP method:

  1. macos-use_open_application_and_traverse

    • Description: Opens or activates a specified application and then traverses its accessibility tree.
    • Parameters:
      • identifier (String, Required): The application’s name, bundle ID, or file path.
  2. macos-use_click_and_traverse

    • Description: Simulates a mouse click at specific coordinates within the window of the target application (identified by PID) and then traverses its accessibility tree.
    • Parameters:
      • pid (Number, Required): The Process ID (PID) of the target application.
      • x (Number, Required): The X-coordinate for the click (relative to the window/screen, depending on SDK behavior).
      • y (Number, Required): The Y-coordinate for the click.
  3. macos-use_type_and_traverse

    • Description: Simulates typing text into the target application (identified by PID) and then traverses its accessibility tree.
    • Parameters:
      • pid (Number, Required): The Process ID (PID) of the target application.
      • text (String, Required): The text to be typed.
  4. macos-use_press_key_and_traverse

    • Description: Simulates pressing a specific keyboard key (e.g., ‘Enter’, ‘Tab’, ‘a’, ‘B’) with optional modifier keys held down, targeting the application specified by PID, and then traverses its accessibility tree.
    • Parameters:
      • pid (Number, Required): The Process ID (PID) of the target application.
      • keyName (String, Required): The name of the key (e.g., Return, Escape, ArrowUp, Delete, a, B). Case-sensitive for letters if no modifiers are active.
      • modifierFlags (Array, Optional): An array of modifier keys to hold during the press. Valid values: CapsLock (or Caps), Shift, Control (or Ctrl), Option (or Opt, Alt), Command (or Cmd), Function (or Fn), NumericPad (or Numpad), Help.
  5. macos-use_refresh_traversal

    • Description: Only performs the accessibility tree traversal for the specified application (identified by PID). Useful for getting the current UI state without performing an action.
    • Parameters:
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "mcp-server-macos-use": { "command": "/path/to/your/project/mcp-server-macos-use/.build/debug/mcp-server-macos-use" } } }