@blackbelt-technology/pi-dashboard-apple-tools 0.8.0 → 0.10.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.
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  name: apple-tools
3
- description: Reach Apple PIM data (Calendar, Contacts, Reminders, Messages, Location, Maps, Weather) from a pi session via iMCP + pi-mcp-adapter on macOS. Use when the user asks to read/search their Apple Calendar, Contacts, Reminders, iMessages, current Location, Maps, or Weather. Does NOT cover Apple Mail — iMCP exposes no Mail service; use apple-mail-fast-export for email.
3
+ description: Reach Apple PIM data (Calendar, Contacts, Reminders, Messages, Location, Maps, Weather) from a pi session via iMCP + pi's built-in MCP on macOS. Use when the user asks to read/search their Apple Calendar, Contacts, Reminders, iMessages, current Location, Maps, or Weather. Does NOT cover Apple Mail — iMCP exposes no Mail service; use apple-mail-fast-export for email.
4
4
  ---
5
5
 
6
6
  # apple-tools (iMCP)
7
7
 
8
8
  Access Apple personal-information-management data on **macOS** through
9
9
  [iMCP](https://github.com/mattt/iMCP), a menu-bar app that brokers the OS
10
- permission grants, reached over MCP by `pi-mcp-adapter`.
10
+ permission grants, reached over MCP by pi's built-in MCP (pi ≥ 1.0.0).
11
11
 
12
12
  ## Reachable services (seven)
13
13
 
@@ -27,11 +27,12 @@ If the user asks to read, search, or summarize **Apple Mail / email**:
27
27
  "Messages" satisfying an email request is a category error: Messages is
28
28
  iMessage/SMS only.
29
29
 
30
- ## Access pattern — search then invoke via the adapter
30
+ ## Access pattern — search then invoke via built-in MCP
31
31
 
32
- The agent reaches iMCP tools through **`pi-mcp-adapter`**, not by spawning the
33
- server. Do **not** run `imcp-server` directly. Use the adapter's MCP tool
34
- surface (search the available tools, then invoke).
32
+ The agent reaches iMCP tools through pi's **built-in MCP**, not by spawning the
33
+ server. Do **not** run `imcp-server` directly. Tools appear as `mcp__iMCP__*`
34
+ (through `codemode`, or `tool_search` when the entry's `exposure` is
35
+ `deferred`). Search the available tools, then invoke.
35
36
 
36
37
  ## Provisioning check (run at load)
37
38
 
@@ -49,7 +50,7 @@ Terminal states mirror the CLI and the dashboard panel:
49
50
  `READY_PENDING_GRANTS`.
50
51
 
51
52
  `READY` is NOT one of them. It is a live-access result — reachable only by a
52
- successful tool round-trip through the adapter, never by the provisioning
53
+ successful tool round-trip through pi's built-in MCP, never by the provisioning
53
54
  traversal, which cannot know whether the TCC grants were given.
54
55
 
55
56
  If the state is anything other than `READY_PENDING_GRANTS`, do NOT attempt
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Provision and surface **iMCP** — Apple PIM (Calendar, Contacts, Reminders,
4
4
  Messages, Location, Maps, Weather) — for a pi session on **macOS**, reached
5
- through [`pi-mcp-adapter`](https://www.npmjs.com/package/pi-mcp-adapter).
5
+ through pi's **built-in MCP** (pi ≥ 1.0.0). No `pi-mcp-adapter`.
6
6
 
7
7
  > **macOS only. No Apple Mail.** iMCP exposes no Mail service; "Messages" is
8
8
  > iMessage/SMS, not email. For email use the `apple-mail-fast-export` skill.
@@ -12,12 +12,11 @@ through [`pi-mcp-adapter`](https://www.npmjs.com/package/pi-mcp-adapter).
12
12
  Three moving parts must line up before a single Apple tool call works:
13
13
 
14
14
  1. **iMCP.app installed** — `brew install --cask mattt/tap/iMCP`
15
- 2. **`pi-mcp-adapter` loaded** — an entry in `~/.pi/agent/settings.json` `packages[]`
16
- 3. **`mcp.json` entry present** — `mcpServers.iMCP.command` in `~/.pi/agent/mcp.json`
17
- 4. **TCC grants** — **manual**, in the iMCP menu-bar app (Apple's security model
15
+ 2. **`mcp.json` entry present** — `mcpServers.iMCP.command` in `~/.pi/agent/mcp.json`
16
+ 3. **TCC grants** — **manual**, in the iMCP menu-bar app (Apple's security model
18
17
  has no API; this step cannot be automated)
19
18
 
20
- Steps 1–3 are automated by this package. Step 4 is a documented manual click.
19
+ Steps 1–2 are automated by this package. Step 3 is a documented manual click.
21
20
 
22
21
  ## Install
23
22
 
@@ -29,7 +28,7 @@ Installing the package does nothing on its own (no `postinstall`). Provisioning
29
28
  is **opt-in**:
30
29
 
31
30
  ```bash
32
- pi-apple-tools-install # provision (writes mcp.json + settings.json)
31
+ pi-apple-tools-install # provision (writes mcp.json only)
33
32
  pi-apple-tools-install --check # report the state without changing anything
34
33
  ```
35
34
 
@@ -43,7 +42,8 @@ the `doctor` probe:
43
42
  `CONFIG_WRITE_FAILED` · `READY_PENDING_GRANTS` · `READY`
44
43
 
45
44
  `READY_PENDING_GRANTS` means everything is wired but you still need to grant
46
- permissions in the iMCP menu-bar app. Minimum macOS: **15.3**.
45
+ permissions in the iMCP menu-bar app. `READY` is a live round trip through pi's
46
+ built-in MCP, never the provisioning traversal. Minimum macOS: **15.3**.
47
47
 
48
48
  ## Manual grant step
49
49
 
@@ -55,7 +55,12 @@ remediation**, not re-running the installer.
55
55
  ## Dashboard panel
56
56
 
57
57
  The plugin contributes a settings section under its own row in the Plugins tab:
58
- status readout, **Run installer**, `imcp-server` path override, `directTools`
59
- selection, and a server enable/disable toggle (writes a `disabled` override to
60
- the project-local `.pi/mcp.json`). It has **no per-service toggles** — those are
61
- menu-bar only.
58
+ status readout (`exposure`, `enabled`), **Run installer**, and the
59
+ `imcp-server` path override. Server enable/disable and exposure live in the
60
+ **mcp-client** plugin (Settings → MCP); the panel links there. It has **no
61
+ per-service toggles** — those are menu-bar only.
62
+
63
+ iMCP tools are reached as `mcp__iMCP__*` per the entry's `exposure` (`codemode`
64
+ by default; `deferred` via `tool_search`). Operator-set `enabled` / `exposure` /
65
+ `toolExposure` and unknown keys are preserved on refresh; only `command` is
66
+ rewritten.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blackbelt-technology/pi-dashboard-apple-tools",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Provision and surface iMCP (Apple PIM: Calendar, Contacts, Reminders, Messages, Location, Maps, Weather) for pi. One-command installer, a dashboard provisioning panel, and an agent skill. macOS-only; no Apple Mail.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -62,10 +62,10 @@
62
62
  "client": "./src/client/index.tsx",
63
63
  "server": "./src/server/index.ts",
64
64
  "configSchema": "./config.schema.json",
65
+ "dependsOn": [
66
+ "mcp-client"
67
+ ],
65
68
  "requires": {
66
- "piExtensions": [
67
- "pi-mcp-adapter"
68
- ],
69
69
  "paths": [
70
70
  "${imcpServerPath}"
71
71
  ]
@@ -73,7 +73,8 @@
73
73
  "claims": [
74
74
  {
75
75
  "slot": "settings-section",
76
- "component": "AppleToolsSettings"
76
+ "component": "AppleToolsSettings",
77
+ "module": "./src/client/AppleToolsSettings.tsx"
77
78
  }
78
79
  ]
79
80
  },
@@ -82,9 +83,11 @@
82
83
  "react-dom": ">=18.0.0"
83
84
  },
84
85
  "dependencies": {
85
- "@blackbelt-technology/dashboard-plugin-runtime": "^0.8.0",
86
- "@blackbelt-technology/pi-dashboard-shared": "^0.8.0",
87
- "pi-mcp-adapter": "^2.19.0"
86
+ "@blackbelt-technology/dashboard-plugin-runtime": "^0.10.0",
87
+ "@blackbelt-technology/pi-dashboard-mcp-client-plugin": "^0.10.0",
88
+ "@blackbelt-technology/pi-dashboard-shared": "^0.10.0",
89
+ "@mdi/js": "^7.4.47",
90
+ "@mdi/react": "^1.6.1"
88
91
  },
89
92
  "devDependencies": {
90
93
  "@types/react": "^19.0.0",
@@ -2,12 +2,12 @@
2
2
  /**
3
3
  * `pi-apple-tools-install [--check]` — opt-in CLI entry for iMCP provisioning.
4
4
  *
5
- * Never runs implicitly (no postinstall). Writes exactly two files in write
6
- * mode (`~/.pi/agent/mcp.json`, `~/.pi/agent/settings.json`) and NEVER touches
7
- * the server-owned plugin config store. `--check` reports the terminal state
5
+ * Never runs implicitly (no postinstall). Writes exactly one file in write
6
+ * mode (`~/.pi/agent/mcp.json` — pi's built-in MCP config; never
7
+ * `settings.json`) and NEVER touches the server-owned plugin config store. `--check` reports the terminal state
8
8
  * without mutating anything.
9
9
  *
10
- * See change: add-apple-tools-imcp-plugin.
10
+ * See changes: add-apple-tools-imcp-plugin, migrate-mcp-to-pi-builtin.
11
11
  */
12
12
  import { createInstallerEnv } from "../env.js";
13
13
  import { runInstaller } from "../install.js";
@@ -0,0 +1,403 @@
1
+ /**
2
+ * apple-tools · CLIENT entry.
3
+ *
4
+ * A settings-section rendered on the plugin's own settings page (no `tab` field —
5
+ * per dashboard-plugin-loader spec it renders only under the owning plugin).
6
+ * A provisioning surface, NOT a service switchboard: it shows the shared
7
+ * checker's terminal state as a word pill (never the raw token) with a notice
8
+ * naming the fix, offers [Run installer] (busy + result notice) and a path
9
+ * override, and links to the mcp-client plugin for server enable/disable +
10
+ * exposure (which live there). No per-Apple-service toggles (TCC is menu-bar
11
+ * only, no API). The host owns identity: no heading or id in the body.
12
+ *
13
+ * The path override is a draft on the host Save bar (`plugin:apple-tools`); the
14
+ * commit sends ONLY `imcpServerPath` (the server merges), so a path the
15
+ * installer reconciles meanwhile is never overwritten by a stale snapshot.
16
+ *
17
+ * A missing `dependsOn: ["mcp-client"]` requirement renders a banner that hides
18
+ * [Run installer] — provisioning would refuse without the service.
19
+ *
20
+ * See changes: add-apple-tools-imcp-plugin (Decision 5), extract-mcp-client-plugin,
21
+ * retro-ux-plugin-settings-wave-2.
22
+ */
23
+ import {
24
+ SettingsCopyButton,
25
+ SettingsItem,
26
+ SettingsNotice,
27
+ SettingsStatusPill,
28
+ type SettingsStatusTone,
29
+ TextField,
30
+ useSettingsDraftSource,
31
+ } from "@blackbelt-technology/dashboard-plugin-runtime";
32
+ import { usePluginConfig, usePluginSend } from "@blackbelt-technology/dashboard-plugin-runtime/context";
33
+ import { mdiOpenInNew, mdiRefresh } from "@mdi/js";
34
+ import { Icon } from "@mdi/react";
35
+ import { type ReactNode, useCallback, useEffect, useRef, useState } from "react";
36
+
37
+ const PLUGIN_ID = "apple-tools";
38
+ const DEFAULT_PATH = "/Applications/iMCP.app/Contents/MacOS/imcp-server";
39
+ const INSTALL_COMMAND = "pi-apple-tools-install";
40
+ /** The generic MCP server manager — where enable/disable + exposure live. */
41
+ const MANAGE_MCP_PATH = "/settings/plugins/mcp-client";
42
+ /** Plugins index — the missing-dependency banner's Enable affordance. */
43
+ const PLUGINS_INDEX_PATH = "/settings/plugins";
44
+
45
+ const BTN_BASE =
46
+ "focus-ring inline-flex min-h-[32px] items-center gap-1 rounded-md px-2 text-[12px] font-semibold disabled:cursor-not-allowed disabled:opacity-60";
47
+ const BTN_PRIMARY = `${BTN_BASE} bg-[var(--accent-solid)] text-white hover:opacity-90`;
48
+ const BTN_SECONDARY = `${BTN_BASE} border border-[var(--border-secondary)] bg-[var(--bg-tertiary)] text-[var(--text-primary)] hover:bg-[var(--bg-hover)]`;
49
+ const BTN_GHOST = `${BTN_BASE} text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]`;
50
+
51
+ interface AppleToolsConfig {
52
+ imcpServerPath?: string;
53
+ }
54
+
55
+ interface StatusReadout {
56
+ platform: string;
57
+ state: string;
58
+ message: string;
59
+ resolvedPath?: string;
60
+ imcpServerPath: string;
61
+ /** False when iMCP.app is absent — provisioning must go through the CLI. */
62
+ appPresent: boolean;
63
+ }
64
+
65
+ interface InstallResult {
66
+ tone: "success" | "info" | "warning";
67
+ text: string;
68
+ }
69
+
70
+ interface PillSpec {
71
+ tone: SettingsStatusTone;
72
+ word: string;
73
+ }
74
+
75
+ /**
76
+ * Provisioning state → pill word. "Checking" and "Not installed" are UI-only
77
+ * labels: a failure member always wins over `appPresent`.
78
+ */
79
+ function pillFor(status: StatusReadout | null): PillSpec {
80
+ if (!status) return { tone: "info", word: "Checking" };
81
+ if (status.platform !== "darwin") return { tone: "neutral", word: "Unsupported platform" };
82
+ switch (status.state) {
83
+ case "READY_PENDING_GRANTS":
84
+ case "READY":
85
+ return status.appPresent ? { tone: "success", word: "Installed" } : { tone: "neutral", word: "Not installed" };
86
+ case "OS_TOO_OLD":
87
+ return { tone: "warning", word: "macOS too old" };
88
+ case "OS_VERSION_UNKNOWN":
89
+ return { tone: "warning", word: "macOS version unknown" };
90
+ case "UNSUPPORTED_PLATFORM":
91
+ return { tone: "neutral", word: "Unsupported platform" };
92
+ case "NO_INSTALL_METHOD":
93
+ return { tone: "warning", word: "Can't install automatically" };
94
+ case "INSTALL_FAILED":
95
+ return { tone: "error", word: "Install failed" };
96
+ case "CONFIG_UNPARSEABLE":
97
+ return { tone: "error", word: "Config unreadable" };
98
+ case "CONFIG_WRITE_FAILED":
99
+ return { tone: "error", word: "Config not saved" };
100
+ default:
101
+ return { tone: "neutral", word: "Status unknown" };
102
+ }
103
+ }
104
+
105
+ /** "macOS 14.6.1 is below the minimum supported 15.3." → { running, minimum }. */
106
+ function parseOsVersions(message: string): { running?: string; minimum?: string } {
107
+ const m = /macOS\s+(\S+)\s+is below the minimum supported\s+(\d+(?:\.\d+)*)/.exec(message);
108
+ return m ? { running: m[1], minimum: m[2] } : {};
109
+ }
110
+
111
+ /**
112
+ * This plugin's own loader row `missingDeps` (a `dependsOn` gap). Fetched from
113
+ * `GET /api/plugins` because the server's row is the single source of truth for
114
+ * the dependency graph. A fetch failure leaves the list empty rather than
115
+ * blocking the panel.
116
+ */
117
+ function useMissingDeps(): string[] {
118
+ const [missing, setMissing] = useState<string[]>([]);
119
+ useEffect(() => {
120
+ let alive = true;
121
+ void (async () => {
122
+ try {
123
+ const res = await fetch("/api/plugins");
124
+ if (!res.ok) return;
125
+ const body = (await res.json()) as {
126
+ plugins?: Array<{ id?: string; status?: { missingDeps?: string[] } | null }>;
127
+ };
128
+ const row = (body.plugins ?? []).find((p) => p.id === PLUGIN_ID);
129
+ if (alive) setMissing(row?.status?.missingDeps ?? []);
130
+ } catch {
131
+ /* leave empty */
132
+ }
133
+ })();
134
+ return () => {
135
+ alive = false;
136
+ };
137
+ }, []);
138
+ return missing;
139
+ }
140
+
141
+ export function AppleToolsSettings() {
142
+ const config = usePluginConfig<AppleToolsConfig>();
143
+ const send = usePluginSend();
144
+ const [status, setStatus] = useState<StatusReadout | null>(null);
145
+ const [fetchError, setFetchError] = useState<string | null>(null);
146
+ const [checking, setChecking] = useState(false);
147
+ const [busy, setBusy] = useState(false);
148
+ const [result, setResult] = useState<InstallResult | null>(null);
149
+ const missingDeps = useMissingDeps();
150
+
151
+ // Path draft: `null` = untouched (follows the stored value / broadcasts).
152
+ const stored = config?.imcpServerPath ?? DEFAULT_PATH;
153
+ const [pathEdit, setPathEdit] = useState<string | null>(null);
154
+ // A broadcast that now equals the edit settles it, so a stale edit never shadows a later one.
155
+ useEffect(() => {
156
+ setPathEdit((prev) => (prev !== null && prev.trim() === stored ? null : prev));
157
+ }, [stored]);
158
+ const path = pathEdit ?? stored;
159
+ const pathError = path.trim() === "" ? "Enter the path to imcp-server, or reset to the default." : null;
160
+ const isDirty = pathEdit !== null && pathEdit.trim() !== stored;
161
+
162
+ const latest = useRef({ pathEdit, pathError, stored });
163
+ latest.current = { pathEdit, pathError, stored };
164
+ const commit = useCallback(async () => {
165
+ const { pathEdit: edit, pathError: err, stored: current } = latest.current;
166
+ if (err) throw new Error(err);
167
+ if (edit === null || edit.trim() === current) return;
168
+ await send({ type: "plugin_config_write", id: PLUGIN_ID, config: { imcpServerPath: edit.trim() } });
169
+ }, [send]);
170
+ const reset = useCallback(() => setPathEdit(null), []);
171
+ // Typing back the stored path drops the edit (no ghost draft that a later
172
+ // broadcast — e.g. the installer reconciling the path — would turn into an
173
+ // edit that reverts it). doubt-review 4.50 #1.
174
+ const editPath = (v: string) => setPathEdit(v === stored ? null : v);
175
+ useSettingsDraftSource({ id: "plugin:apple-tools", isDirty, commit, reset });
176
+
177
+ const refresh = useCallback(async (): Promise<StatusReadout | null> => {
178
+ try {
179
+ const res = await fetch(`/api/${PLUGIN_ID}/status`);
180
+ // A 404/500 body is not a StatusReadout — storing it would render garbage.
181
+ if (!res.ok) {
182
+ setFetchError(`status request failed (${res.status})`);
183
+ return null;
184
+ }
185
+ const next = (await res.json()) as StatusReadout;
186
+ setStatus(next);
187
+ setFetchError(null);
188
+ return next;
189
+ } catch (e) {
190
+ setFetchError(e instanceof Error ? e.message : String(e));
191
+ return null;
192
+ }
193
+ }, []);
194
+
195
+ useEffect(() => {
196
+ void refresh();
197
+ }, [refresh]);
198
+
199
+ async function checkAgain(): Promise<void> {
200
+ setChecking(true);
201
+ setResult(null);
202
+ await refresh();
203
+ setChecking(false);
204
+ }
205
+
206
+ /** Fire the installer action, then re-read the status so the panel converges. */
207
+ async function runInstaller(): Promise<void> {
208
+ setBusy(true);
209
+ setResult(null);
210
+ try {
211
+ await send({ type: "plugin_action", pluginId: PLUGIN_ID, action: "run-installer", payload: {} });
212
+ await new Promise((r) => setTimeout(r, 500));
213
+ const next = await refresh();
214
+ const word = pillFor(next).word;
215
+ setResult(
216
+ next
217
+ ? { tone: pillFor(next).tone === "success" ? "success" : "info", text: `Installer finished. iMCP now shows: ${word}.` }
218
+ : { tone: "warning", text: "Installer ran, but iMCP could not be checked afterwards. Try Check again." },
219
+ );
220
+ } finally {
221
+ setBusy(false);
222
+ }
223
+ }
224
+
225
+ const isMac = status ? status.platform === "darwin" : true;
226
+ const pill = pillFor(fetchError && !status ? null : status);
227
+ const showPill = !(fetchError && !status);
228
+ const notInstalled = pill.word === "Not installed";
229
+ const installed = pill.word === "Installed";
230
+ const noMissing = missingDeps.length === 0;
231
+
232
+ const checkAgainButton = (
233
+ <button type="button" className={BTN_GHOST} disabled={checking} onClick={() => void checkAgain()}>
234
+ <Icon path={mdiRefresh} size={0.55} aria-hidden="true" />
235
+ Check again
236
+ </button>
237
+ );
238
+ const installAction = (
239
+ <SettingsCopyButton text={INSTALL_COMMAND} label="Copy command" />
240
+ );
241
+ const details = status ? `${status.state}: ${status.message}` : null;
242
+ const os = status ? parseOsVersions(status.message) : {};
243
+
244
+ /** Notice for every state except Installed and Checking (those have their own copy). */
245
+ function stateNotice(): ReactNode {
246
+ if (!status || !isMac) return null;
247
+ switch (pill.word) {
248
+ case "Not installed":
249
+ return noMissing ? (
250
+ <SettingsNotice tone="info" testId="apple-tools-needs-cli" actions={<>{installAction}{checkAgainButton}</>}>
251
+ Install iMCP from a terminal on this Mac, then check again: <code className="font-mono text-[12px]">{INSTALL_COMMAND}</code>
252
+ </SettingsNotice>
253
+ ) : null;
254
+ case "Installed":
255
+ return (
256
+ <SettingsNotice tone="info" testId="apple-tools-notice">
257
+ Grant Calendar, Contacts and other access in the iMCP menu-bar app. This page cannot do it for you.
258
+ </SettingsNotice>
259
+ );
260
+ case "macOS too old":
261
+ return (
262
+ <SettingsNotice tone="warning" testId="apple-tools-notice" details={details} actions={checkAgainButton}>
263
+ {`iMCP needs macOS ${os.minimum ?? "a newer version"}${os.minimum ? " or later" : ""}. ${
264
+ os.running ? `This Mac runs ${os.running}. ` : ""
265
+ }Update macOS, then come back to install iMCP.`}
266
+ </SettingsNotice>
267
+ );
268
+ case "macOS version unknown":
269
+ return (
270
+ <SettingsNotice tone="warning" testId="apple-tools-notice" details={details} actions={checkAgainButton}>
271
+ This Mac's macOS version could not be read. Check it under About This Mac, then check again.
272
+ </SettingsNotice>
273
+ );
274
+ case "Can't install automatically":
275
+ return (
276
+ <SettingsNotice tone="warning" testId="apple-tools-notice" details={details} actions={checkAgainButton}>
277
+ Homebrew isn't available, so iMCP can't be installed for you. Install Homebrew or iMCP yourself, then check again.
278
+ </SettingsNotice>
279
+ );
280
+ case "Install failed":
281
+ return (
282
+ <SettingsNotice tone="error" testId="apple-tools-notice" details={details} actions={<>{installAction}{checkAgainButton}</>}>
283
+ The iMCP install did not finish. Run <code className="font-mono text-[12px]">{INSTALL_COMMAND}</code> in a terminal to see why, then check again.
284
+ </SettingsNotice>
285
+ );
286
+ case "Config unreadable":
287
+ return (
288
+ <SettingsNotice tone="error" testId="apple-tools-notice" details={details} actions={checkAgainButton}>
289
+ The MCP config file could not be read. Fix its JSON syntax, then check again.
290
+ </SettingsNotice>
291
+ );
292
+ case "Config not saved":
293
+ return (
294
+ <SettingsNotice tone="error" testId="apple-tools-notice" details={details} actions={checkAgainButton}>
295
+ The MCP config could not be saved. Make sure the file is writable, then check again.
296
+ </SettingsNotice>
297
+ );
298
+ default:
299
+ return (
300
+ <SettingsNotice tone="warning" testId="apple-tools-notice" details={details} actions={checkAgainButton}>
301
+ iMCP reported a state this page does not know. Check again, or run the installer in a terminal.
302
+ </SettingsNotice>
303
+ );
304
+ }
305
+ }
306
+
307
+ return (
308
+ <div data-testid="apple-tools-settings" className="space-y-3">
309
+ {missingDeps.length > 0 && (
310
+ <SettingsNotice tone="warning" testId="apple-tools-missing-deps">
311
+ Provisioning needs <code className="font-mono text-[12px]">{missingDeps.join(", ")}</code>.{" "}
312
+ <a className="font-semibold text-[var(--link)] underline" href={PLUGINS_INDEX_PATH}>
313
+ Enable it in Plugins
314
+ </a>{" "}
315
+ first.
316
+ </SettingsNotice>
317
+ )}
318
+
319
+ {fetchError && (
320
+ <SettingsNotice
321
+ tone="error"
322
+ testId="apple-tools-error"
323
+ onRetry={() => void checkAgain()}
324
+ retrying={checking}
325
+ details={fetchError}
326
+ >
327
+ Could not check iMCP on this Mac. The dashboard server did not answer.
328
+ </SettingsNotice>
329
+ )}
330
+
331
+ {showPill && (
332
+ <SettingsItem
333
+ title="iMCP"
334
+ subtitle="Apple Calendar, Contacts, Reminders and Messages as MCP tools"
335
+ status={
336
+ <SettingsStatusPill tone={pill.tone} testId="apple-tools-status" status={status?.state}>
337
+ {pill.word}
338
+ </SettingsStatusPill>
339
+ }
340
+ actions={
341
+ isMac && noMissing && status?.appPresent && !notInstalled ? (
342
+ <button
343
+ type="button"
344
+ data-testid="apple-tools-run-installer"
345
+ className={installed ? BTN_SECONDARY : BTN_PRIMARY}
346
+ disabled={busy}
347
+ aria-busy={busy || undefined}
348
+ onClick={() => void runInstaller()}
349
+ >
350
+ {busy ? "Running installer…" : installed ? "Reinstall" : "Run installer"}
351
+ </button>
352
+ ) : null
353
+ }
354
+ />
355
+ )}
356
+
357
+ {!isMac && (
358
+ <SettingsNotice tone="info" testId="apple-tools-unsupported">
359
+ iMCP only runs on macOS, so there is nothing to set up on this computer.
360
+ </SettingsNotice>
361
+ )}
362
+
363
+ {stateNotice()}
364
+
365
+ {result && (
366
+ <SettingsNotice tone={result.tone} role="status" testId="apple-tools-install-result">
367
+ {result.text}
368
+ </SettingsNotice>
369
+ )}
370
+
371
+ {isMac && (
372
+ <>
373
+ <TextField
374
+ label="iMCP server path"
375
+ hint="Change this only if iMCP is installed somewhere other than Applications."
376
+ mono
377
+ value={path}
378
+ onChange={editPath}
379
+ error={pathError}
380
+ state={path === DEFAULT_PATH ? "default" : "changed"}
381
+ onReset={path === DEFAULT_PATH ? undefined : () => editPath(DEFAULT_PATH)}
382
+ testIds={{ control: "apple-tools-path" }}
383
+ />
384
+
385
+ <SettingsItem
386
+ title="Tools in sessions"
387
+ subtitle="Turn iMCP on or off and choose which tools sessions get in MCP Client."
388
+ actions={
389
+ <a data-testid="apple-tools-manage-mcp" href={MANAGE_MCP_PATH} className={BTN_SECONDARY}>
390
+ Manage MCP servers
391
+ <Icon path={mdiOpenInNew} size={0.55} aria-hidden="true" />
392
+ </a>
393
+ }
394
+ />
395
+
396
+ <SettingsNotice tone="info" testId="apple-tools-permissions">
397
+ Calendar, Contacts and other Apple permissions are granted in the iMCP menu-bar app. This page cannot change them.
398
+ </SettingsNotice>
399
+ </>
400
+ )}
401
+ </div>
402
+ );
403
+ }