Repository navigation
aiden serve: host the loopback /mcp endpoint, managed with aiden apps - #802
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to claude/aiden-mcp-serve
The headless server now runs the same AidenMcpHost and tool runner as the desktop, inside its Remote runtime, on loopback ports 49500-49507 so it never takes a desktop's port. It stays off until the first `aiden apps connect` or `aiden apps on`. `aiden apps list|connect|revoke|on|off` reach the running server over its control socket. Connect shows the token once, with Claude Code and Codex commands that read it from AIDEN_MCP_TOKEN. Revoke shares the Remote revocation path and refuses a phone's id. Admin commands send no analytics, and app chats and turns send no usage events, as on the desktop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ Two narrow correctness gaps worth fixing inline.
Reviewed changes across all 15 files, covering the headless MCP host wiring, daemon administration, shared Remote runtime integration, dependency/bundle impact, documentation, and behavioral tests.
- MCP host lifecycle — Adds the loopback host to
aiden serve, with persisted enablement/port state, shared chat services, and ordered startup/shutdown. - App administration — Adds
aiden apps list|connect|revoke|on|offover the private daemon socket, one-time credentials, Read/Supervised access, and shared revocation cleanup. - Privacy and distribution — Suppresses app-originated chat analytics, keeps the admin client light, pins the MCP SDK, and documents the headless security/network posture.
- Behavioral coverage — Exercises the real daemon and Streamable HTTP endpoint, authentication, tool access, chat generation, provenance, revocation, restart persistence, invalid input, and
--no-remotebehavior.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
The MCP host revokes with the desktop's when-available mode: the token is tombstoned first, so a BotCapabilityUnavailableError while clearing Bot notices is reported on stderr instead of failing the revoke. aiden remote revoke keeps requiring the notice cleanup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found in the incremental changes.
Reviewed changes since the prior Pullfrog review, covering the repair-tolerant app revocation path and its regression coverage.
- Hardened app revocation — Allowed an already-tombstoned outside app to remain disconnected when Bot notice storage requires repair, while preserving strict failures for paired devices and unrelated errors.
- Added behavioral coverage — Exercised revocation against damaged Bot capability state and verified both token rejection and the persisted revoked projection.
- Synchronized the stacked base — Merged the latest MCP server core changes without adding another net behavioral delta to this PR.
@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using GPT Sol | 𝕏
… fallback An app name's 80-character limit counted UTF-16 units, so 41 emoji were refused. It now counts code points, like the other names Aiden keeps. The docs said the server only ever uses 49500 and the next seven ports; on first start with all eight busy, the shared host lets the system pick a free loopback port and saves it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ No new issues in the incremental changes. The earlier port-documentation finding remains partially addressed because the threat model still presents 49500–49507 as exhaustive.
Reviewed changes since the prior Pullfrog review, covering the Unicode app-name fix, its behavioral coverage, and the corrected first-run port documentation.
-
Aligned app-name validation — Counted Unicode code points for the 80-character limit, matching the shared Remote state registry.
-
Added boundary coverage — Verified that 80 emoji are accepted unchanged and 81 emoji are rejected.
-
Corrected port guidance — Documented the arbitrary free loopback-port fallback in the MCP guide and CLI README when all eight preferred ports are busy on first start.
@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using GPT Sol | 𝕏
The CLI's setup commands now use core's aidenMcpTokenEnvName, the same per-app AIDEN_MCP_TOKEN_<NAME>_<ID> the desktop Settings sheet prints, so connecting a second app in one shell profile no longer replaces the first app's token. A real-shell test checks each app's commands send its own token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review, covering the shared revocation-policy integration and per-app MCP token variables.
- Shared revocation policy — Replaced the CLI’s local repair handling with the tested Bot-notice revoke helper while preserving strict paired-device cleanup.
- Isolated app credentials — Generated each app’s setup commands from the shared
aidenMcpTokenEnvNamehelper so multiple shell-profile tokens do not overwrite one another. - Added behavioral coverage — Exercised the generated Claude Code and Codex commands in a real shell and verified each sends its own token.
- Synchronized the stacked base — Merged the latest MCP server core changes needed by both shared helpers.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
…tens Match #818: server text about the computer it runs on names it with localComputerNoun, so macOS says 'this Mac only' and Linux 'this computer only'.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review, covering the platform-specific MCP listener copy and stacked-base synchronization.
- Adapted local-host wording — Used the shared
localComputerNounhelper so MCP setup and daemon output say “this Mac only” on macOS and “this computer only” elsewhere. - Synchronized the stacked base — Merged the latest MCP server core without adding another net behavioral change to this PR.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
# Conflicts: # packages/cli/README.md
# Conflicts: # packages/cli/package-lock.json # packages/cli/package.json
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review, covering the three main merges and their conflict resolutions.
- Synchronized CLI dependencies — Updated the standalone CLI to the shared Pi
1.5.2line while preserving the MCP SDK dependency and MCP app test registration. - Preserved merged documentation — Kept the outside-apps MCP guidance alongside the new workspace-tool, generation-limit, and OAuth-refresh documentation from
main. - Validated the merged runtime — Confirmed the CLI bundle builds, type-checks, and passes all 6 focused MCP app integration tests.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
# Conflicts: # packages/cli/package.json

Stacked on #800 (W4a, the MCP server core). Base:
claude/aiden-mcp-server-core.What this does
aiden servenow hosts the same loopback/mcpendpoint as the desktop. Outside apps such as Claude Code, Codex or any MCP client on the same computer can list the server's workspaces and chats and read them. With Supervised access they can also start and follow turns. The new admin commandaiden appsmanages it.It reuses W4a's
AidenMcpHost,AidenMcpToolRunnerand provenance log, imported frommain/services. Nothing is vendored.@modelcontextprotocol/sdkis pinned at 1.32.1, the desktop's pin.Design calls
remote.json.port_in_useand the server does not move to another port, as on the desktop.aiden apps connector an explicitaiden apps on, and the choice is saved.connectchecks its arguments first.claude mcp add --scope user --transport http aiden <url> --header 'Authorization: Bearer ${AIDEN_MCP_TOKEN}'andcodex mcp add aiden --url <url> --bearer-token-env-var AIDEN_MCP_TOKEN. Neither stores the token in the app's config, and both match the desktop Settings snippets.aiden appsreaches the running server through the existing private control socket, likeaiden remote.apps-display.ts, type-only imports), never the MCP SDK.remote revokeandapps revoke. A phone's or Mac's id is refused byapps revoke.aiden serve --no-remotehas no MCP server, andaiden appssays to restart without the flag.deviceReportsAnalytics, false foragentdevices, so app chats and turns send nochat_created/chat_message_sent, matching the desktop.aiden serveon the host for outside apps.Tests
New file:
packages/cli/tests/mcp-apps.test.mjs. It is added to the CLItestscript, which the CI registry runs throughtest:cli. It has 4 tests and no source-grep:aiden serve, end to end over real MCP HTTP.connect's piped JSON comes with a stderr warning.tools/listlacks the write tools; a bad--accessvalue exits non-zero.offrefuses connections andonreturns the same URL, which also survives a server restart.createCliRemote. Bad names, access values, flags and ids are refused without enabling anything. A paired phone's id is refused byapps revoke, and the phone stays paired.--no-remote.aiden appsfails with the restart hint.aiden apps on, with no commands.Run locally:
npm --prefix packages/cli testmcp-apps.test.mjsalonenpm run cli:buildtsc --noEmittsc --noEmitnpm run test:ci-policymain/services/aiden-mcp-server.test.tsnpm run test:aiden-remoteThe only local failures are 4 in
scripts/aiden-remote-lan-transport-spike.test.mjs, a known hostopensslissue that does not reproduce in CI.Docs
packages/cli/README.md: a new "Outside apps (MCP server)" section, plus command reference, state files and privacy rows.docs/aiden-mcp-server.md: the status line no longer says the headless server is still to come, and a new "Headless server" section is added.docs/security/aiden-remote-threat-model.md§10: a headless note..memory/aiden-mcp-server.md: the W4c design notes.No W4a bugs were found.
CI flakes
tests/e2e/chat-top-bar.spec.ts:104"folder workspaces › a Git repository adds branch, GitHub, and Changes" failed on Electron E2E (4/4) at head f6eb360.electronApplication.evaluate: Resulting promise was garbage collectedat theBrowserWindow.getAllWindows()[0].setSize(1280, 800)call (line 117). It passed on retry Use catalog-driven runtime model limits #1, so--fail-on-flaky-testsfailed the job.packages/cli, docs and memory files on top of Add a local MCP server core so other apps can use Aiden's chats #800, so nothing it changes reaches Electron.tests/e2e/workspace-panel.spec.ts:409"scrollback keys move through history without reaching the shell" failed on Electron E2E (1/4) at head 4cf6f75.expect(locator).not.toContainText(expected), reported by Playwright as 1 flaky, so--fail-on-flaky-testsfailed the job.🤖 Generated with Claude Code