Skip to content

MCP allowlist: mark "Localhost" as this computer and list it to clients consistently #1723

Backlog

Description

@smart-ssh-planner

Goal

When a user allows "Localhost" for MCP clients, the settings make clear that MCP clients can then propose commands that run on this computer itself. An allowed Localhost behaves like every other allowed server: clients see it in list_servers.

Context

  • crates/app-shell/src/commands/servers.rs:55-76 (list_servers_impl) puts the Localhost pseudo-server (Spec 0032, fixed id LOCAL_SERVER_ID = Uuid::nil(), crates/app-logic/src/dto/server.rs:22) first in the server list (not on Android).
  • The MCP settings (apps/smart-ssh-community/frontend/src/components/McpServerSettings.tsx:203-228) render this list as plain checkboxes; Localhost looks like any remote server, without any hint.
  • set_mcp_server_allowed_servers (crates/app-shell/src/mcp_settings.rs:322-332) stores the ids unfiltered; propose_action (crates/app-shell/src/mcp_backend.rs:165-205) only checks is_allowed (crates/app-logic/src/mcp_lookup.rs:54-56) and then connects, also to Localhost.
  • McpLookup::list_servers (crates/app-logic/src/mcp_lookup.rs:61-77) keeps only ids found in the profile store. Localhost has no database row (Spec 0032 §3), so an allowed Localhost is never listed to the client, yet a client can still address it with the nil UUID.
  • Every MCP action still needs the user's confirmation: MCP origin turns AutoExec into Confirm (crates/app-logic/src/orchestration/escalation.rs:203-209); filter, risk rating and Deny apply unchanged (Spec 0032).

Requirements

  • Decided: Localhost stays selectable in the MCP allowlist (no extra opt-in dialog).
  • In the MCP allowlist the Localhost entry shows a short hint below its name, English: "Runs commands on this computer with your user account. Each command still needs your confirmation." Remote servers show no hint. The frontend recognises Localhost by its id from the server list (the nil UUID), not by its name.
  • McpLookup::list_servers includes Localhost (id and its display name as in the app's server list) when it is on the allowlist; when it is not allowed it is not listed. Other servers unchanged.
  • get_server_notes for an allowed Localhost returns the Localhost notes (kept in the app settings, Spec 0032, ADR 0026), redacted and fenced exactly like the notes of other servers (server_notes, mcp_lookup.rs:87-103). Today it returns UnknownServer because the profile store has no row.
  • Spec 0032 states that Localhost can be allowed for MCP, is listed when allowed and keeps the confirmation; Spec 0028 refers to it in the allowlist section.
  • The hint text is translated into every locale under apps/smart-ssh-community/frontend/src/locales/.

Acceptance Criteria

  • Component test: the allowlist shows the hint under the Localhost entry and under no other entry
  • list_servers with Localhost allowed contains Localhost; with Localhost not allowed it does not (unit tests in mcp_lookup.rs)
  • get_server_notes for an allowed Localhost returns its notes redacted and fenced (a secret in the notes appears as the redaction placeholder); for a not-allowed Localhost it returns UnknownServer
  • A propose_command on allowed Localhost still ends in a confirmation request and runs nothing without it (existing tests stay green)
  • On Android, where Localhost does not exist, nothing changes
  • All locales contain the new string; the i18n checks pass
  • Relevant automated tests pass

Technical Notes

  • Security-relevant area (MCP access to the local machine). No change to the filter engine, the confirmation flow, the token check or the allowlist check itself.
  • User-visible: add a changelog fragment.

Files: apps/smart-ssh-community/frontend/src/components/McpServerSettings.tsx, apps/smart-ssh-community/frontend/src/components/McpServerSettings.test.tsx, apps/smart-ssh-community/frontend/src/locales/, crates/app-logic/src/mcp_lookup.rs, docs/specs/0032-local-pseudo-server.md, docs/specs/0028-mcp-server-integration.md, changelog.d/

Spec impact: update 0032

Open questions

  • How list_servers learns the Localhost display name: (a) the same constant/helper list_servers_impl uses, moved to app-logic if needed, (b) a fixed string. Recommendation: (a), one source for the name.

Related Work

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfrontendmcpsecurity

    Fields

    Priority

    P2 - Normal

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions