diff --git a/cmd/generate-types/main.go b/cmd/generate-types/main.go index d8b8b943e..906ed7a99 100644 --- a/cmd/generate-types/main.go +++ b/cmd/generate-types/main.go @@ -74,6 +74,7 @@ export const HealthActionApprove = 'approve' as const; export const HealthActionViewLogs = 'view_logs' as const; export const HealthActionSetSecret = 'set_secret' as const; export const HealthActionConfigure = 'configure' as const; +export const HealthActionEditURL = 'edit_url' as const; export type HealthAction = | typeof HealthActionNone | typeof HealthActionLogin @@ -82,7 +83,8 @@ export type HealthAction = | typeof HealthActionApprove | typeof HealthActionViewLogs | typeof HealthActionSetSecret - | typeof HealthActionConfigure; + | typeof HealthActionConfigure + | typeof HealthActionEditURL; export interface HealthStatus { level: HealthLevel; diff --git a/docs/api/rest-api.md b/docs/api/rest-api.md index edcf783f5..3adfb9fb6 100644 --- a/docs/api/rest-api.md +++ b/docs/api/rest-api.md @@ -842,6 +842,9 @@ additive-compatible and gains two fields: | `connected` | bool | mcpproxy registered in the config. Authoritative **only** when `access_state == "accessible"`; `false`/unresolved in the overall listing. | | `access_state` | string | `"unknown"` in the overall listing (not content-checked); resolved to `"accessible"`, `"absent"`, `"malformed"`, or `"denied"` by an on-demand single-client read. | | `remediation` | string | Present only when `access_state == "denied"`; carries the actionable fix text (App Data toggle + `tccutil reset` command). | +| `proxy_url` | string | **This** instance's MCP endpoint. Config-derived (no file read), so it is present on the overall listing too. | +| `registered_url` | string | The endpoint the client's existing entry actually points at, projected through the same sanitizer as a connect preview's `existing_entry_summary.endpoint`: **scheme, host and path only** — query (the `?apikey=` carrier), userinfo and fragment are dropped, and a value that is not an absolute URL is not echoed at all. Resolved only by an on-demand read. | +| `endpoint_match` | string | How `registered_url` relates to `proxy_url`: `"this"` (the entry addresses this instance), `"other"` (it addresses a different one), `"unknown"` (the entry has no comparable endpoint, e.g. a stdio command). Empty when `connected` is false or nothing was read. | A client that is installed but not yet content-checked reads as `exists=true, connected=false, access_state="unknown"`. Resolving `connected` @@ -849,6 +852,13 @@ requires an explicit per-client read (the per-client status route below, connect/disconnect, or the CLI `mcpproxy connect` command), which is where a privacy prompt may legitimately appear. +**`connected` alone is not "connected to this instance."** It means an +mcpproxy-shaped entry is present in that client's config — and an entry merely +*named* `mcpproxy` counts, even when its URL addresses another instance on +another port. Consumers that need the stronger claim must check +`endpoint_match == "this"`; a UI showing a bare "Connected" on +`endpoint_match == "other"` is reporting someone else's link as its own. + #### GET /api/v1/connect/{client} On-demand single-client status. Reads the one client's config **at request diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 1d23fbf6b..48a436f43 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -73,11 +73,13 @@ let removeAPIListener: (() => void) | null = null function handleAuthModalClose() { authModal.show = false authModal.lastError = '' + systemStore.setAuthRequired(false) } function handleAuthModalAuthenticated() { authModal.show = false authModal.lastError = '' + systemStore.setAuthRequired(false) // Refresh data now that we're authenticated systemStore.connectEventSource() @@ -87,6 +89,7 @@ function handleAuthModalAuthenticated() { function handleAuthModalRefresh() { authModal.show = false authModal.lastError = '' + systemStore.setAuthRequired(false) // Reconnect with potentially new API key systemStore.connectEventSource() @@ -98,6 +101,9 @@ function handleAuthError(event: APIAuthEvent) { console.log('Global auth error received:', event) authModal.lastError = event.error authModal.show = true + // Audit F28: one cause, one message. The modal now suppresses the reconnect + // toast and the inline load errors it would otherwise compete with. + systemStore.setAuthRequired(true) } onMounted(async () => { diff --git a/frontend/src/components/AuthErrorModal.vue b/frontend/src/components/AuthErrorModal.vue index 19395fc46..8106efed6 100644 --- a/frontend/src/components/AuthErrorModal.vue +++ b/frontend/src/components/AuthErrorModal.vue @@ -13,19 +13,23 @@

How to get the API key:

+
    -
  1. Using Tray: Right-click the MCPProxy tray icon and select "Open Web UI"
  2. -
  3. From Logs: Check mcpproxy startup logs for the API key, then add ?apikey=YOUR_KEY to the URL
  4. -
  5. Manual Entry: Enter your API key below if you have it
  6. +
  7. From the CLI: run mcpproxy doctor, or read api_key in ~/.mcpproxy/mcp_config.json
  8. +
  9. From logs: the key is printed in the mcpproxy startup log
  10. +
  11. Using the tray (desktop installs): right-click the MCPProxy tray icon and select "Open Web UI" — it opens an already-authenticated window
- +
Refresh & Retry -
diff --git a/frontend/src/components/ConnectModal.vue b/frontend/src/components/ConnectModal.vue index e34de74a1..c456bb707 100644 --- a/frontend/src/components/ConnectModal.vue +++ b/frontend/src/components/ConnectModal.vue @@ -35,6 +35,19 @@
{{ client.name }}
{{ client.config_path }}
+ +
+ → {{ client.registered_url }} +
{{ client.note }}
@@ -57,11 +70,31 @@ class="badge badge-warning badge-sm" title="Config exists but could not be parsed" >Unreadable config - Config not found + + Not installed + + Connected to another instance + @@ -336,16 +380,59 @@ - @@ -445,14 +532,54 @@ const connectableClients = computed(() => // Bridge clients (e.g. Claude Desktop) can be connected even without an // existing config file — Connect creates it. A client macOS has blocked // ('denied') is excluded: the write would fail with the same privacy error. + // A row pointing at ANOTHER instance is excluded too: repointing someone + // else's config is a deliberate per-row decision, not a bulk side effect. mergedClients.value.filter( - c => c.supported && (c.exists || c.bridge) && !c.connected && accessState(c) !== 'denied' + c => + c.supported && + (c.exists || c.bridge) && + !c.connected && + accessState(c) !== 'denied' ) ) -const allConnected = computed(() => - connectableClients.value.length === 0 -) +// Audit F18: a disabled primary must say what would enable it. The reasons are +// mutually exclusive in practice, so the most specific one wins. +const connectAllDisabledReason = computed(() => { + const supported = mergedClients.value.filter(c => c.supported) + if (supported.length === 0) return 'No supported MCP clients found on this machine.' + if (supported.every(c => c.connected)) return 'Every supported client is already connected.' + if (supported.some(c => accessState(c) === 'denied')) { + return 'The remaining clients are blocked by macOS — fix access above first.' + } + return 'No client on this machine is ready to connect.' +}) + +function endpointTitle(client: ClientStatus): string { + if (client.endpoint_match === 'other') { + return `This client is registered to ${client.registered_url}, not to this instance (${client.proxy_url ?? 'unknown'}).` + } + return `Registered to ${client.registered_url}` +} + +function notFoundTitle(client: ClientStatus): string { + const paths = client.checked_paths?.length ? client.checked_paths : [client.config_path] + return `No config file found. Looked in:\n${paths.join('\n')}` +} + +// --- Disconnect confirmation (audit F18) --- +const disconnectTarget = ref(null) + +function askDisconnect(client: ClientStatus) { + disconnectTarget.value = client +} + +async function confirmDisconnect() { + const target = disconnectTarget.value + if (!target) return + await disconnect(target.id) + disconnectTarget.value = null +} function clientIcon(client: ClientStatus): string { // Map client icons based on id/name diff --git a/frontend/src/components/ConnectionStatus.vue b/frontend/src/components/ConnectionStatus.vue index 2cc6a43fb..58aaad855 100644 --- a/frontend/src/components/ConnectionStatus.vue +++ b/frontend/src/components/ConnectionStatus.vue @@ -1,7 +1,12 @@