omnifocus-mcp-enhanced 1.6.9 → 1.6.11

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.
Files changed (78) hide show
  1. package/.github/workflows/ci.yml +21 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +262 -6
  4. package/README.zh.md +215 -2
  5. package/dist/server.js +2 -0
  6. package/dist/tools/definitions/addOmniFocusTask.js +1 -1
  7. package/dist/tools/definitions/addProject.js +1 -1
  8. package/dist/tools/definitions/batchAddItems.js +4 -4
  9. package/dist/tools/definitions/dumpDatabase.js +9 -1
  10. package/dist/tools/definitions/dumpDatabase.test.js +52 -2
  11. package/dist/tools/definitions/listTags.js +18 -0
  12. package/dist/tools/definitions/plannedDateSchemas.test.js +7 -0
  13. package/dist/tools/dumpDatabase.js +113 -108
  14. package/dist/tools/dumpDatabase.test.js +122 -0
  15. package/dist/tools/primitives/addOmniFocusTask.js +16 -11
  16. package/dist/tools/primitives/addOmniFocusTask.test.js +18 -0
  17. package/dist/tools/primitives/addProject.js +12 -7
  18. package/dist/tools/primitives/addProject.test.js +18 -0
  19. package/dist/tools/primitives/batchAddItems.js +21 -1
  20. package/dist/tools/primitives/batchAddItems.test.js +17 -0
  21. package/dist/tools/primitives/editItem.js +26 -22
  22. package/dist/tools/primitives/editItem.test.js +32 -0
  23. package/dist/tools/primitives/getForecastTasks.js +30 -9
  24. package/dist/tools/primitives/getForecastTasks.test.js +67 -0
  25. package/dist/tools/primitives/listTags.js +33 -0
  26. package/dist/tools/primitives/listTags.test.js +46 -0
  27. package/dist/tools/primitives/readTaskAttachment.js +17 -1
  28. package/dist/tools/primitives/readTaskAttachment.test.js +17 -0
  29. package/dist/tools/primitives/removeItem.js +8 -4
  30. package/dist/utils/appleScriptJson.js +27 -0
  31. package/dist/utils/appleScriptString.js +15 -0
  32. package/dist/utils/appleScriptString.test.js +11 -0
  33. package/dist/utils/omnifocusScripts/forecastTasks.js +16 -21
  34. package/dist/utils/omnifocusScripts/listTags.js +22 -0
  35. package/dist/utils/omnifocusScripts/omnifocusDump.js +22 -0
  36. package/dist/utils/sanitize.js +45 -0
  37. package/dist/utils/scriptExecution.js +54 -48
  38. package/dist/utils/scriptExecution.test.js +9 -0
  39. package/docs/plans/2026-07-24-maintenance-releases-design.md +43 -0
  40. package/docs/roadmap/2026-02-25-batch-move-tasks-plan.md +157 -18
  41. package/docs/roadmap/2026-02-25-batch-move-tasks-plan.zh.md +156 -17
  42. package/package.json +4 -4
  43. package/src/omnifocustypes.ts +2 -0
  44. package/src/server.ts +8 -0
  45. package/src/tools/definitions/addOmniFocusTask.ts +1 -1
  46. package/src/tools/definitions/addProject.ts +1 -1
  47. package/src/tools/definitions/batchAddItems.ts +4 -4
  48. package/src/tools/definitions/dumpDatabase.test.ts +58 -2
  49. package/src/tools/definitions/dumpDatabase.ts +10 -1
  50. package/src/tools/definitions/listTags.ts +21 -0
  51. package/src/tools/definitions/plannedDateSchemas.test.ts +9 -0
  52. package/src/tools/dumpDatabase.test.ts +128 -0
  53. package/src/tools/dumpDatabase.ts +124 -117
  54. package/src/tools/primitives/addOmniFocusTask.test.ts +22 -0
  55. package/src/tools/primitives/addOmniFocusTask.ts +16 -11
  56. package/src/tools/primitives/addProject.test.ts +22 -0
  57. package/src/tools/primitives/addProject.ts +12 -7
  58. package/src/tools/primitives/batchAddItems.test.ts +22 -0
  59. package/src/tools/primitives/batchAddItems.ts +27 -2
  60. package/src/tools/primitives/editItem.test.ts +38 -0
  61. package/src/tools/primitives/editItem.ts +26 -22
  62. package/src/tools/primitives/getForecastTasks.test.ts +78 -0
  63. package/src/tools/primitives/getForecastTasks.ts +35 -11
  64. package/src/tools/primitives/listTags.test.ts +66 -0
  65. package/src/tools/primitives/listTags.ts +55 -0
  66. package/src/tools/primitives/readTaskAttachment.test.ts +36 -0
  67. package/src/tools/primitives/readTaskAttachment.ts +25 -1
  68. package/src/tools/primitives/removeItem.ts +9 -5
  69. package/src/types.ts +2 -0
  70. package/src/utils/appleScriptJson.ts +27 -0
  71. package/src/utils/appleScriptString.test.ts +15 -0
  72. package/src/utils/appleScriptString.ts +15 -0
  73. package/src/utils/omnifocusScripts/forecastTasks.js +16 -21
  74. package/src/utils/omnifocusScripts/listTags.js +22 -0
  75. package/src/utils/omnifocusScripts/omnifocusDump.js +22 -0
  76. package/src/utils/sanitize.ts +46 -0
  77. package/src/utils/scriptExecution.test.ts +18 -0
  78. package/src/utils/scriptExecution.ts +66 -56
@@ -0,0 +1,21 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: macos-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version: 20
19
+ cache: npm
20
+ - run: npm ci
21
+ - run: npm test
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 jqlts1
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -13,10 +13,38 @@
13
13
  <img width="380" height="200" src="https://glama.ai/mcp/servers/@jqlts1/omnifocus-mcp-enhanced/badge" alt="OmniFocus Enhanced MCP server" />
14
14
  </a>
15
15
 
16
- Enhanced Model Context Protocol (MCP) server for OmniFocus featuring **native custom perspective access**, hierarchical task display, AI-optimized tool selection, and comprehensive task management. Perfect integration with Claude AI for intelligent workflows.
16
+ Enhanced Model Context Protocol (MCP) server for OmniFocus featuring **native custom perspective access**, hierarchical task display, AI-optimized tool selection, and comprehensive task management.
17
+
18
+ In plain English: this lets your AI assistant read your OmniFocus data, create tasks/projects, organize subtasks, review perspectives, and help you plan work without you manually jumping between apps.
19
+
20
+ ## 🌠 Why This Project Exists
21
+
22
+ OmniFocus is already powerful, but it is still mostly a tool you drive by hand.
23
+
24
+ The bigger idea behind this project is simple:
25
+
26
+ - less clicking, more conversation
27
+ - less manual cleanup, more AI-assisted planning
28
+ - less tool memorization, more natural task management
29
+
30
+ The goal is not just to expose more OmniFocus commands.
31
+ The goal is to let you work with OmniFocus like this:
32
+
33
+ ```text
34
+ Plan my day.
35
+ Clean up my Inbox.
36
+ Turn these notes into a project.
37
+ Show me what is blocked.
38
+ Reorganize these tasks safely.
39
+ ```
40
+
41
+ If that feels natural, this MCP server is doing its job.
42
+
43
+ Want to see where the project is heading next? See the [roadmap](docs/roadmap/2026-02-25-batch-move-tasks-plan.md).
17
44
 
18
45
  ## 🆕 Latest Release
19
46
 
47
+ - **v1.6.10** - Fixed Inbox task completion via `edit_item`, fixed AppleScript special-character handling for apostrophes/backslashes, fixed JSON result escaping for special characters, and clarified `batch_add_items` / `mcporter` usage with working examples.
20
48
  - **v1.6.9** - Added task attachment support: `get_task_by_id` now lists attachment metadata, `dump_database` exports attachment/link metadata, and new `read_task_attachment` returns image attachments as MCP image content when possible.
21
49
  - **v1.6.8** - Added stable task move support via `move_task` and `edit_item` (`newProjectId/newProjectName/newParentTaskId/newParentTaskName/moveToInbox`) with duplicate-name protection and cycle-prevention checks.
22
50
  - **v1.6.6** - Added full Planned Date support (create/edit/read/filter/sort/export), including `plannedDate`/`newPlannedDate` and updated task displays.
@@ -43,14 +71,15 @@ Enhanced Model Context Protocol (MCP) server for OmniFocus featuring **native cu
43
71
 
44
72
  ## 📦 Installation
45
73
 
46
- ### Quick Install (Recommended)
74
+ ### Claude Code
47
75
 
76
+ #### Quick Install (recommended)
48
77
  ```bash
49
78
  # One-line installation
50
79
  claude mcp add omnifocus-enhanced -- npx -y omnifocus-mcp-enhanced
51
80
  ```
52
81
 
53
- ### Alternative Installation Methods
82
+ #### Alternative methods for Claude Code:
54
83
 
55
84
  ```bash
56
85
  # Upgrade to latest
@@ -67,13 +96,137 @@ npm install && npm run build
67
96
  claude mcp add omnifocus-enhanced -- node "/path/to/omnifocus-mcp-enhanced/dist/server.js"
68
97
  ```
69
98
 
99
+ ### Claude Desktop / Cowork
100
+
101
+ Add the server to `~/Library/Application Support/Claude/claude_desktop_config.json`:
102
+
103
+ ```json
104
+ {
105
+ "mcpServers": {
106
+ "omnifocus-enhanced": {
107
+ "command": "npx",
108
+ "args": ["-y", "omnifocus-mcp-enhanced"]
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ For a local clone, use:
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "omnifocus-enhanced": {
120
+ "command": "node",
121
+ "args": ["/path/to/omnifocus-mcp-enhanced/dist/server.js"]
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ Restart Claude Desktop after editing the config file.
128
+
129
+ ### Using Both Claude Code and Claude Desktop / Cowork
130
+
131
+ Claude Code and Claude Desktop read separate configurations. If you want to use this MCP server from both, you need to install it in both places — run `claude mcp add` for Claude Code **and** add the entry to `claude_desktop_config.json` for Claude Desktop / Cowork.
132
+
70
133
  ## 📋 Requirements
71
134
 
72
135
  - **macOS 10.15+** - OmniFocus is macOS-only
73
136
  - **OmniFocus 3+** - The application must be installed and running
74
137
  - **OmniFocus Pro** - Required for custom perspectives (new features in v1.6.0)
75
138
  - **Node.js 18+** - For running the MCP server
76
- - **Claude Code** - For MCP integration
139
+ - **Any MCP-capable client** - Claude Code, `mcporter`, or another MCP host
140
+
141
+ ## 🚦 Start Here
142
+
143
+ If you only want the fastest way to understand this project, remember this:
144
+
145
+ 1. Connect the MCP server to your AI client.
146
+ 2. Talk to the AI naturally.
147
+ 3. Let it read, plan, create, move, or update your OmniFocus tasks for you.
148
+
149
+ You do not need to memorize all tool names first.
150
+
151
+ ## 🙋 What This Is Good For
152
+
153
+ - **Daily planning**: ask your AI what is due today, what is flagged, and what you can finish in 30 minutes.
154
+ - **Project setup**: give the AI a rough goal, then let it create a project and break it into subtasks.
155
+ - **Inbox cleanup**: ask it to review Inbox tasks and sort them into next actions, projects, or someday/later buckets.
156
+ - **Perspective reviews**: ask it to open one of your custom perspectives and summarize what matters.
157
+ - **Batch capture**: paste meeting notes or a brainstorm list and let the AI create multiple tasks at once.
158
+ - **Attachment-aware review**: let the AI inspect task attachments only when needed.
159
+
160
+ ## 💬 Example AI Conversations
161
+
162
+ These work well in Claude Code or any MCP client that can call the same tools.
163
+
164
+ ### 1. Daily Planning
165
+
166
+ Try saying:
167
+
168
+ ```text
169
+ Check my Forecast and flagged tasks, then tell me the 3 most important things to do today.
170
+ Prefer tasks that take under 60 minutes first.
171
+ ```
172
+
173
+ ### 2. Inbox Cleanup
174
+
175
+ Try saying:
176
+
177
+ ```text
178
+ Review my Inbox and group the tasks into:
179
+ 1. do today
180
+ 2. schedule later
181
+ 3. turn into projects
182
+ Then help me clean up the obvious ones.
183
+ ```
184
+
185
+ ### 3. Turn an Idea Into a Project
186
+
187
+ Try saying:
188
+
189
+ ```text
190
+ Create a project called "Launch spring newsletter".
191
+ Add the main subtasks, estimated minutes, and mark the most important step as flagged.
192
+ ```
193
+
194
+ ### 4. Use a Custom Perspective
195
+
196
+ Try saying:
197
+
198
+ ```text
199
+ Open my custom perspective "今日工作安排" and summarize:
200
+ - what is due soon
201
+ - what looks blocked
202
+ - what I can finish quickly
203
+ ```
204
+
205
+ ### 5. Batch Add From Notes
206
+
207
+ Try saying:
208
+
209
+ ```text
210
+ Turn these meeting notes into OmniFocus tasks under the project "Website Refresh".
211
+ Use subtasks where it makes sense and keep the task names short.
212
+ ```
213
+
214
+ ### 6. Review Attachments Only When Needed
215
+
216
+ Try saying:
217
+
218
+ ```text
219
+ Find the task called "Review design draft".
220
+ Show me what attachments it has first.
221
+ Only open the image attachment if there is one.
222
+ ```
223
+
224
+ ## 🧭 Practical Usage Tips
225
+
226
+ - Ask the AI to **look first, then change things** if you want safer workflows.
227
+ - Use **task IDs** when you have duplicate task names.
228
+ - For **subtasks**, let the parent task determine the project. Do not also pass `projectName`.
229
+ - For `mcporter`, complex arrays are much more reliable with `--args '{...}'`.
77
230
 
78
231
  ## 🎯 Core Capabilities
79
232
 
@@ -217,6 +370,101 @@ Efficiently manage multiple tasks:
217
370
  }
218
371
  ```
219
372
 
373
+ CLI tip for `mcporter`:
374
+
375
+ ```bash
376
+ # Prefer explicit JSON args for complex arrays / nested objects
377
+ mcporter call omnifocus.batch_add_items --args '{
378
+ "items": [
379
+ {
380
+ "type": "task",
381
+ "name": "Website Technical SEO",
382
+ "projectName": "SEO Project"
383
+ }
384
+ ]
385
+ }'
386
+ ```
387
+
388
+ If you pass a subtask with `parentTaskId` or `parentTaskName`, do not also pass `projectName`. Subtasks inherit the project from their parent task.
389
+
390
+ Working `mcporter` examples:
391
+
392
+ ```bash
393
+ # 1) Batch-create top-level tasks in a project
394
+ mcporter call omnifocus.batch_add_items --args '{
395
+ "items": [
396
+ {
397
+ "type": "task",
398
+ "name": "Parent: Category A",
399
+ "projectName": "OmniFocus MCP Batch Test"
400
+ },
401
+ {
402
+ "type": "task",
403
+ "name": "Parent: Category B",
404
+ "projectName": "OmniFocus MCP Batch Test"
405
+ }
406
+ ]
407
+ }'
408
+ ```
409
+
410
+ ```bash
411
+ # 2) Create parent + child in one batch
412
+ mcporter call omnifocus.batch_add_items --args '{
413
+ "items": [
414
+ {
415
+ "type": "task",
416
+ "name": "Parent: Category A",
417
+ "projectName": "OmniFocus MCP Batch Test"
418
+ },
419
+ {
420
+ "type": "task",
421
+ "name": "Child: A1",
422
+ "parentTaskName": "Parent: Category A"
423
+ }
424
+ ]
425
+ }'
426
+ ```
427
+
428
+ ```bash
429
+ # 3) Safer two-step flow when adding many subtasks to existing parents
430
+ mcporter call omnifocus.batch_add_items --args '{
431
+ "items": [
432
+ {
433
+ "type": "task",
434
+ "name": "Child: A1",
435
+ "parentTaskName": "Parent: Category A"
436
+ },
437
+ {
438
+ "type": "task",
439
+ "name": "Child: A2",
440
+ "parentTaskName": "Parent: Category A"
441
+ },
442
+ {
443
+ "type": "task",
444
+ "name": "Child: B1",
445
+ "parentTaskName": "Parent: Category B"
446
+ }
447
+ ]
448
+ }'
449
+ ```
450
+
451
+ This will fail, by design:
452
+
453
+ ```bash
454
+ mcporter call omnifocus.batch_add_items --args '{
455
+ "items": [
456
+ {
457
+ "type": "task",
458
+ "name": "Child: A1",
459
+ "projectName": "OmniFocus MCP Batch Test",
460
+ "parentTaskName": "Parent: Category A"
461
+ }
462
+ ]
463
+ }'
464
+ ```
465
+
466
+ Because a subtask must inherit its project from the parent task.
467
+
220
468
  ### 6. 🖼️ Attachment Inspection
221
469
 
222
470
  Discover images and linked files on a task first, then read only the attachment you need:
@@ -374,7 +622,10 @@ get_custom_perspective_tasks {
374
622
 
375
623
  ## 🔧 Configuration
376
624
 
377
- ### Verify Installation
625
+ ### Claude Code
626
+
627
+ Verify the server is registered:
628
+
378
629
  ```bash
379
630
  # Check MCP status
380
631
  claude mcp list
@@ -386,10 +637,15 @@ get_inbox_tasks
386
637
  list_custom_perspectives
387
638
  ```
388
639
 
640
+ ### Claude Desktop / Cowork
641
+
642
+ Open `~/Library/Application Support/Claude/claude_desktop_config.json` and confirm the `omnifocus-enhanced` entry is present under `mcpServers`. Restart the app after any changes. Once running, you can test by asking the assistant to list your inbox tasks or custom perspectives.
643
+
389
644
  ### Troubleshooting
390
645
  - Ensure OmniFocus 3+ is installed and running
391
646
  - Verify Node.js 18+ is installed
392
- - Check Claude Code MCP configuration
647
+ - For Claude Code: run `claude mcp list` to confirm the server is registered
648
+ - For Claude Desktop / Cowork: verify `claude_desktop_config.json` is valid JSON and restart the app
393
649
  - Enable accessibility permissions for terminal apps if needed
394
650
 
395
651
  ## 🎯 Use Cases
package/README.zh.md CHANGED
@@ -9,10 +9,38 @@
9
9
 
10
10
  > **将 OmniFocus 转换为 AI 驱动的生产力强化工具,支持自定义透视**
11
11
 
12
- 增强版 OmniFocus 模型上下文协议(MCP)服务器,具备**原生自定义透视访问**、层级任务显示、AI 优化工具选择和全面的任务管理功能。与 Claude AI 完美集成,实现智能工作流。
12
+ 增强版 OmniFocus 模型上下文协议(MCP)服务器,具备**原生自定义透视访问**、层级任务显示、AI 优化工具选择和全面的任务管理功能。
13
+
14
+ 说人话:它可以让你的 AI 助手直接读取 OmniFocus、创建任务和项目、拆子任务、查看透视、做每日规划,不需要你自己在 OmniFocus 里来回点很多次。
15
+
16
+ ## 🌠 这个项目为什么存在
17
+
18
+ OmniFocus 本身已经很强了,但它大多数时候仍然是一个需要你手动操作的工具。
19
+
20
+ 这个项目想做的,其实很简单:
21
+
22
+ - 少点很多次按钮,多用自然对话
23
+ - 少做手工整理,多让 AI 帮你规划
24
+ - 少记工具名,多直接说你想完成什么
25
+
26
+ 目标不只是继续往外暴露更多 OmniFocus 命令。
27
+ 更重要的是,让你以后可以这样使用 OmniFocus:
28
+
29
+ ```text
30
+ 帮我规划今天。
31
+ 帮我清理 Inbox。
32
+ 把这段笔记变成一个项目。
33
+ 告诉我哪些事情卡住了。
34
+ 把这批任务安全地重新整理一下。
35
+ ```
36
+
37
+ 如果 README 读到这里,你已经能感受到这个方向,那这段说明就有价值了。
38
+
39
+ 如果你想继续看这个项目接下来准备往哪里走,可以直接看[路线图](docs/roadmap/2026-02-25-batch-move-tasks-plan.zh.md)。
13
40
 
14
41
  ## 🆕 最新版本
15
42
 
43
+ - **v1.6.10** - 修复 `edit_item` 无法完成 Inbox 任务的问题,修复 AppleScript 对单引号/反斜杠等特殊字符的处理,修复特殊字符导致的 JSON 返回解析失败,并补充 `batch_add_items` / `mcporter` 的可直接运行示例与说明。
16
44
  - **v1.6.9** - 新增任务附件支持:`get_task_by_id` 会返回附件元信息,`dump_database` 导出附件/链接元信息,并新增 `read_task_attachment`,可在支持时直接把图片附件作为 MCP 图片内容返回。
17
45
  - **v1.6.6** - 新增 Planned Date(计划日期)全链路支持:创建/编辑/读取/过滤/排序/导出,包含 `plannedDate` / `newPlannedDate`。
18
46
 
@@ -68,7 +96,97 @@ claude mcp add omnifocus-enhanced -- node "/path/to/omnifocus-mcp-enhanced/dist/
68
96
  - **OmniFocus 3+** - 必须安装并运行该应用程序
69
97
  - **OmniFocus Pro** - 自定义透视功能需要 Pro 版本(v1.6.0 新功能)
70
98
  - **Node.js 18+** - 运行 MCP 服务器
71
- - **Claude Code** - MCP 集成
99
+ - **任意支持 MCP 的客户端** - 比如 Claude Code、`mcporter` 或其他 MCP Host
100
+
101
+ ## 🚦 先看这里
102
+
103
+ 如果你想最快理解这个项目,只要记住这 3 件事:
104
+
105
+ 1. 把这个 MCP server 接到你的 AI 客户端里。
106
+ 2. 直接用自然语言和 AI 说你要做什么。
107
+ 3. 让 AI 帮你读 OmniFocus、整理任务、创建项目、拆子任务、做规划。
108
+
109
+ 你一开始不需要背所有工具名。
110
+
111
+ ## 🙋 这个项目最适合拿来做什么
112
+
113
+ - **每日规划**:让 AI 看今天到期、已标记、可快速完成的任务。
114
+ - **项目拆解**:给 AI 一个目标,让它自动建项目并拆成子任务。
115
+ - **Inbox 清理**:让 AI 帮你把收件箱分成“今天做 / 以后排 / 变项目”。
116
+ - **透视复盘**:让 AI 打开你的自定义透视并做总结。
117
+ - **批量录入**:把会议纪要、脑暴清单直接变成一批任务。
118
+ - **按需看附件**:先看任务有哪些附件,再决定要不要让 AI 打开。
119
+
120
+ ## 💬 和大模型对话的示例
121
+
122
+ 下面这些说法,在 Claude Code 或其他支持 MCP 的客户端里都很适合直接用。
123
+
124
+ ### 1. 每日规划
125
+
126
+ 你可以直接说:
127
+
128
+ ```text
129
+ 看看我今天的 Forecast 和已标记任务,然后告诉我今天最重要的 3 件事。
130
+ 优先考虑 60 分钟以内能完成的任务。
131
+ ```
132
+
133
+ ### 2. 清理 Inbox
134
+
135
+ 你可以直接说:
136
+
137
+ ```text
138
+ 帮我看一下 Inbox,把这些任务分成:
139
+ 1. 今天做
140
+ 2. 以后安排
141
+ 3. 应该升级成项目
142
+ 然后顺手把明显的项整理掉。
143
+ ```
144
+
145
+ ### 3. 把一个想法变成项目
146
+
147
+ 你可以直接说:
148
+
149
+ ```text
150
+ 创建一个项目,名字叫“春季 newsletter 发布”。
151
+ 把主要步骤拆成子任务,补上预计时间,并把最关键的一步设成 flagged。
152
+ ```
153
+
154
+ ### 4. 使用自定义透视
155
+
156
+ 你可以直接说:
157
+
158
+ ```text
159
+ 打开我的自定义透视“今日工作安排”,帮我总结:
160
+ - 哪些快到期
161
+ - 哪些像是卡住了
162
+ - 哪些可以快速做完
163
+ ```
164
+
165
+ ### 5. 根据笔记批量创建任务
166
+
167
+ 你可以直接说:
168
+
169
+ ```text
170
+ 把这段会议纪要整理成 OmniFocus 任务,放到“网站改版”项目下。
171
+ 该拆成子任务的就拆,任务名尽量简短。
172
+ ```
173
+
174
+ ### 6. 只在需要时查看附件
175
+
176
+ 你可以直接说:
177
+
178
+ ```text
179
+ 找到“检查设计稿”这个任务。
180
+ 先告诉我它有哪些附件。
181
+ 如果里面有图片,再帮我打开图片附件。
182
+ ```
183
+
184
+ ## 🧭 实用建议
185
+
186
+ - 如果你想更稳一点,可以先让 AI **先查看,再修改**。
187
+ - 如果有重名任务,优先用 **task ID**。
188
+ - 创建**子任务**时,让父任务决定项目,不要再额外传 `projectName`。
189
+ - 在 `mcporter` 里,复杂数组参数尽量用 `--args '{...}'`。
72
190
 
73
191
  ## 🎯 核心功能
74
192
 
@@ -212,6 +330,101 @@ get_custom_perspective_tasks {
212
330
  }
213
331
  ```
214
332
 
333
+ `mcporter` 调用提示:
334
+
335
+ ```bash
336
+ # 复杂数组 / 嵌套对象,建议明确使用 --args JSON
337
+ mcporter call omnifocus.batch_add_items --args '{
338
+ "items": [
339
+ {
340
+ "type": "task",
341
+ "name": "网站技术 SEO",
342
+ "projectName": "SEO 项目"
343
+ }
344
+ ]
345
+ }'
346
+ ```
347
+
348
+ 如果某条子任务传了 `parentTaskId` 或 `parentTaskName`,就不要再传 `projectName`。子任务会自动继承父任务所在项目。
349
+
350
+ 可直接运行的 `mcporter` 示例:
351
+
352
+ ```bash
353
+ # 1)批量创建项目下的顶层任务
354
+ mcporter call omnifocus.batch_add_items --args '{
355
+ "items": [
356
+ {
357
+ "type": "task",
358
+ "name": "父任务:分类A",
359
+ "projectName": "OmniFocus MCP 批量测试"
360
+ },
361
+ {
362
+ "type": "task",
363
+ "name": "父任务:分类B",
364
+ "projectName": "OmniFocus MCP 批量测试"
365
+ }
366
+ ]
367
+ }'
368
+ ```
369
+
370
+ ```bash
371
+ # 2)单次批量里同时创建父任务和子任务
372
+ mcporter call omnifocus.batch_add_items --args '{
373
+ "items": [
374
+ {
375
+ "type": "task",
376
+ "name": "父任务:分类A",
377
+ "projectName": "OmniFocus MCP 批量测试"
378
+ },
379
+ {
380
+ "type": "task",
381
+ "name": "子任务:A1",
382
+ "parentTaskName": "父任务:分类A"
383
+ }
384
+ ]
385
+ }'
386
+ ```
387
+
388
+ ```bash
389
+ # 3)更稳妥的两步法:父任务已存在时,再批量创建多个子任务
390
+ mcporter call omnifocus.batch_add_items --args '{
391
+ "items": [
392
+ {
393
+ "type": "task",
394
+ "name": "子任务:A1",
395
+ "parentTaskName": "父任务:分类A"
396
+ },
397
+ {
398
+ "type": "task",
399
+ "name": "子任务:A2",
400
+ "parentTaskName": "父任务:分类A"
401
+ },
402
+ {
403
+ "type": "task",
404
+ "name": "子任务:B1",
405
+ "parentTaskName": "父任务:分类B"
406
+ }
407
+ ]
408
+ }'
409
+ ```
410
+
411
+ 下面这种写法会失败,这属于预期行为:
412
+
413
+ ```bash
414
+ mcporter call omnifocus.batch_add_items --args '{
415
+ "items": [
416
+ {
417
+ "type": "task",
418
+ "name": "子任务:A1",
419
+ "projectName": "OmniFocus MCP 批量测试",
420
+ "parentTaskName": "父任务:分类A"
421
+ }
422
+ ]
423
+ }'
424
+ ```
425
+
426
+ 因为子任务必须继承父任务所在项目,不能再单独传 `projectName`。
427
+
215
428
  ### 6. 🖼️ 附件查看
216
429
 
217
430
  先读取任务和附件元信息,再按需打开具体附件:
package/dist/server.js CHANGED
@@ -18,6 +18,7 @@ import * as getInboxTasksTool from './tools/definitions/getInboxTasks.js';
18
18
  import * as getFlaggedTasksTool from './tools/definitions/getFlaggedTasks.js';
19
19
  import * as getForecastTasksTool from './tools/definitions/getForecastTasks.js';
20
20
  import * as getTasksByTagTool from './tools/definitions/getTasksByTag.js';
21
+ import * as listTagsTool from './tools/definitions/listTags.js';
21
22
  // Import ultimate filter tool
22
23
  import * as filterTasksTool from './tools/definitions/filterTasks.js';
23
24
  // Import custom perspective tools
@@ -45,6 +46,7 @@ server.tool("get_inbox_tasks", "Get tasks from OmniFocus inbox perspective", get
45
46
  server.tool("get_flagged_tasks", "Get flagged tasks from OmniFocus with optional project filtering", getFlaggedTasksTool.schema.shape, getFlaggedTasksTool.handler);
46
47
  server.tool("get_forecast_tasks", "Get tasks from OmniFocus forecast perspective (due/deferred tasks in date range)", getForecastTasksTool.schema.shape, getForecastTasksTool.handler);
47
48
  server.tool("get_tasks_by_tag", "Get tasks filtered by OmniFocus tags (labels like @home, @work, @urgent). Use this for tag-based filtering, NOT for custom perspective names. Tags are labels assigned to individual tasks.", getTasksByTagTool.schema.shape, getTasksByTagTool.handler);
49
+ server.tool("list_tags", "List OmniFocus tags with IDs, parent relationships, and active status without loading tasks", listTagsTool.schema.shape, listTagsTool.handler);
48
50
  // Ultimate filter tool - The most powerful task perspective engine
49
51
  server.tool("filter_tasks", "Advanced task filtering with unlimited perspective combinations - status, dates, projects, tags, search, and more", filterTasksTool.schema.shape, filterTasksTool.handler);
50
52
  // Custom perspective tools
@@ -42,7 +42,7 @@ export async function handler(args, extra) {
42
42
  return {
43
43
  content: [{
44
44
  type: "text",
45
- text: `✅ Task "${args.name}" created successfully ${locationText}${dueDateText}${plannedDateText}${tagText}.`
45
+ text: `✅ Task "${args.name}" created successfully ${locationText}${dueDateText}${plannedDateText}${tagText}.\n\nid: ${result.taskId}`
46
46
  }]
47
47
  };
48
48
  }
@@ -36,7 +36,7 @@ export async function handler(args, extra) {
36
36
  return {
37
37
  content: [{
38
38
  type: "text",
39
- text: `✅ Project "${args.name}" created successfully ${locationText}${dueDateText}${plannedDateText}${tagText}${sequentialText}.`
39
+ text: `✅ Project "${args.name}" created successfully ${locationText}${dueDateText}${plannedDateText}${tagText}${sequentialText}.\n\nid: ${result.projectId}`
40
40
  }]
41
41
  };
42
42
  }
@@ -12,9 +12,9 @@ export const schema = z.object({
12
12
  estimatedMinutes: z.number().optional().describe("Estimated time to complete the item, in minutes"),
13
13
  tags: z.array(z.string()).optional().describe("Tags to assign to the item"),
14
14
  // Task-specific properties
15
- projectName: z.string().optional().describe("For tasks: The name of the project to add the task to"),
16
- parentTaskId: z.string().optional().describe("For tasks: The ID of the parent task to create this task as a subtask"),
17
- parentTaskName: z.string().optional().describe("For tasks: The name of the parent task to create this task as a subtask"),
15
+ projectName: z.string().optional().describe("For tasks: The project name for top-level tasks. Omit this when parentTaskId or parentTaskName is set."),
16
+ parentTaskId: z.string().optional().describe("For tasks: The parent task ID for subtasks. When this is set, do not also provide projectName."),
17
+ parentTaskName: z.string().optional().describe("For tasks: The parent task name for subtasks. Subtasks inherit project from their parent, so do not also provide projectName."),
18
18
  // Project-specific properties
19
19
  folderName: z.string().optional().describe("For projects: The name of the folder to add the project to"),
20
20
  sequential: z.boolean().optional().describe("For projects: Whether tasks in the project should be sequential")
@@ -36,7 +36,7 @@ export async function handler(args, extra) {
36
36
  if (item.success) {
37
37
  const itemType = args.items[index].type;
38
38
  const itemName = args.items[index].name;
39
- return `- ✅ ${itemType}: "${itemName}"`;
39
+ return `- ✅ ${itemType}: "${itemName}" (id: ${item.id})`;
40
40
  }
41
41
  else {
42
42
  const itemType = args.items[index].type;