@heznpc/imcp 1.1.0 → 1.2.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.md CHANGED
@@ -4,21 +4,98 @@ MCP server for the entire Apple ecosystem — Notes, Reminders, Calendar, Contac
4
4
 
5
5
  > [한국어](README.ko.md)
6
6
 
7
- ## Features
8
-
9
- - **110 tools** across 13 modules — full CRUD for Apple apps + system control + Apple Intelligence
10
- - **20 prompts** — per-app workflows + cross-module + developer workflows (dev-session, debug-loop, build-log)
11
- - **4 MCP Resources** — live data URIs for notes, calendar, and reminders
12
- - **JXA + Swift bridge** — JXA for core automation, EventKit/PhotoKit via Swift for advanced features
13
- - **Recurring events/reminders** — create recurrence rules via EventKit (macOS 26+ Swift bridge)
14
- - **Photos import/delete** — import and delete photos via PhotoKit (macOS 26+ Swift bridge)
15
- - **Apple Intelligence** — on-device summarization, rewriting, proofreading (macOS 26+)
16
- - **Native menubar app** — SwiftUI companion app for status monitoring, permission setup, config copy
17
- - **One-click setup** `setup_permissions` tool or menubar app triggers all macOS permission prompts at once
18
- - **Dual transport** — stdio (default, secure local) + HTTP/SSE (`--http`) for remote agents and registries
19
- - **Safety annotations** — every tool tagged with readOnly/destructive hints
20
-
21
- ## Quick Start
7
+ ## Get Started (2 minutes)
8
+
9
+ ### 1. Install Node.js
10
+
11
+ If you don't have Node.js, install it first:
12
+
13
+ ```bash
14
+ # Using Homebrew (recommended)
15
+ brew install node
16
+
17
+ # Or download from https://nodejs.org (LTS version)
18
+ ```
19
+
20
+ ### 2. Run the Setup Wizard
21
+
22
+ ```bash
23
+ npx @heznpc/imcp init
24
+ ```
25
+
26
+ This will:
27
+ - Let you choose which Apple apps to connect (Notes, Calendar, Reminders, etc.)
28
+ - Automatically configure Claude Desktop
29
+ - Save your preferences to `~/.config/imcp/config.json`
30
+
31
+ ### 3. Restart Claude Desktop
32
+
33
+ That's it! Claude can now read your notes, manage reminders, check your calendar, and more.
34
+
35
+ ### Troubleshooting
36
+
37
+ ```bash
38
+ npx @heznpc/imcp doctor
39
+ ```
40
+
41
+ Checks Node.js version, config files, Claude Desktop setup, macOS permissions, and module status — all in one command.
42
+
43
+ ---
44
+
45
+ ## What Can It Do?
46
+
47
+ **118 tools** across 14 Apple app modules, **9 MCP resources**, and **20 prompts**:
48
+
49
+ | Module | What it does | Tools |
50
+ |--------|-------------|-------|
51
+ | **Notes** | Read, create, search, organize notes and folders | 12 |
52
+ | **Reminders** | Create tasks, set due dates, manage lists | 11 |
53
+ | **Calendar** | View events, create meetings, check schedule | 10 |
54
+ | **Contacts** | Look up people, manage contact info | 10 |
55
+ | **Mail** | Read, search, send, reply to emails | 11 |
56
+ | **Music** | Control playback, search tracks, manage playlists | 9 |
57
+ | **Finder** | Browse files, search with Spotlight, organize | 8 |
58
+ | **Safari** | Read web pages, manage tabs | 8 |
59
+ | **System** | Clipboard, volume, dark mode, screenshots, notifications | 10 |
60
+ | **Photos** | Browse albums, import/delete photos | 9 |
61
+ | **Messages** | View chats, send iMessages | 6 |
62
+ | **Shortcuts** | Run Siri Shortcuts from AI | 4 |
63
+ | **Intelligence** | On-device summarize, rewrite, proofread (macOS 26+) | 3 |
64
+ | **TV** | Browse library, control playback, search content | 6 |
65
+
66
+ All tools include MCP annotations (`readOnlyHint`, `destructiveHint`, `openWorldHint`) for client-side safety UI.
67
+
68
+ ## Module Presets
69
+
70
+ By default, new installations start with 5 core modules (Notes, Reminders, Calendar, Shortcuts, System) to keep things simple. You can enable more anytime:
71
+
72
+ ```bash
73
+ # Re-run the setup wizard to change modules
74
+ npx @heznpc/imcp init
75
+
76
+ # Or enable all modules at once
77
+ npx @heznpc/imcp --full
78
+ ```
79
+
80
+ Or edit `~/.config/imcp/config.json` directly:
81
+
82
+ ```json
83
+ {
84
+ "disabledModules": ["messages", "intelligence"]
85
+ }
86
+ ```
87
+
88
+ ## CLI Commands
89
+
90
+ | Command | Description |
91
+ |---------|-------------|
92
+ | `npx @heznpc/imcp init` | Interactive setup wizard |
93
+ | `npx @heznpc/imcp doctor` | Diagnose installation issues |
94
+ | `npx @heznpc/imcp` | Start MCP server (stdio, default) |
95
+ | `npx @heznpc/imcp --full` | Start with all 13 modules enabled |
96
+ | `npx @heznpc/imcp --http` | Start as HTTP server (port 3847) |
97
+
98
+ ## Alternative Setup (Manual)
22
99
 
23
100
  ### Claude Desktop
24
101
 
@@ -48,37 +125,83 @@ git clone https://github.com/heznpc/iMcp.git
48
125
  cd iMcp
49
126
  npm install
50
127
  npm run build
128
+ node dist/index.js
51
129
  ```
52
130
 
53
- ### Menubar App (Optional)
131
+ ## Configuration
54
132
 
55
- A native SwiftUI companion app for server status monitoring and permission setup.
133
+ ### Environment Variables
56
134
 
57
- ```bash
58
- cd app && swift build -c release
59
- # Binary: app/.build/release/iMcpApp
135
+ | Variable | Default | Description |
136
+ |----------|---------|-------------|
137
+ | `IMCP_INCLUDE_SHARED` | `false` | Include shared notes/folders |
138
+ | `IMCP_ALLOW_SEND_MESSAGES` | `true` | Allow sending iMessages |
139
+ | `IMCP_ALLOW_SEND_MAIL` | `true` | Allow sending emails |
140
+ | `IMCP_FULL` | `false` | Enable all modules (ignores preset) |
141
+ | `IMCP_DISABLE_{MODULE}` | — | Disable a specific module (e.g. `IMCP_DISABLE_MUSIC=true`) |
142
+
143
+ ### Config File
144
+
145
+ `~/.config/imcp/config.json`:
146
+
147
+ ```json
148
+ {
149
+ "disabledModules": ["messages", "intelligence"],
150
+ "includeShared": false,
151
+ "allowSendMessages": true,
152
+ "allowSendMail": true,
153
+ "hitl": {
154
+ "level": "destructive-only",
155
+ "timeout": 30
156
+ }
157
+ }
60
158
  ```
61
159
 
62
- Features: server status indicator, one-click permission setup, copy Claude config to clipboard.
160
+ ## Advanced Features
63
161
 
64
162
  ### HTTP Mode
65
163
 
66
- Run iMcp as an HTTP server for remote agents, Smithery registry, or multi-client setups:
164
+ Run iMcp as an HTTP server for remote agents or multi-client setups:
67
165
 
68
166
  ```bash
69
167
  npx @heznpc/imcp --http --port 3847
70
168
  ```
71
169
 
72
- - Endpoint: `POST/GET/DELETE /mcp`
73
- - Transport: Streamable HTTP with SSE (MCP spec 2024-11-05)
74
- - Session management via `Mcp-Session-Id` header
75
- - Default port: 3847
170
+ ### Human-in-the-Loop (HITL)
171
+
172
+ Require manual approval before destructive operations:
173
+
174
+ ```json
175
+ {
176
+ "hitl": {
177
+ "level": "destructive-only",
178
+ "timeout": 30
179
+ }
180
+ }
181
+ ```
76
182
 
77
- Useful for Mac Mini "always-on AI hub" setups where remote agents connect over the network.
183
+ Levels: `off`, `destructive-only`, `all-writes`, `all`
78
184
 
79
- ## Tools
185
+ ### Menubar App (Optional)
80
186
 
81
- ### Notes (12 tools)
187
+ A native SwiftUI companion app for server status monitoring and permission setup:
188
+
189
+ ```bash
190
+ cd app && swift build -c release
191
+ ```
192
+
193
+ ### Swift Bridge (Optional)
194
+
195
+ For recurring events/reminders (EventKit), photo import/delete (PhotoKit), and Apple Intelligence — requires macOS 26+:
196
+
197
+ ```bash
198
+ npm run swift-build
199
+ ```
200
+
201
+ ## Tools Reference
202
+
203
+ <details>
204
+ <summary>Notes (12 tools)</summary>
82
205
 
83
206
  | Tool | Description | Type |
84
207
  |------|-------------|------|
@@ -94,8 +217,10 @@ Useful for Mac Mini "always-on AI hub" setups where remote agents connect over t
94
217
  | `scan_notes` | Bulk scan with metadata and preview | read |
95
218
  | `compare_notes` | Compare 2-5 notes side by side | read |
96
219
  | `bulk_move_notes` | Move multiple notes at once | destructive |
220
+ </details>
97
221
 
98
- ### Reminders (11 tools)
222
+ <details>
223
+ <summary>Reminders (11 tools)</summary>
99
224
 
100
225
  | Tool | Description | Type |
101
226
  |------|-------------|------|
@@ -110,8 +235,10 @@ Useful for Mac Mini "always-on AI hub" setups where remote agents connect over t
110
235
  | `create_reminder_list` | Create a new reminder list | write |
111
236
  | `delete_reminder_list` | Delete a reminder list | destructive |
112
237
  | `create_recurring_reminder` | Create with recurrence rule (Swift/EventKit) | write |
238
+ </details>
113
239
 
114
- ### Calendar (10 tools)
240
+ <details>
241
+ <summary>Calendar (10 tools)</summary>
115
242
 
116
243
  | Tool | Description | Type |
117
244
  |------|-------------|------|
@@ -125,8 +252,10 @@ Useful for Mac Mini "always-on AI hub" setups where remote agents connect over t
125
252
  | `get_upcoming_events` | Next N events from now | read |
126
253
  | `today_events` | All events for today | read |
127
254
  | `create_recurring_event` | Create with recurrence rule (Swift/EventKit) | write |
255
+ </details>
128
256
 
129
- ### Contacts (10 tools)
257
+ <details>
258
+ <summary>Contacts (10 tools)</summary>
130
259
 
131
260
  | Tool | Description | Type |
132
261
  |------|-------------|------|
@@ -140,8 +269,10 @@ Useful for Mac Mini "always-on AI hub" setups where remote agents connect over t
140
269
  | `add_contact_email` | Add email to existing contact | write |
141
270
  | `add_contact_phone` | Add phone to existing contact | write |
142
271
  | `list_group_members` | List contacts in a group | read |
272
+ </details>
143
273
 
144
- ### Mail (9 tools)
274
+ <details>
275
+ <summary>Mail (9 tools)</summary>
145
276
 
146
277
  | Tool | Description | Type |
147
278
  |------|-------------|------|
@@ -154,8 +285,10 @@ Useful for Mac Mini "always-on AI hub" setups where remote agents connect over t
154
285
  | `get_unread_count` | Total unread across all mailboxes | read |
155
286
  | `move_message` | Move message to another mailbox | destructive |
156
287
  | `list_accounts` | List all mail accounts | read |
288
+ </details>
157
289
 
158
- ### Music (9 tools)
290
+ <details>
291
+ <summary>Music (9 tools)</summary>
159
292
 
160
293
  | Tool | Description | Type |
161
294
  |------|-------------|------|
@@ -168,102 +301,13 @@ Useful for Mac Mini "always-on AI hub" setups where remote agents connect over t
168
301
  | `play_playlist` | Start playing a playlist | write |
169
302
  | `get_track_info` | Detailed track metadata | read |
170
303
  | `set_shuffle` | Set shuffle and repeat mode | write |
304
+ </details>
171
305
 
172
- ### Finder (8 tools)
306
+ <details>
307
+ <summary>Finder, Safari, System, Photos, Messages, Shortcuts, Intelligence</summary>
173
308
 
174
- | Tool | Description | Type |
175
- |------|-------------|------|
176
- | `search_files` | Spotlight search in a folder | read |
177
- | `get_file_info` | File size, dates, kind, tags | read |
178
- | `set_file_tags` | Set Finder tags on a file | destructive |
179
- | `recent_files` | Recently modified files | read |
180
- | `list_directory` | List files in a directory | read |
181
- | `move_file` | Move or rename a file | destructive |
182
- | `trash_file` | Move file to Trash | destructive |
183
- | `create_directory` | Create a new directory | write |
184
-
185
- ### Safari (8 tools)
186
-
187
- | Tool | Description | Type |
188
- |------|-------------|------|
189
- | `list_tabs` | List all open tabs across windows | read |
190
- | `read_page_content` | Read text content of a page | read |
191
- | `get_current_tab` | Get the active tab URL and title | read |
192
- | `open_url` | Open a URL in Safari | write |
193
- | `close_tab` | Close a specific tab | destructive |
194
- | `activate_tab` | Switch to a specific tab | write |
195
- | `run_javascript` | Execute JavaScript in a tab | write |
196
- | `search_tabs` | Search tabs by title or URL | read |
197
-
198
- ### System (10 tools)
199
-
200
- | Tool | Description | Type |
201
- |------|-------------|------|
202
- | `get_clipboard` | Read clipboard contents | read |
203
- | `set_clipboard` | Write to clipboard | write |
204
- | `get_volume` | Get system volume level | read |
205
- | `set_volume` | Set system volume level | write |
206
- | `toggle_dark_mode` | Toggle dark/light mode | write |
207
- | `get_frontmost_app` | Get the frontmost application | read |
208
- | `list_running_apps` | List all running applications | read |
209
- | `get_screen_info` | Get display information | read |
210
- | `show_notification` | Display a system notification | write |
211
- | `capture_screenshot` | Take a screenshot (fullscreen/window/selection) | write |
212
-
213
- ### Photos (9 tools)
214
-
215
- | Tool | Description | Type |
216
- |------|-------------|------|
217
- | `list_albums` | List photo albums | read |
218
- | `list_photos` | List photos in an album | read |
219
- | `search_photos` | Search photos by keyword | read |
220
- | `get_photo_info` | Detailed photo metadata | read |
221
- | `list_favorites` | List favorite photos | read |
222
- | `create_album` | Create a new album | write |
223
- | `add_to_album` | Add photos to an album | write |
224
- | `import_photo` | Import from file path (Swift/PhotoKit) | write |
225
- | `delete_photos` | Delete photos by ID (Swift/PhotoKit) | destructive |
226
-
227
- ### Messages (6 tools)
228
-
229
- | Tool | Description | Type |
230
- |------|-------------|------|
231
- | `list_chats` | List recent chats with participants | read |
232
- | `read_chat` | Read chat details including participants and last update | read |
233
- | `search_chats` | Search by name, participant, or handle | read |
234
- | `send_message` | Send text via iMessage/SMS | write |
235
- | `send_file` | Send file attachment via iMessage/SMS | write |
236
- | `list_participants` | List participants in a chat | read |
237
-
238
- ### Shortcuts (4 tools)
239
-
240
- | Tool | Description | Type |
241
- |------|-------------|------|
242
- | `list_shortcuts` | List available Shortcuts | read |
243
- | `run_shortcut` | Run a Shortcut by name | write |
244
- | `search_shortcuts` | Search shortcuts by name | read |
245
- | `get_shortcut_detail` | Get shortcut details/actions | read |
246
-
247
- ### Apple Intelligence (3 tools)
248
-
249
- Requires macOS 26+ with Apple Silicon. Graceful error on unsupported systems.
250
-
251
- | Tool | Description | Type |
252
- |------|-------------|------|
253
- | `summarize_text` | On-device summarization | read |
254
- | `rewrite_text` | Rewrite in specified tone | read |
255
- | `proofread_text` | Grammar/spelling correction | read |
256
-
257
- ## Resources
258
-
259
- MCP Resources expose live data from Apple apps as URIs.
260
-
261
- | URI | Description |
262
- |-----|-------------|
263
- | `notes://recent` | 10 most recent notes |
264
- | `notes://recent/{count}` | Recent notes (configurable count) |
265
- | `calendar://today` | Today's calendar events |
266
- | `reminders://due` | Overdue reminders |
309
+ See the full tool list in the [Tools Reference](https://github.com/heznpc/iMcp/wiki/Tools-Reference) or run the server to explore via your AI client.
310
+ </details>
267
311
 
268
312
  ## Prompts
269
313
 
@@ -281,103 +325,26 @@ MCP Resources expose live data from Apple apps as URIs.
281
325
  - **weekly-digest** — Past N days: events + notes + reminders combined
282
326
  - **meeting-notes-to-reminders** — Extract action items from meeting notes, create reminders
283
327
  - **event-follow-up** — Create follow-up note and reminders after a meeting
284
- - **research-with-safari** — Browse with Safari + save findings to Notes
285
- - **focus-session** — Calendar + Reminders + Music for focused work
286
- - **file-organizer** — Organize files with Finder + track in Notes
287
328
 
288
329
  ### Developer Workflows
289
330
  - **dev-session** — Scan project, check specs, research docs, create session notes
290
- - **debug-loop** — Capture errors from Safari/clipboard, locate code, log bugs, create fix tasks
291
- - **screen-capture-flow** — Screenshot → Photos import → annotated note
292
- - **app-release-prep** — Calendar dates + changelog from Notes + Reminders checklist
331
+ - **debug-loop** — Capture errors from Safari/clipboard, locate code, log bugs
293
332
  - **idea-to-task** — Break idea into tasks → Reminders + Calendar time blocks
294
- - **build-log** — Analyze build output, log errors or celebrate success with Music
295
-
296
- ## Developer Agent Pipeline
297
-
298
- iMcp's developer prompts chain Apple apps into autonomous agent workflows. Each prompt orchestrates multiple tools across modules — the AI reads your actual filesystem, Notes, Calendar, and Reminders to build real context, then writes back structured results.
299
-
300
- ```
301
- ┌─────────────────────────────────────────────────────────────────┐
302
- │ dev-session │
303
- │ Finder (scan) → Notes (specs) → Safari (docs) → Notes (log) │
304
- └─────────────────────────────────────────────────────────────────┘
305
-
306
- ┌─────────────────────────────────────────────────────────────────┐
307
- │ debug-loop │
308
- │ Safari (JS errors) → Clipboard → Finder (locate) → │
309
- │ Notes (bug log) → Reminders (fix task) │
310
- └─────────────────────────────────────────────────────────────────┘
311
-
312
- ┌─────────────────────────────────────────────────────────────────┐
313
- │ idea-to-task │
314
- │ Notes (capture) → AI (decompose) → Reminders (tasks) → │
315
- │ Calendar (time blocks) │
316
- └─────────────────────────────────────────────────────────────────┘
317
-
318
- ┌─────────────────────────────────────────────────────────────────┐
319
- │ build-log │
320
- │ Finder (output) → Clipboard (log) → │
321
- │ ┌ fail → Notes (error log) → Reminders (fix task) │
322
- │ └ pass → Notification → Music (celebrate) → Notes (success) │
323
- └─────────────────────────────────────────────────────────────────┘
324
- ```
325
-
326
- These prompts are designed for AI coding agents (Claude Code, Cursor, Copilot) to invoke as MCP prompts — turning your Mac into a context-aware development environment.
327
-
328
- > Demo video coming soon.
329
-
330
- ## Configuration
331
-
332
- | Environment Variable | Default | Description |
333
- |---------------------|---------|-------------|
334
- | `IMCP_INCLUDE_SHARED` | `false` | Include shared notes/folders in results |
333
+ - **build-log** — Analyze build output, log errors or celebrate success
335
334
 
336
335
  ## Requirements
337
336
 
338
337
  - macOS (Apple apps require macOS)
339
338
  - Node.js >= 18
340
- - First run will prompt for Automation permission for each app — use `setup_permissions` tool to grant all at once
341
339
  - Apple Intelligence tools require macOS 26+ with Apple Silicon
342
340
 
343
341
  ## Limitations
344
342
 
345
- ### Notes
346
- - Move copies and deletes (new ID, reset dates, lost attachments)
347
- - Update replaces entire body. Read first to preserve content.
348
- - Password-protected notes unreadable.
349
-
350
- ### Reminders / Calendar
351
- - JXA recurrence rules are read-only — use `create_recurring_event`/`create_recurring_reminder` (Swift/EventKit) to create recurring items
352
- - Calendar attendees are read-only
353
-
354
- ### Contacts
355
- - Custom fields not accessible
356
-
357
- ### Mail
358
- - Content truncated to 5000 characters by default (configurable via `maxLength` parameter)
359
-
360
- ### Messages
361
- - Chat message history (individual message content) is not accessible via JXA
362
- - Send requires the recipient to be a known buddy in the Messages service
363
-
364
- ### Music
365
- - Smart playlists are read-only
366
- - No queue manipulation
367
-
368
- ### Finder
369
- - Tags use Spotlight (mdfind), performance varies with index state
370
-
371
- ### Safari
372
- - Reading page content requires Allow JavaScript from Apple Events in Safari Developer menu
373
-
374
- ### Photos
375
- - JXA: albums can be created and photos added, but no import/delete
376
- - Swift bridge (macOS 26+): full import and delete via PhotoKit
377
-
378
- ### Apple Intelligence
379
- - Requires macOS 26 (Tahoe) + Apple Silicon
380
- - Run `npm run swift-build` to compile the bridge binary
343
+ - **Notes**: Move copies and deletes (new ID, reset dates, lost attachments). Update replaces entire body.
344
+ - **Calendar/Reminders**: JXA recurrence is read-only use Swift bridge for recurring items.
345
+ - **Messages**: Chat message history not accessible via JXA. Send requires known buddy.
346
+ - **Safari**: Reading page content requires "Allow JavaScript from Apple Events" in Safari Developer menu.
347
+ - **Photos**: Full import/delete requires Swift bridge (macOS 26+).
381
348
 
382
349
  ## License
383
350
 
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `npx @heznpc/imcp doctor` — Diagnose iMcp installation.
3
+ *
4
+ * Checks: Node version, config files, Claude Desktop config,
5
+ * module status, and optionally probes macOS permissions.
6
+ */
7
+ export declare function runDoctor(): Promise<void>;
@@ -0,0 +1,135 @@
1
+ /**
2
+ * `npx @heznpc/imcp doctor` — Diagnose iMcp installation.
3
+ *
4
+ * Checks: Node version, config files, Claude Desktop config,
5
+ * module status, and optionally probes macOS permissions.
6
+ */
7
+ import { readFileSync, existsSync } from "node:fs";
8
+ import { join } from "node:path";
9
+ import { execSync } from "node:child_process";
10
+ import { MODULE_NAMES, STARTER_MODULES } from "../shared/config.js";
11
+ const HOME = process.env.HOME ?? process.env.USERPROFILE ?? "";
12
+ const CLAUDE_CONFIG_PATH = join(HOME, "Library", "Application Support", "Claude", "claude_desktop_config.json");
13
+ const IMCP_CONFIG_PATH = join(HOME, ".config", "imcp", "config.json");
14
+ const OK = "\x1b[32m✓\x1b[0m";
15
+ const WARN = "\x1b[33m⚠\x1b[0m";
16
+ const FAIL = "\x1b[31m✗\x1b[0m";
17
+ function check(label, status, detail) {
18
+ console.log(` ${status} ${label.padEnd(22)} ${detail}`);
19
+ }
20
+ export async function runDoctor() {
21
+ console.log("");
22
+ console.log("\x1b[1m\x1b[36m iMcp Doctor\x1b[0m");
23
+ console.log("");
24
+ // 1. Node version
25
+ const nodeVer = process.version;
26
+ const major = parseInt(nodeVer.slice(1), 10);
27
+ check("Node.js", major >= 18 ? OK : FAIL, `${nodeVer} ${major >= 18 ? "(>= 18 required)" : "— upgrade required (>= 18)"}`);
28
+ // 2. macOS check
29
+ const platform = process.platform;
30
+ check("Platform", platform === "darwin" ? OK : FAIL, platform === "darwin" ? "macOS" : `${platform} — iMcp requires macOS`);
31
+ // 3. Config file
32
+ let fileConfig = null;
33
+ if (existsSync(IMCP_CONFIG_PATH)) {
34
+ try {
35
+ fileConfig = JSON.parse(readFileSync(IMCP_CONFIG_PATH, "utf-8"));
36
+ check("Config file", OK, IMCP_CONFIG_PATH);
37
+ }
38
+ catch {
39
+ check("Config file", WARN, `${IMCP_CONFIG_PATH} (parse error)`);
40
+ }
41
+ }
42
+ else {
43
+ check("Config file", WARN, "Not found — using starter preset (5 modules)");
44
+ }
45
+ // 4. Claude Desktop config
46
+ if (existsSync(CLAUDE_CONFIG_PATH)) {
47
+ try {
48
+ const raw = JSON.parse(readFileSync(CLAUDE_CONFIG_PATH, "utf-8"));
49
+ const servers = raw?.mcpServers ?? {};
50
+ if (servers.imcp) {
51
+ check("Claude Desktop", OK, "imcp entry found");
52
+ }
53
+ else {
54
+ check("Claude Desktop", WARN, "Config exists but no 'imcp' entry — run: npx @heznpc/imcp init");
55
+ }
56
+ }
57
+ catch {
58
+ check("Claude Desktop", WARN, `Config parse error: ${CLAUDE_CONFIG_PATH}`);
59
+ }
60
+ }
61
+ else {
62
+ check("Claude Desktop", WARN, "Config not found — run: npx @heznpc/imcp init");
63
+ }
64
+ // 5. Enabled modules
65
+ const disabledSet = new Set(fileConfig?.disabledModules ?? []);
66
+ const enabledMods = [];
67
+ const disabledMods = [];
68
+ for (const mod of MODULE_NAMES) {
69
+ if (fileConfig) {
70
+ // Explicit config
71
+ if (disabledSet.has(mod)) {
72
+ disabledMods.push(mod);
73
+ }
74
+ else {
75
+ enabledMods.push(mod);
76
+ }
77
+ }
78
+ else {
79
+ // Starter preset
80
+ if (STARTER_MODULES.has(mod)) {
81
+ enabledMods.push(mod);
82
+ }
83
+ else {
84
+ disabledMods.push(mod);
85
+ }
86
+ }
87
+ }
88
+ console.log("");
89
+ console.log(` \x1b[1mModules\x1b[0m (${enabledMods.length} enabled, ${disabledMods.length} disabled)`);
90
+ for (const mod of MODULE_NAMES) {
91
+ const on = enabledMods.includes(mod);
92
+ console.log(` ${on ? OK : "\x1b[2m-\x1b[0m"} ${mod}${on ? "" : " \x1b[2m(disabled)\x1b[0m"}`);
93
+ }
94
+ // 6. Permission probe (macOS only, skip if not darwin)
95
+ if (platform === "darwin") {
96
+ console.log("");
97
+ console.log(" \x1b[1mPermissions\x1b[0m");
98
+ const APP_MAP = {
99
+ notes: "Notes",
100
+ reminders: "Reminders",
101
+ calendar: "Calendar",
102
+ contacts: "Contacts",
103
+ mail: "Mail",
104
+ messages: "Messages",
105
+ music: "Music",
106
+ finder: "Finder",
107
+ safari: "Safari",
108
+ system: "System Events",
109
+ photos: "Photos",
110
+ tv: "TV",
111
+ };
112
+ for (const mod of enabledMods) {
113
+ const appName = APP_MAP[mod];
114
+ if (!appName)
115
+ continue;
116
+ try {
117
+ execSync(`osascript -l JavaScript -e "Application('${appName}'); JSON.stringify({ok:true})"`, { timeout: 5000, stdio: "pipe" });
118
+ check(` ${appName}`, OK, "Accessible");
119
+ }
120
+ catch {
121
+ check(` ${appName}`, WARN, "Not accessible — grant permission in System Settings > Privacy");
122
+ }
123
+ }
124
+ }
125
+ // 7. Swift bridge
126
+ const swiftBridgePath = join(process.cwd(), "swift", ".build", "release", "imcp-bridge");
127
+ if (existsSync(swiftBridgePath)) {
128
+ check("Swift bridge", OK, "Built");
129
+ }
130
+ else {
131
+ check("Swift bridge", WARN, "Not built — run: npm run swift-build (optional, for EventKit/PhotoKit/Intelligence)");
132
+ }
133
+ console.log("");
134
+ }
135
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEpE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;AA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,IAAI,EAAE,qFAAqF,CAAC,CAAC;IACrH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `npx @heznpc/imcp init` — Interactive setup wizard.
3
+ *
4
+ * 1. Choose modules (toggle-style)
5
+ * 2. Write ~/.config/imcp/config.json
6
+ * 3. Patch Claude Desktop config (auto-detect path)
7
+ */
8
+ export declare function runInit(): Promise<void>;