Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .memory/imcp-connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ Review round 1 (Pullfrog, 2026-10-26): Manage → Save and the dialog's switch d
## Approved executable identity — 2026-11-02

The desktop checks both signatures at setup and at every launch. The universal launcher uses a macOS launch requirement for Developer ID team TTY35UM57S and identifier imcp-server. These match the installed iMCP 1.8.0 distribution. The stored approval still names the selected Applications path. CLI discovery skips old imported iMCP preset records, which remain removable.

The Settings Open action rechecks the originating document after bundle probes and immediately before invoking the OS open operation. The per-launch signed server requirement is separate.
6 changes: 6 additions & 0 deletions .memory/mcp-numeric-schema-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ Draft-07 schema-valued dependencies now normalize too; property-name dependency
Independent review identified a silent 64-level cutoff that could leave numeric formats unnormalized. Traversal now uses an iterative worklist and weak object-copy map, preserving raw identity and schema-keyword boundaries while normalizing deep schemas fully; a 2,000-level regression covers this case.

Status (2026-10-01): merged in PR #264 (on main after 0.51.0); plan moved to `docs/plans/completed/`.

## Connector authority, 2026-11-02

Desktop execution checks the live inventory on the executing client, including provider-authenticated scoped connections. Servers without change notifications are listed again for execution. List changes invalidate pending reads and guards, and changed titles, descriptions, input or output schemas, and effect annotations require refreshing the tool. This keeps exact Bot output-schema grants valid through dispatch. Workspace connector IDs are opaque strings. Child discovery filters their exact IDs before credential lookup or a connection. Previously trimmed IDs have no recoverable provenance.

Remote tool calls now recheck the captured inventory revision after credential lookup and on each OAuth retry. On servers without notifications, a differing complete listing on the same client also revokes the earlier guard. A child rechecks its foreground grant before a retry. The isolated subagent spends its network operation on the first authorized send. For a mutation, the durable dispatch marker still precedes any network attempt. If the live transport proves that the first send never occurred, the journal records cancellation. Failures after a send, or a restart with only the dispatch marker, retain an unknown outcome.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ I don't come from a coding background. I'd been bouncing between the coding agen
- **Rich responses and local diagnostics** - render sandboxed HTML, chart, math, and raster artifacts with recovery/export controls, and inspect or export bounded local diagnostics without an automatic upload path.
- **Desktop integration and appearance** - native menus (on Linux, behind a ☰ button in Aiden's own title bar, or the system title bar if you prefer; see [Linux](docs/linux.md)), encrypted system credential storage, **Parakeet**, the dictation pill, semantic themes, high contrast, reduced motion, and consistent light/dark rendering. Appearance → Chat controls work-detail density and collapse timing, the shared chat-link destination, and the desktop Queue/Steer default (Cmd/Ctrl+Enter uses the other action while busy). Apple **Foundation Models**, Accessibility auto-paste, and the signed **Rust** Computer Use broker remain macOS-only. On Apple silicon, Parakeet also runs on the GPU through **transcribe.cpp** (Metal) and shows dictated words in the pill and the composer as you speak; Intel Macs, Linux and the headless server keep sherpa-onnx.
- **Shared browser and annotations** - browse beside the chat in Environment, preview workspace HTML/PDF files, use isolated profiles and responsive viewports, and share selected text, elements, drawings, and image crops with Aiden. Aiden's browser tools operate on those same tabs. See [browser behavior and controls](docs/environment-browser.md).
- **Extensibility and background work** - use skills, **Connectors** (Aiden's catalog of hosted MCP services such as Linear, Notion, GitHub and Composio, the local Figma Desktop server, on a Mac the [iMCP](https://github.com/mattt/iMCP) app for Calendar, Contacts, Messages, Reminders and more, or any custom MCP server), **Exa** search, scheduled tasks, voice, and attachments through typed, allowlisted boundaries.
- **Extensibility and background work** - use skills, **Connectors** (Aiden's catalog of hosted MCP services such as Linear, Notion, GitHub and Composio, the local Figma Desktop server, on a Mac the [iMCP](https://github.com/mattt/iMCP) app for Calendar, Contacts, Messages, Reminders and more, or any custom MCP server), **Exa** search, scheduled tasks, voice, and attachments through typed, allowlisted boundaries. A running chat checks connector tools against the current inventory before execution. Each remote tool request checks again after obtaining credentials, including when retrying after an authorization challenge. Workspace-disabled connectors are skipped during subagent discovery.
- **Projects on paired computers** - clone a local repository into an approved folder on a connected desktop and explicitly select any environment files to transfer. The destination uses its own Git credentials. See [paired project setup](docs/aiden-on-the-go-remote-access.md#add-a-local-project-to-a-paired-computer).
- **Aiden On The Go** - opt in to a pinned local-network connection or an explicit non-Funnel Tailscale Serve route, pair each iPhone, iPad, or Android device separately, and revoke devices from [Remote Access settings](docs/aiden-on-the-go-remote-access.md).
- **Updates and release safety** - signed builds use the verified GitHub release feed. Once an update is downloaded, Aiden shows the version above Profile with **Later** and **Restart now**, then follows the normal save and shutdown guards before relaunching.
Expand Down
2 changes: 1 addition & 1 deletion docs/plans/workspace-settings-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Each folder workspace can switch off specific skills and connectors (MCP servers
## v1 (desktop)

- `Workspace.disabledSkills` (canonical skill names) and `Workspace.disabledMcpServerIds` live in the device-local config. Damaged values are cleaned on load instead of dropping the workspace. New managed worktrees copy their project's lists.
- Enforcement in the main process: the skill registry hides switched-off skills from the prompt, the skill tools and Pi resources; the connector collector, the subagent connector inventory, `list_mcp_servers` and the context meter skip switched-off connectors. Bot and approved-automation runs keep their exact grants.
- Enforcement in the main process: the skill registry hides switched-off skills from the prompt, the skill tools and Pi resources; the connector collector, the subagent connector inventory, `list_mcp_servers` and the context meter skip switched-off connectors. Connector off-lists preserve exact configured IDs, including surrounding whitespace. Subagent discovery skips these records before credential lookup or connection. Bot and approved-automation runs keep their exact grants.
- The pop-up (`renderer/components/workspace-settings-dialog.tsx`): General (name, folder, access, memory), Skills, Connectors. Entry points: the sidebar ⋯ menu, the top-bar workspace chip menu, the command palette and `⇧⌘,`. Design notes: [settings design system](../settings-design-system.md#workspace-settings).
- Tests: `skill-registry.test.ts`, `assistant/mcp-tool.test.ts`, `config-store-core.test.ts`, `workspace-application-service.test.ts`, `renderer/lib/workspace-settings-view.test.ts` and the Electron spec `tests/e2e/workspace-settings.spec.ts`, which checks the next model request no longer offers a switched-off skill.

Expand Down
11 changes: 10 additions & 1 deletion main/handlers/mcp-controls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function setup(saved: McpServer[] = [linear], registry = new McpLiveStatusRegist
approveLaunch: (server, fingerprint) => approvals.approveShown(server, fingerprint),
launchApproved: (server) => approvals.isApproved(server),
macAppStatus: (preset) => mcpMacAppStatus(preset, macWithImcp(opened)),
openMacApp: (preset) => openMcpMacApp(preset, macWithImcp(opened)),
openMacApp: (preset, isCurrent) => openMcpMacApp(preset, macWithImcp(opened), isCurrent),
};
registerMcpControlHandlers(deps);
const invoke = (channel: string, event: string, ...args: unknown[]) =>
Expand Down Expand Up @@ -314,3 +314,12 @@ test("Mac app status and Open serve only a Mac app connector, from the live docu
await assert.rejects(ipc.invoke("mcp:openMacApp", "settings", "imcp"), /active application document/u);
assert.deepEqual(ipc.opened, ["/Applications/iMCP.app"], "nothing else was opened");
});

test("losing Settings authority during the installed-app probe prevents the OS open", async () => {
const ipc = setup();
const opening = ipc.invoke("mcp:openMacApp", "settings", "imcp");
await Promise.resolve();
ipc.invalidate();
await assert.rejects(opening, /active application document/u);
assert.deepEqual(ipc.opened, []);
});
4 changes: 2 additions & 2 deletions main/handlers/mcp-controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface McpControlDependencies<Event> {
/** Where a Mac app connector's app is installed and whether it is open. Read-only. */
macAppStatus(preset: MacAppMcpPreset): Promise<McpMacAppStatus>;
/** Open the installed app: only because the person chose Open in Settings. */
openMacApp(preset: MacAppMcpPreset): Promise<void>;
openMacApp(preset: MacAppMcpPreset, isCurrent: () => boolean): Promise<void>;
}

const INACTIVE = "MCP changes must come from the active application document.";
Expand Down Expand Up @@ -231,7 +231,7 @@ export function registerMcpControlHandlers<Event>(deps: McpControlDependencies<E
deps.handle("mcp:openMacApp", async (event, presetId: unknown) => {
const isCurrent = live(event);
const preset = macAppPreset(presetId);
await deps.openMacApp(preset);
await deps.openMacApp(preset, isCurrent);
if (!isCurrent()) throw new Error(INACTIVE);
return { opened: true };
});
Expand Down
2 changes: 1 addition & 1 deletion main/handlers/phase2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ export function registerPhase2Handlers(): void {
},
launchApproved: (server) => mcpStdioApprovals.isApproved(server),
macAppStatus: (preset) => mcpMacAppStatus(preset),
openMacApp: (preset) => openMcpMacApp(preset),
openMacApp: (preset, isCurrent) => openMcpMacApp(preset, undefined, isCurrent),
});
mcpLiveStatus.subscribe((status) => ipcMain.broadcast("mcp:statusChanged", status));
// Force-drop all cached MCP connections so the next message reconnects fresh.
Expand Down
7 changes: 5 additions & 2 deletions main/services/config-store-core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
isProviderAliasMap,
splitStoredProvider,
} from "./portable-config-core.js";
import { withoutWorkspaceDisabledMcpServers } from "./workspace-capabilities.js";
import { freshWebSearchSettings } from "./web-search-provider-registry-core.js";
import { defaultWebFetchSettings } from "../../renderer/shared/web-fetch-settings.js";
import type { AssistantConfig, StoredProvider, Workspace } from "./types.js";
Expand Down Expand Up @@ -537,7 +538,7 @@ test("a workspace keeps only a literal scratch mark across saves and reloads", a
test("workspace skill and connector off-lists survive restarts, and a damaged list never loses the workspace", async (t) => {
const h = await harness(t);
const base = { permission: "ask" as const, createdAt: 1, updatedAt: 1 };
await h.store.saveWorkspace({ ...base, id: "client", name: "Client", disabledSkills: ["Deploy"], disabledMcpServerIds: ["gmail"] });
await h.store.saveWorkspace({ ...base, id: "client", name: "Client", disabledSkills: ["Deploy"], disabledMcpServerIds: [" gmail ", "\tgithub"] });
await h.store.saveWorkspace({ ...base, id: "damaged", name: "Damaged" });
const local = await readJson<{ workspaces: Array<Record<string, unknown>> }>(h.localFile);
for (const entry of local.workspaces) {
Expand All @@ -554,7 +555,9 @@ test("workspace skill and connector off-lists survive restarts, and a damaged li
);
const client = await next.getWorkspace("client");
assert.deepEqual(client?.disabledSkills, ["deploy"]);
assert.deepEqual(client?.disabledMcpServerIds, ["gmail"]);
assert.deepEqual(withoutWorkspaceDisabledMcpServers(
[" gmail ", "gmail", "\tgithub", "github"].map(id => ({ id })), client?.disabledMcpServerIds,
).map(server => server.id), ["gmail", "github"]);
const damaged = await next.getWorkspace("damaged");
assert.equal(damaged?.name, "Damaged");
assert.equal("disabledSkills" in (damaged ?? {}), false);
Expand Down
6 changes: 2 additions & 4 deletions main/services/llm-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ async function prepareGeneration(
const subagentWebEnabled = subagentWebAvailability?.ready === true;
const discoveredSubagentMcpInventory =
allowSubagents && childMcpRollout && subagentRunStore.selection === "v2"
? await resolveProductionSubagentMcpInventory(signal)
? await resolveProductionSubagentMcpInventory(signal, { disabledMcpServerIds: workspaceDisabledMcpServerIds })
: [];
const botSubagentMcpConnectionIdentities =
botContext && discoveredSubagentMcpInventory.length > 0
Expand All @@ -1396,9 +1396,7 @@ async function prepareGeneration(
discoveredSubagentMcpInventory,
botSubagentMcpConnectionIdentities,
)
: discoveredSubagentMcpInventory.filter(
(scope) => !workspaceDisabledMcpServerIds?.includes(scope.serverId),
);
: discoveredSubagentMcpInventory;
const subagentShellBinary = resolveSubagentShellRunnerBinary();
const subagentShellEnabled =
allowSubagents &&
Expand Down
24 changes: 16 additions & 8 deletions main/services/mcp-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Thin Aiden conventions over Pi's MCP client (`@earendil-works/pi-mcp`).
// Every desktop MCP client connection goes through these helpers so request
// bounds, cancellation and connection deadlines behave the same everywhere.
import { AsyncLocalStorage } from "node:async_hooks";
import {
McpAbortError,
McpClient,
Expand All @@ -14,6 +15,8 @@ import {
* it, each progress notification restarts the timeout.
*/
export interface McpCallOptions {
/** Recheck tool authority immediately before each remote HTTP attempt. */
beforeSend?: () => void;
signal?: AbortSignal;
timeoutMs?: number;
onProgress?: McpRequestOptions["onProgress"];
Expand Down Expand Up @@ -41,21 +44,26 @@ export function withMcpAbortReason<T>(pending: Promise<T>, signal: AbortSignal |
});
}

// Pi allocates the RPC id inside request(). Its transport binds this guard
// to that id, so unrelated calls and shared authorization work keep their own authority.
export const mcpToolSendGuard = new AsyncLocalStorage<(() => void) | undefined>();

/** One raw request, with Aiden's bounds and abort-reason convention. */
export function mcpRequest<T>(
client: McpRequester,
method: string,
params: Record<string, unknown> | undefined,
options: McpCallOptions = {},
): Promise<T> {
return withMcpAbortReason(
client.request<T>(method, params, {
...(options.signal ? { signal: options.signal } : {}),
...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
...(options.onProgress ? { onProgress: options.onProgress } : {}),
}),
options.signal,
);
const request = () => client.request<T>(method, params, {
...(options.signal ? { signal: options.signal } : {}),
...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
...(options.onProgress ? { onProgress: options.onProgress } : {}),
});
const pending = method === "tools/call"
? mcpToolSendGuard.run(options.beforeSend, request)
: request();
return withMcpAbortReason(pending, options.signal);
}

function abortReason(signal: AbortSignal): unknown {
Expand Down
2 changes: 2 additions & 0 deletions main/services/mcp-mac-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ export async function isMcpMacAppOpen(
export async function openMcpMacApp(
preset: MacAppMcpPreset,
probe: McpMacAppProbe = nodeMacAppProbe(),
isCurrent: () => boolean = () => true,
): Promise<void> {
if (probe.platform !== "darwin") throw new Error(`${preset.name} works only on a Mac.`);
const installed = await findMacApp(preset.macApp, probe);
if (!installed) throw new Error(`${preset.name} isn’t in your Applications folder.`);
if (!isCurrent()) throw new Error("Opening this app requires the active application document.");
await probe.open(installed.bundle);
}

Expand Down
4 changes: 2 additions & 2 deletions main/services/mcp-provider-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ export async function setMcpProviderAuthGrant(server: McpServer, allowed: boolea
await secrets.setInternalKey(mcpProviderGrantKey(server.id), binding, 1024, isCurrent);
}

export function mcpProviderAuthenticatedFetch(server: McpServer, isCurrent: () => boolean): typeof fetch {
export function mcpProviderAuthenticatedFetch(server: McpServer, isCurrent: () => boolean, fetch: typeof globalThis.fetch): typeof fetch {
const expected = mcpRuntimeConnectionSnapshot(server);
return createMcpProviderAuthenticatedFetch({
server,
server, fetch,
assertCurrent() { if (!isCurrent()) throw new Error("This MCP connection is no longer current."); },
async readGrant() {
const current = (await configStore.listMcpServers()).find((item) => item.id === server.id);
Expand Down
Loading
Loading