@heznpc/imcp 0.9.0 → 1.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/README.ko.md +17 -2
- package/README.md +17 -2
- package/dist/calendar/scripts.js +11 -8
- package/dist/calendar/scripts.js.map +1 -1
- package/dist/finder/scripts.js +3 -3
- package/dist/finder/tools.js +3 -3
- package/dist/finder/tools.js.map +1 -1
- package/dist/index.js +186 -32
- package/dist/index.js.map +1 -1
- package/dist/mail/tools.js +2 -0
- package/dist/mail/tools.js.map +1 -1
- package/dist/messages/scripts.js +56 -19
- package/dist/messages/scripts.js.map +1 -1
- package/dist/messages/tools.d.ts +1 -1
- package/dist/messages/tools.js +6 -1
- package/dist/messages/tools.js.map +1 -1
- package/dist/shared/config.d.ts +23 -0
- package/dist/shared/config.js +111 -1
- package/dist/shared/config.js.map +1 -1
- package/dist/shared/hitl-guard.d.ts +8 -0
- package/dist/shared/hitl-guard.js +39 -0
- package/dist/shared/hitl-guard.js.map +1 -0
- package/dist/shared/hitl.d.ts +16 -0
- package/dist/shared/hitl.js +131 -0
- package/dist/shared/hitl.js.map +1 -0
- package/dist/shared/setup.d.ts +2 -1
- package/dist/shared/setup.js +22 -14
- package/dist/shared/setup.js.map +1 -1
- package/dist/shortcuts/prompts.d.ts +2 -0
- package/dist/shortcuts/prompts.js +148 -0
- package/dist/shortcuts/prompts.js.map +1 -0
- package/dist/system/scripts.js +4 -2
- package/dist/system/scripts.js.map +1 -1
- package/package.json +7 -4
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { userPrompt } from "../shared/prompt.js";
|
|
3
|
+
export function registerShortcutPrompts(server) {
|
|
4
|
+
server.prompt("shortcut-automation", {
|
|
5
|
+
goal: z.string().describe("The automation goal or workflow you want to achieve"),
|
|
6
|
+
input: z.string().optional().describe("Optional initial input data for the workflow"),
|
|
7
|
+
}, ({ goal, input }) => {
|
|
8
|
+
const inputCtx = input ? `\nInitial input data: "${input}"` : "";
|
|
9
|
+
return userPrompt("Guide for creating complex automation workflows by chaining multiple shortcuts.", `Build an automation workflow to achieve: "${goal}"${inputCtx}
|
|
10
|
+
|
|
11
|
+
Execute the following steps using iMcp tools:
|
|
12
|
+
|
|
13
|
+
1. **Discover available shortcuts**:
|
|
14
|
+
- list_shortcuts to get all available Siri Shortcuts on this Mac
|
|
15
|
+
- search_shortcuts with keywords related to "${goal}" to find relevant shortcuts
|
|
16
|
+
- For each promising match, use get_shortcut_detail to understand what it does and what actions it contains
|
|
17
|
+
|
|
18
|
+
2. **Analyze and plan the workflow**:
|
|
19
|
+
- Identify which shortcuts can be chained together to accomplish the goal
|
|
20
|
+
- Determine the execution order based on input/output dependencies
|
|
21
|
+
- Note which shortcuts accept text input and which produce output
|
|
22
|
+
- Identify any gaps where no existing shortcut covers a needed step
|
|
23
|
+
- Present the proposed workflow plan to me for confirmation
|
|
24
|
+
|
|
25
|
+
3. **Execute the workflow**:
|
|
26
|
+
- Run each shortcut in sequence using run_shortcut with the appropriate name and input
|
|
27
|
+
- Pass the output of one shortcut as the input to the next when chaining
|
|
28
|
+
- If a shortcut fails, report the error and suggest alternatives
|
|
29
|
+
- Track the output at each step for the final summary
|
|
30
|
+
|
|
31
|
+
4. **Report results**:
|
|
32
|
+
- Show the output from each step in the chain
|
|
33
|
+
- Highlight any steps that produced unexpected results
|
|
34
|
+
- Suggest improvements or additional shortcuts that could enhance the workflow
|
|
35
|
+
- If a step failed, explain what went wrong and possible fixes
|
|
36
|
+
|
|
37
|
+
Important:
|
|
38
|
+
- Always use exact shortcut names from list_shortcuts or search_shortcuts — names must match exactly
|
|
39
|
+
- Some shortcuts may trigger UI prompts or require user interaction — warn me before running those
|
|
40
|
+
- Never assume a shortcut exists; always verify with search_shortcuts first
|
|
41
|
+
- Ask for confirmation before running shortcuts that perform destructive or irreversible actions`);
|
|
42
|
+
});
|
|
43
|
+
server.prompt("shortcut-discovery", {
|
|
44
|
+
category: z.string().optional().describe("Optional category or keyword to focus the discovery (e.g. 'productivity', 'media', 'text')"),
|
|
45
|
+
}, ({ category }) => {
|
|
46
|
+
const filterCtx = category
|
|
47
|
+
? `Focus on shortcuts related to "${category}".`
|
|
48
|
+
: "Cover all available shortcuts.";
|
|
49
|
+
return userPrompt("Help users find, understand, and explore their available Siri Shortcuts.", `Help me discover and understand my available Siri Shortcuts. ${filterCtx}
|
|
50
|
+
|
|
51
|
+
Execute the following steps using iMcp tools:
|
|
52
|
+
|
|
53
|
+
1. **List all shortcuts**:
|
|
54
|
+
- list_shortcuts to get the complete list of Siri Shortcuts on this Mac
|
|
55
|
+
- Report the total count${category ? `\n - search_shortcuts(query: "${category}") to filter for the relevant category` : ""}
|
|
56
|
+
|
|
57
|
+
2. **Categorize shortcuts**:
|
|
58
|
+
- Group shortcuts by inferred purpose based on their names:
|
|
59
|
+
* Productivity (text processing, file operations, data conversion)
|
|
60
|
+
* Communication (messaging, email, sharing)
|
|
61
|
+
* Media (photos, music, video)
|
|
62
|
+
* System (settings, device control, automation)
|
|
63
|
+
* Developer (build, deploy, git, code)
|
|
64
|
+
* Custom/Other
|
|
65
|
+
- Present the categorized list clearly
|
|
66
|
+
|
|
67
|
+
3. **Deep-dive into interesting shortcuts**:
|
|
68
|
+
- For shortcuts with unclear names, use get_shortcut_detail to inspect their actions
|
|
69
|
+
- Identify which shortcuts accept input and what type
|
|
70
|
+
- Identify which shortcuts produce output
|
|
71
|
+
- Flag shortcuts that might interact with external services or perform system changes
|
|
72
|
+
|
|
73
|
+
4. **Provide recommendations**:
|
|
74
|
+
- Suggest useful shortcuts the user might not know they have
|
|
75
|
+
- Identify shortcuts that could be combined for powerful workflows
|
|
76
|
+
- Point out shortcuts that overlap in functionality
|
|
77
|
+
- Suggest common tasks that could be automated with the existing shortcuts
|
|
78
|
+
|
|
79
|
+
5. **Summary report**:
|
|
80
|
+
- Total shortcuts available
|
|
81
|
+
- Breakdown by category
|
|
82
|
+
- Top recommendations for daily use
|
|
83
|
+
- Potential workflow combinations
|
|
84
|
+
|
|
85
|
+
Important:
|
|
86
|
+
- Use get_shortcut_detail on shortcuts with ambiguous names to provide accurate descriptions
|
|
87
|
+
- Do not run any shortcuts during discovery — this is a read-only exploration
|
|
88
|
+
- If the list is very large, focus on the most useful categories first`);
|
|
89
|
+
});
|
|
90
|
+
server.prompt("shortcut-troubleshooting", {
|
|
91
|
+
shortcutName: z.string().describe("Name of the shortcut that is having issues"),
|
|
92
|
+
errorDescription: z.string().optional().describe("Description of the error or unexpected behavior"),
|
|
93
|
+
}, ({ shortcutName, errorDescription }) => {
|
|
94
|
+
const errorCtx = errorDescription
|
|
95
|
+
? `\nReported issue: "${errorDescription}"`
|
|
96
|
+
: "";
|
|
97
|
+
return userPrompt("Diagnose and fix shortcut execution issues.", `Troubleshoot the Siri Shortcut "${shortcutName}".${errorCtx}
|
|
98
|
+
|
|
99
|
+
Execute the following steps using iMcp tools:
|
|
100
|
+
|
|
101
|
+
1. **Verify the shortcut exists**:
|
|
102
|
+
- search_shortcuts(query: "${shortcutName}") to find the shortcut
|
|
103
|
+
- If not found, list_shortcuts to show all available shortcuts and suggest the closest match
|
|
104
|
+
- Confirm the exact name (names are case-sensitive and must match exactly)
|
|
105
|
+
|
|
106
|
+
2. **Inspect the shortcut**:
|
|
107
|
+
- get_shortcut_detail(name: "${shortcutName}") to examine its actions and structure
|
|
108
|
+
- Identify what the shortcut is designed to do
|
|
109
|
+
- Check what input it expects (if any)
|
|
110
|
+
- Identify actions that depend on external services, apps, or permissions
|
|
111
|
+
|
|
112
|
+
3. **Test execution**:
|
|
113
|
+
- run_shortcut(name: "${shortcutName}") with no input to test basic execution
|
|
114
|
+
- If the shortcut expects input, run_shortcut with a simple test input
|
|
115
|
+
- Capture and analyze any error messages from the output
|
|
116
|
+
|
|
117
|
+
4. **Diagnose the issue**:
|
|
118
|
+
Based on the inspection and test results, check for these common problems:
|
|
119
|
+
- **Name mismatch**: The name used doesn't exactly match the shortcut name
|
|
120
|
+
- **Missing input**: The shortcut requires input but none was provided
|
|
121
|
+
- **Wrong input type**: The shortcut expects a specific input format
|
|
122
|
+
- **Permission issues**: The shortcut needs permissions that haven't been granted
|
|
123
|
+
- **App dependency**: The shortcut relies on an app that isn't installed or available
|
|
124
|
+
- **Network dependency**: The shortcut needs internet access for an API or web request
|
|
125
|
+
- **UI interaction required**: The shortcut triggers a dialog that blocks automation
|
|
126
|
+
- **Timeout**: The shortcut takes too long to complete via CLI
|
|
127
|
+
|
|
128
|
+
5. **Provide solutions**:
|
|
129
|
+
- Explain the diagnosed root cause clearly
|
|
130
|
+
- Suggest specific fixes:
|
|
131
|
+
* Correct name to use with run_shortcut
|
|
132
|
+
* Required input format and example
|
|
133
|
+
* Permission steps to resolve access issues
|
|
134
|
+
* Alternative shortcuts that accomplish the same goal
|
|
135
|
+
- If the shortcut cannot be fixed via MCP, explain what manual steps are needed in the Shortcuts app
|
|
136
|
+
|
|
137
|
+
6. **Verification**:
|
|
138
|
+
- After applying fixes, re-run the shortcut to confirm it works
|
|
139
|
+
- Show the successful output
|
|
140
|
+
|
|
141
|
+
Important:
|
|
142
|
+
- Some shortcuts will trigger UI prompts — warn me before running them
|
|
143
|
+
- If a shortcut consistently fails, it may need to be edited in the Shortcuts app directly
|
|
144
|
+
- Report the exact error output for accurate diagnosis
|
|
145
|
+
- Do not modify or delete any shortcuts — only inspect and run them`);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/shortcuts/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACvD,MAAM,CAAC,MAAM,CACX,qBAAqB,EACrB;QACE,IAAI,EAAE,CA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AE,gBAAgB,EAAE,EAAE,EAAE;QACrC,MAAM,QAAQ,GAAG,gBAAgB;YAC/B,CAAC,CAAC,sBAAsB,gBAAgB,GAAG;YAC3C,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,UAAU,CACf,6CAA6C,EAC7C,mCAAmC,YAAY,KAAK,QAAQ;;;;;gCAKpC,YAAY;;;;;kCAKV,YAAY;;;;;;2BAMnB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oEAgC6B,CAC7D,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/system/scripts.js
CHANGED
|
@@ -4,8 +4,10 @@ export function getClipboardScript() {
|
|
|
4
4
|
return `
|
|
5
5
|
const app = Application.currentApplication();
|
|
6
6
|
app.includeStandardAdditions = true;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
let text;
|
|
8
|
+
try { text = app.theClipboard(); } catch(e) { text = ''; }
|
|
9
|
+
const content = (typeof text === 'object') ? JSON.stringify(text) : String(text);
|
|
10
|
+
JSON.stringify({content: content});
|
|
9
11
|
`;
|
|
10
12
|
}
|
|
11
13
|
export function setClipboardScript(text) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../src/system/scripts.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,UAAU,kBAAkB;IAChC,OAAO
|
|
1
|
+
{"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../src/system/scripts.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,UAAU,kBAAkB;IAChC,OAAO;;;;;;;GAON,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO;;;oBAGW,GAAG,CAAC,IA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ACnD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAe,EAAE,KAAc,EAAE,QAAiB,EAAE,KAAc;IACvG,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,QAAQ;QAAE,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnD,OAAO;;;+BAGsB,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;4CACrB,GAAG,CAAC,OAAO,CAAC;GACrD,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heznpc/imcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "MCP server for the entire Apple ecosystem — Notes, Reminders, Calendar, Contacts, Mail, Messages, Music, Finder, Safari, Photos, Shortcuts, System, and Apple Intelligence. Connect any AI to your Mac.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"author": "heznpc",
|
|
49
|
+
"mcpName": "io.github.heznpc/imcp",
|
|
49
50
|
"type": "module",
|
|
50
51
|
"main": "dist/index.js",
|
|
51
52
|
"types": "dist/index.d.ts",
|
|
@@ -67,17 +68,19 @@
|
|
|
67
68
|
"start": "node dist/index.js",
|
|
68
69
|
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
|
69
70
|
"typecheck": "tsc --noEmit",
|
|
70
|
-
"version:patch": "npm version patch --no-git-tag-version",
|
|
71
|
-
"version:minor": "npm version minor --no-git-tag-version",
|
|
72
|
-
"version:major": "npm version major --no-git-tag-version"
|
|
71
|
+
"version:patch": "npm version patch --no-git-tag-version && node -e \"let s=require('./server.json');s.version=s.packages[0].version=require('./package.json').version;require('fs').writeFileSync('server.json',JSON.stringify(s,null,2)+'\\n')\"",
|
|
72
|
+
"version:minor": "npm version minor --no-git-tag-version && node -e \"let s=require('./server.json');s.version=s.packages[0].version=require('./package.json').version;require('fs').writeFileSync('server.json',JSON.stringify(s,null,2)+'\\n')\"",
|
|
73
|
+
"version:major": "npm version major --no-git-tag-version && node -e \"let s=require('./server.json');s.version=s.packages[0].version=require('./package.json').version;require('fs').writeFileSync('server.json',JSON.stringify(s,null,2)+'\\n')\""
|
|
73
74
|
},
|
|
74
75
|
"dependencies": {
|
|
75
76
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
77
|
+
"express": "^5.2.1",
|
|
76
78
|
"zod": "^3.24.0"
|
|
77
79
|
},
|
|
78
80
|
"devDependencies": {
|
|
79
81
|
"@eslint/js": "^10.0.1",
|
|
80
82
|
"@jest/globals": "^29.7.0",
|
|
83
|
+
"@types/express": "^5.0.6",
|
|
81
84
|
"@types/node": "^22.0.0",
|
|
82
85
|
"eslint": "^10.0.3",
|
|
83
86
|
"globals": "^16.0.0",
|