mcp-server-macos-use 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,37 @@
1
+ Business Source License 1.1
2
+
3
+ TERMS
4
+
5
+ The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
6
+
7
+ Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
8
+
9
+ If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
10
+
11
+ All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
12
+
13
+ You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
14
+
15
+ Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
16
+
17
+ This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License).
18
+
19
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
20
+
21
+ MariaDB hereby grants you permission to use this License's text to license your works, and to refer to it using the trademark "Business Source License", as long as you comply with the Covenants of Licensor below.
22
+
23
+ COVENANTS OF LICENSOR
24
+
25
+ In consideration of the right to use this License's text and the "Business Source License" name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
26
+
27
+ 1. To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where "compatible" means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation.
28
+ 2. To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text "None".
29
+ 3. Not to modify this License in any other way.
30
+
31
+ -------------------------
32
+
33
+ Licensed Work: screenpipe Computer Agent
34
+ Licensor: Mediar, Inc.
35
+ Additional Use Grant: Production use is permitted for non-commercial, educational purposes only
36
+ Change Date: April 9, 2028
37
+ Change License: MIT License
@@ -0,0 +1,86 @@
1
+ {
2
+ "pins" : [
3
+ {
4
+ "identity" : "eventsource",
5
+ "kind" : "remoteSourceControl",
6
+ "location" : "https://github.com/mattt/eventsource.git",
7
+ "state" : {
8
+ "revision" : "07957602bb99a5355c810187e66e6ce378a1057d",
9
+ "version" : "1.1.1"
10
+ }
11
+ },
12
+ {
13
+ "identity" : "macosusesdk",
14
+ "kind" : "remoteSourceControl",
15
+ "location" : "https://github.com/mediar-ai/MacosUseSDK.git",
16
+ "state" : {
17
+ "branch" : "main",
18
+ "revision" : "5d810b557dc73f8fb930767671b0cfcd989a23e7"
19
+ }
20
+ },
21
+ {
22
+ "identity" : "swift-async-algorithms",
23
+ "kind" : "remoteSourceControl",
24
+ "location" : "https://github.com/apple/swift-async-algorithms.git",
25
+ "state" : {
26
+ "revision" : "2971dd5d9f6e0515664b01044826bcea16e59fac",
27
+ "version" : "1.1.2"
28
+ }
29
+ },
30
+ {
31
+ "identity" : "swift-atomics",
32
+ "kind" : "remoteSourceControl",
33
+ "location" : "https://github.com/apple/swift-atomics.git",
34
+ "state" : {
35
+ "revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7",
36
+ "version" : "1.3.0"
37
+ }
38
+ },
39
+ {
40
+ "identity" : "swift-collections",
41
+ "kind" : "remoteSourceControl",
42
+ "location" : "https://github.com/apple/swift-collections.git",
43
+ "state" : {
44
+ "revision" : "7b847a3b7008b2dc2f47ca3110d8c782fb2e5c7e",
45
+ "version" : "1.3.0"
46
+ }
47
+ },
48
+ {
49
+ "identity" : "swift-log",
50
+ "kind" : "remoteSourceControl",
51
+ "location" : "https://github.com/apple/swift-log.git",
52
+ "state" : {
53
+ "revision" : "ce592ae52f982c847a4efc0dd881cc9eb32d29f2",
54
+ "version" : "1.6.4"
55
+ }
56
+ },
57
+ {
58
+ "identity" : "swift-nio",
59
+ "kind" : "remoteSourceControl",
60
+ "location" : "https://github.com/apple/swift-nio.git",
61
+ "state" : {
62
+ "revision" : "e932d3c4d8f77433c8f7093b5ebcbf91463948a0",
63
+ "version" : "2.95.0"
64
+ }
65
+ },
66
+ {
67
+ "identity" : "swift-sdk",
68
+ "kind" : "remoteSourceControl",
69
+ "location" : "https://github.com/modelcontextprotocol/swift-sdk.git",
70
+ "state" : {
71
+ "revision" : "6112a3995a992d159ad0e82c2d62a008ce932666",
72
+ "version" : "0.11.0"
73
+ }
74
+ },
75
+ {
76
+ "identity" : "swift-system",
77
+ "kind" : "remoteSourceControl",
78
+ "location" : "https://github.com/apple/swift-system.git",
79
+ "state" : {
80
+ "revision" : "890830fff1a577dc83134890c7984020c5f6b43b",
81
+ "version" : "1.6.2"
82
+ }
83
+ }
84
+ ],
85
+ "version" : 2
86
+ }
package/Package.swift ADDED
@@ -0,0 +1,26 @@
1
+ // swift-tools-version: 5.9
2
+ // The swift-tools-version declares the minimum version of Swift required to build this package.
3
+
4
+ import PackageDescription
5
+
6
+ let package = Package(
7
+ name: "mcp-server-macos-use",
8
+ platforms: [
9
+ .macOS(.v13)
10
+ ],
11
+ dependencies: [
12
+ .package(url: "https://github.com/modelcontextprotocol/swift-sdk.git", from: "0.11.0"),
13
+ .package(url: "https://github.com/mediar-ai/MacosUseSDK.git", branch: "main")
14
+ ],
15
+ targets: [
16
+ // Targets are the basic building blocks of a package, defining a module or a test suite.
17
+ // Targets can depend on other targets in this package and products from dependencies.
18
+ .executableTarget(
19
+ name: "mcp-server-macos-use",
20
+ dependencies: [
21
+ .product(name: "MCP", package: "swift-sdk"),
22
+ .product(name: "MacosUseSDK", package: "MacosUseSDK")
23
+ ]
24
+ ),
25
+ ]
26
+ )
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # mcp-server-macos-use
2
+
3
+ Model Context Protocol (MCP) server in Swift. It allows controlling macOS applications by leveraging the accessibility APIs, primarily through the `MacosUseSDK`.
4
+
5
+ You can use it in Claude Desktop or other compatible MCP-client.
6
+
7
+ The server listens for MCP commands over standard input/output (`stdio`) and exposes several tools to interact with applications.
8
+
9
+
10
+ https://github.com/user-attachments/assets/b43622a3-3d20-4026-b02f-e9add06afe2b
11
+
12
+ ## Available Tools
13
+
14
+ The server exposes the following tools via the `CallTool` MCP method:
15
+
16
+ 1. **`macos-use_open_application_and_traverse`**
17
+ * **Description:** Opens or activates a specified application and then traverses its accessibility tree.
18
+ * **Parameters:**
19
+ * `identifier` (String, Required): The application's name, bundle ID, or file path.
20
+
21
+ 2. **`macos-use_click_and_traverse`**
22
+ * **Description:** Simulates a mouse click at specific coordinates within the window of the target application (identified by PID) and then traverses its accessibility tree.
23
+ * **Parameters:**
24
+ * `pid` (Number, Required): The Process ID (PID) of the target application.
25
+ * `x` (Number, Required): The X-coordinate for the click (relative to the window/screen, depending on SDK behavior).
26
+ * `y` (Number, Required): The Y-coordinate for the click.
27
+
28
+ 3. **`macos-use_type_and_traverse`**
29
+ * **Description:** Simulates typing text into the target application (identified by PID) and then traverses its accessibility tree.
30
+ * **Parameters:**
31
+ * `pid` (Number, Required): The Process ID (PID) of the target application.
32
+ * `text` (String, Required): The text to be typed.
33
+
34
+ 4. **`macos-use_press_key_and_traverse`**
35
+ * **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.
36
+ * **Parameters:**
37
+ * `pid` (Number, Required): The Process ID (PID) of the target application.
38
+ * `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.
39
+ * `modifierFlags` (Array<String>, 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`.
40
+
41
+ 5. **`macos-use_refresh_traversal`**
42
+ * **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.
43
+ * **Parameters:**
44
+ * `pid` (Number, Required): The Process ID (PID) of the application to traverse.
45
+
46
+ **Common Optional Parameters (for `CallTool`)**
47
+
48
+ These can potentially be passed in the `arguments` object for any tool call to override default `MacosUseSDK` behavior (refer to `ActionOptions` in the code):
49
+
50
+ * `traverseBefore` (Boolean, Optional): Traverse accessibility tree before the primary action.
51
+ * `traverseAfter` (Boolean, Optional): Traverse accessibility tree after the primary action (usually defaults to true).
52
+ * `showDiff` (Boolean, Optional): Include a diff between traversals (if applicable).
53
+ * `onlyVisibleElements` (Boolean, Optional): Limit traversal to visible elements.
54
+ * `showAnimation` (Boolean, Optional): Show visual feedback animation for actions.
55
+ * `animationDuration` (Number, Optional): Duration of the feedback animation.
56
+ * `delayAfterAction` (Number, Optional): Add a delay after performing the action.
57
+
58
+ ## Dependencies
59
+
60
+ * `MacosUseSDK` (Assumed local or external Swift package providing macOS control functionality)
61
+
62
+ ## Building and Running
63
+
64
+ ```bash
65
+ # Example build command (adjust as needed, use 'debug' for development)
66
+ swift build -c debug # Or 'release' for production
67
+
68
+ # Running the server (it communicates via stdin/stdout)
69
+ ./.build/debug/mcp-server-macos-use
70
+ ```
71
+
72
+ **Integrating with Clients (Example: Claude Desktop)**
73
+
74
+ Once built, you need to tell your client application where to find the server executable. For example, to configure Claude Desktop, you might add the following to its configuration:
75
+
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "mcp-server-macos-use": {
80
+ "command": "/path/to/your/project/mcp-server-macos-use/.build/debug/mcp-server-macos-use"
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ *Replace `/path/to/your/project/` with the actual absolute path to your `mcp-server-macos-use` directory.*
87
+
88
+ ## Help
89
+
90
+ Reach out to matt@mediar.ai
91
+ Discord: m13v_
92
+
93
+
94
+ ## Plans
95
+
96
+ Happy to tailor the server for your needs, feel free to open an issue or reach out