local-mcp 3.0.446 → 3.0.448

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.
package/README.md CHANGED
@@ -17,12 +17,14 @@
17
17
  | Method | | Best for |
18
18
  |---|---|---|
19
19
  | **Installer** | [Download LMCP](https://local-mcp.com/download?ref=npm) — picks Mac or Windows for you | Most users |
20
- | **npx** | `npx -y local-mcp@latest setup` | Configuring AI clients from an existing Node environment; `link` then links this machine to your LMCP account with a code you approve on the web |
20
+ | **npx** | `npx -y local-mcp@latest setup` | Configuring AI clients from an existing Node environment; `setup` also links this machine to your LMCP account: it shows a link and a code you approve on the web |
21
21
 
22
22
  **Windows without Node.js:** `npx` is not available there. Download the installer from [local-mcp.com/download](https://local-mcp.com/download?ref=npm).
23
23
 
24
24
  Using ChatGPT or Claude.ai on the web needs the LMCP app (installer); npx sets up desktop AI clients.
25
25
 
26
+ **LMCP needs a free LMCP account.** You sign in when you download from [local-mcp.com/download](https://local-mcp.com/download?ref=npm), or link this machine with `link`.
27
+
26
28
  <!-- generado:clientes (scripts/readme-npm.py; no editar a mano) -->
27
29
  Auto-detects and configures Claude Desktop, Claude Code, Cursor, Windsurf (Devin), VS Code, Zed, LM Studio, Warp, Antigravity, Cline, Roo Code, Codex, Jan, OpenCode, Goose, and Hermes. Restart your AI client once.
28
30
  <!-- /generado:clientes -->
@@ -85,11 +87,11 @@ LMCP runs a native MCP server that bridges the apps on your Mac or Windows PC to
85
87
  The full, current list of tools, by app and platform: **[local-mcp.com/tools](https://local-mcp.com/tools?ref=npm)**.
86
88
 
87
89
  <!-- generado:tools (scripts/readme-npm.py; no editar a mano) -->
88
- **macOS and Windows:** `add_contact_to_group` `agent_ack` `agent_checkin` `agent_inbox` `agent_mesh_create` `agent_mesh_invite` `agent_mesh_join` `agent_mesh_leave` `agent_mesh_revoke` `agent_mesh_status` `agent_send` `agent_sent` `agents_list` `amazon_get_order` (beta) `amazon_list_orders` (beta) `amazon_list_returns` (beta) `amazon_list_wishlist` (beta) `amazon_search_orders` (beta) `amazon_track_shipment` (beta) `configure_clients` `connect_m365_account` `connect_servicenow` `connect_todoist` `connect_twilio` (beta) `create_contact` `create_contact_group` `create_referral_invites` `daily_brief` `disconnect_m365_account` `disconnect_servicenow` `disconnect_todoist` `disconnect_twilio` (beta) `enable_service` `excel_create` `excel_read` `excel_write_cell` `file_list` `file_read` `file_search` `file_write` `gcal_create_event` (beta) `gcal_delete_event` (beta) `gcal_list_calendars` (beta) `gcal_list_events` (beta) `gcal_update_event` (beta) `gdrive_disconnect` `gdrive_file_info` `gdrive_list_files` `gdrive_read_file` `gdrive_root` `gdrive_search_files` `gdrive_write_file` `get_audit_log` `get_config` `get_datetime` `get_m365_person` `get_weather` `google_connect_account` (beta) `google_disconnect_account` (beta) `google_list_accounts` (beta) `line_connect` (beta) `line_disconnect` (beta) `line_list_chats` (beta) `line_read_messages` (beta) `line_search_messages` (beta) `line_send_message` (beta) `list_displays` `list_m365_accounts` `list_m365_people_insights` `list_referral_candidates` `list_windows` `lmcp_install_upgrade` `lmcp_state` `lmcp_upgrade_diagnostics` `m365_create_contact` `m365_create_draft` `m365_create_email_folder` `m365_create_event` `m365_delete_event` `m365_get_contact` `m365_list_contacts` `m365_list_email_folders` `m365_list_emails` `m365_list_events` `m365_mark_email_read` `m365_move_email` `m365_read_email` `m365_reply_email` `m365_search_contacts` `m365_search_emails` `m365_send_email` `m365_update_contact` `media_probe` `nordvpn_diagnose` `nordvpn_servers` `nordvpn_status` `obsidian_list_vaults` `obsidian_read_note` `obsidian_search_notes` `obsidian_write_note` `onedrive_delete_file` `onedrive_disconnect` `onedrive_file_info` `onedrive_list_files` `onedrive_move_file` `onedrive_read_file` `onedrive_root` `onedrive_search_files` `onedrive_set_scope` `onedrive_write_file` `outlook_diagnose` `pdf_read` `photos_export` (beta) `photos_list_albums` (beta) `photos_search` (beta) `ppt_create` `ppt_read` `proton_disconnect` `proton_list_emails` `proton_read_email` `proton_search_emails` `proton_send_email` `proton_status` `recipe_delete` `recipe_discover` `recipe_export` `recipe_get` `recipe_import` `recipe_install` `recipe_list` `recipe_rename` `recipe_run` `recipe_runs` `recipe_save` `report_friction` `report_problem` `request_feature` `run_diagnostics` `run_terminal_command` `search_m365_directory` `servicenow_add_comment` `servicenow_create_incident` `servicenow_get_incident` `servicenow_list_my_incidents` `servicenow_search_incidents` `servicenow_search_kb` `servicenow_update_incident` `set_always_allowed` `set_default_m365_account` `set_default_telegram_account` `set_default_whatsapp_account` `slack_disconnect` `slack_list_workspaces` `stocks_get_chart` `stocks_get_quote` `stocks_search_symbol` `submit_diagnostics` `teams_call_history` `teams_list_channels` `teams_list_chats` `teams_list_teams` `teams_read_channel_messages` `teams_read_chat_messages` `teams_search_messages` `teams_send_channel_message` `teams_send_message` `telegram_connect` `telegram_delete_message` `telegram_disconnect` `telegram_list_accounts` `telegram_list_chats` `telegram_read_messages` `telegram_search_messages` `telegram_send_message` `telegram_unwatch_chats` `telegram_watch_chats` `telegram_watch_status` `thunderbird_accounts_status` `thunderbird_disconnect` `thunderbird_list_accounts` `thunderbird_list_emails` `thunderbird_read_email` `thunderbird_search_contacts` `thunderbird_search_emails` `thunderbird_send_email` `todo_complete_task` `todo_create_task` `todo_get_folders` `todo_list_tasks` `todoist_complete_task` `todoist_create_task` `todoist_list_projects` `todoist_list_tasks` `twilio_api_request` (beta) `twilio_buy_number` (beta) `twilio_create_call` (beta) `twilio_delete_message` (beta) `twilio_get_call` (beta) `twilio_get_message` (beta) `twilio_get_usage` (beta) `twilio_list_accounts` (beta) `twilio_list_calls` (beta) `twilio_list_errors` (beta) `twilio_list_messages` (beta) `twilio_list_numbers` (beta) `twilio_lookup` (beta) `twilio_release_number` (beta) `twilio_search_available_numbers` (beta) `twilio_send_message` (beta) `twilio_verify_check` (beta) `twilio_verify_send` (beta) `ui_click` `ui_find_element` `ui_get_element` `ui_keystroke` `ui_menu_bar_click` `ui_read_tree` `ui_type` `ui_wait_for_element` `update_contact` `video_blur_region` `video_concat` `video_export_gif` `video_reframe` `video_trim` `web_click` `web_eval` `web_extract` `web_find` `web_login` `web_navigate` `web_read` `web_screenshot` `web_session_close` `web_session_delete` `web_session_list` `web_show` `web_type` `web_wait_for` `whatsapp_connect` `whatsapp_create_group` `whatsapp_diagnose` `whatsapp_disconnect` `whatsapp_forward_message` `whatsapp_group_info` `whatsapp_list_accounts` `whatsapp_list_chats` `whatsapp_list_groups` `whatsapp_read_messages` `whatsapp_read_poll` `whatsapp_save_media` `whatsapp_search_contacts` `whatsapp_search_messages` `whatsapp_send_file` `whatsapp_send_message` `whatsapp_send_poll` `whatsapp_sync` `window_focus` `window_set_frame` `word_append` `word_create` `word_read` `zoom_list_recordings` `zoom_read_transcript`
90
+ **macOS and Windows:** `add_contact_to_group` `agent_ack` `agent_checkin` `agent_inbox` `agent_mesh_create` `agent_mesh_invite` `agent_mesh_join` `agent_mesh_leave` `agent_mesh_revoke` `agent_mesh_status` `agent_send` `agent_sent` `agents_list` `amazon_get_order` (beta) `amazon_list_orders` (beta) `amazon_list_returns` (beta) `amazon_list_wishlist` (beta) `amazon_search_orders` (beta) `amazon_track_shipment` (beta) `configure_clients` `connect_m365_account` `connect_servicenow` `connect_todoist` `connect_twilio` (beta) `create_contact` `create_contact_group` `create_referral_invites` `daily_brief` `disconnect_m365_account` `disconnect_servicenow` `disconnect_todoist` `disconnect_twilio` (beta) `enable_service` `excel_create` `excel_read` `excel_write_cell` `file_list` `file_read` `file_search` `file_write` `gcal_create_event` (beta) `gcal_delete_event` (beta) `gcal_list_calendars` (beta) `gcal_list_events` (beta) `gcal_update_event` (beta) `gdrive_disconnect` `gdrive_file_info` `gdrive_list_files` `gdrive_read_file` `gdrive_root` `gdrive_search_files` `gdrive_write_file` `get_audit_log` `get_config` `get_datetime` `get_m365_person` `get_weather` `google_connect_account` (beta) `google_disconnect_account` (beta) `google_list_accounts` (beta) `line_connect` (beta) `line_disconnect` (beta) `line_list_chats` (beta) `line_read_messages` (beta) `line_search_messages` (beta) `line_send_message` (beta) `list_displays` `list_m365_accounts` `list_m365_people_insights` `list_referral_candidates` `list_windows` `lmcp_install_upgrade` `lmcp_state` `lmcp_upgrade_diagnostics` `m365_create_contact` `m365_create_draft` `m365_create_email_folder` `m365_create_event` `m365_delete_event` `m365_get_contact` `m365_list_contacts` `m365_list_email_folders` `m365_list_emails` `m365_list_events` `m365_mark_email_read` `m365_move_email` `m365_read_email` `m365_reply_email` `m365_save_attachment` `m365_search_contacts` `m365_search_emails` `m365_send_email` `m365_update_contact` `media_probe` `nordvpn_diagnose` `nordvpn_servers` `nordvpn_status` `obsidian_list_vaults` `obsidian_read_note` `obsidian_search_notes` `obsidian_write_note` `onedrive_delete_file` `onedrive_disconnect` `onedrive_file_info` `onedrive_list_files` `onedrive_move_file` `onedrive_read_file` `onedrive_root` `onedrive_search_files` `onedrive_set_scope` `onedrive_write_file` `outlook_diagnose` `pdf_read` `photos_export` (beta) `photos_list_albums` (beta) `photos_search` (beta) `ppt_create` `ppt_read` `proton_disconnect` `proton_list_emails` `proton_read_email` `proton_search_emails` `proton_send_email` `proton_status` `recipe_delete` `recipe_discover` `recipe_export` `recipe_get` `recipe_import` `recipe_install` `recipe_list` `recipe_rename` `recipe_run` `recipe_runs` `recipe_save` `report_friction` `report_problem` `request_feature` `run_diagnostics` `run_terminal_command` `search_m365_directory` `servicenow_add_comment` `servicenow_create_incident` `servicenow_get_incident` `servicenow_list_my_incidents` `servicenow_search_incidents` `servicenow_search_kb` `servicenow_update_incident` `set_always_allowed` `set_default_m365_account` `set_default_telegram_account` `set_default_whatsapp_account` `slack_disconnect` `slack_list_workspaces` `stocks_get_chart` `stocks_get_quote` `stocks_search_symbol` `submit_diagnostics` `teams_call_history` `teams_list_channels` `teams_list_chats` `teams_list_teams` `teams_list_transcripts` (beta) `teams_read_channel_messages` `teams_read_chat_messages` `teams_read_transcript` (beta) `teams_search_messages` `teams_send_channel_message` `teams_send_message` `telegram_connect` `telegram_delete_message` `telegram_disconnect` `telegram_list_accounts` `telegram_list_chats` `telegram_read_messages` `telegram_search_messages` `telegram_send_message` `telegram_unwatch_chats` `telegram_watch_chats` `telegram_watch_status` `thunderbird_accounts_status` `thunderbird_disconnect` `thunderbird_list_accounts` `thunderbird_list_emails` `thunderbird_read_email` `thunderbird_search_contacts` `thunderbird_search_emails` `thunderbird_send_email` `todo_complete_task` `todo_create_task` `todo_get_folders` `todo_list_tasks` `todoist_complete_task` `todoist_create_task` `todoist_list_projects` `todoist_list_tasks` `twilio_api_request` (beta) `twilio_buy_number` (beta) `twilio_create_call` (beta) `twilio_delete_message` (beta) `twilio_get_call` (beta) `twilio_get_message` (beta) `twilio_get_usage` (beta) `twilio_list_accounts` (beta) `twilio_list_calls` (beta) `twilio_list_errors` (beta) `twilio_list_messages` (beta) `twilio_list_numbers` (beta) `twilio_lookup` (beta) `twilio_release_number` (beta) `twilio_search_available_numbers` (beta) `twilio_send_message` (beta) `twilio_verify_check` (beta) `twilio_verify_send` (beta) `ui_click` `ui_find_element` `ui_get_element` `ui_keystroke` `ui_menu_bar_click` `ui_read_tree` `ui_type` `ui_wait_for_element` `update_contact` `video_blur_region` `video_concat` `video_export_gif` `video_reframe` `video_trim` `web_click` `web_eval` `web_extract` `web_find` `web_login` `web_navigate` `web_read` `web_screenshot` `web_session_close` `web_session_delete` `web_session_list` `web_show` `web_type` `web_wait_for` `whatsapp_connect` `whatsapp_create_group` `whatsapp_diagnose` `whatsapp_disconnect` `whatsapp_forward_message` `whatsapp_group_info` `whatsapp_list_accounts` `whatsapp_list_chats` `whatsapp_list_groups` `whatsapp_read_messages` `whatsapp_read_poll` `whatsapp_save_media` `whatsapp_search_contacts` `whatsapp_search_messages` `whatsapp_send_file` `whatsapp_send_message` `whatsapp_send_poll` `whatsapp_sync` `window_focus` `window_set_frame` `word_append` `word_create` `word_read` `zoom_list_recordings` `zoom_read_transcript`
89
91
 
90
- **macOS only:** `agent_authorize` `complete_omnifocus_task` `complete_reminder` `copy_email` `create_calendar_event` `create_draft` `create_email_folder` `create_note` `create_omnifocus_task` `create_reminder` `create_reminder_list` `delete_calendar_event` `delete_note` `delete_reminder` `delete_reminder_folder` `fantastical_add_event` (beta) `finder_list` `finder_search` `flag_email` `gdrive_delete_file` `get_contact` `get_reminder_folders` `image_playground_generate` `list_accounts` `list_calendar_events` `list_calendar_names` `list_contacts` `list_email_accounts` `list_email_folders` `list_emails` `list_message_chats` `list_missing_permissions` `list_notes` `list_omnifocus_folders` `list_omnifocus_projects` `list_omnifocus_tags` `list_omnifocus_tasks` `list_reminders` `lmcp_doctor` `mark_email_read` `move_email` `music_add_to_playlist` `music_list_playlists` `music_next_track` `music_now_playing` `music_pause` `music_play` `music_previous_track` `music_search_library` `music_set_volume` `notion_disconnect` `notion_list_databases` `notion_list_pages` `notion_list_workspaces` `notion_open_page` `notion_read_database` `notion_read_page` `notion_search` `permissions_status` `read_email` `read_messages` `read_note` `recipe_submit_for_review` `record_marker` `rename_reminder_folder` `reply_email` `save_attachment` `screen_record_start` `screen_record_status` `screen_record_stop` `screenshot_capture` `search_contacts` `search_emails` `search_messages` `search_notes` `search_omnifocus_tasks` `send_email` `send_message` `shortcuts_list` `shortcuts_run` `shortcuts_view` `signal_compose_guidance` `signal_connect` `signal_disconnect` `signal_list_chats` `signal_read_messages` `signal_search_messages` `slack_list_channels` `slack_read_channel_messages` `slack_search_messages` `survey_respond` `survey_skip` `teams_list_transcripts` `teams_read_transcript` `things_complete_todo` (beta) `things_create_todo` (beta) `things_list_areas` (beta) `things_list_projects` (beta) `things_list_todos` (beta) `things_update_todo` (beta) `update_calendar_event` `update_note` `update_reminder` `zalo_connect` `zalo_diagnose` `zalo_disconnect` `zalo_list_chats` `zalo_read_messages` `zalo_search_messages` `zalo_send_message`
92
+ **macOS only:** `agent_authorize` `complete_omnifocus_task` `complete_reminder` `copy_email` `create_calendar_event` `create_draft` `create_email_folder` `create_note` `create_omnifocus_task` `create_reminder` `create_reminder_list` `delete_calendar_event` `delete_note` `delete_reminder` `delete_reminder_folder` `fantastical_add_event` (beta) `finder_list` `finder_search` `flag_email` `gdrive_delete_file` `get_contact` `get_reminder_folders` `image_playground_generate` `list_accounts` `list_calendar_events` `list_calendar_names` `list_contacts` `list_email_accounts` `list_email_folders` `list_emails` `list_message_chats` `list_missing_permissions` `list_notes` `list_omnifocus_folders` `list_omnifocus_projects` `list_omnifocus_tags` `list_omnifocus_tasks` `list_reminders` `lmcp_doctor` `mark_email_read` `move_email` `music_add_to_playlist` `music_list_playlists` `music_next_track` `music_now_playing` `music_pause` `music_play` `music_previous_track` `music_search_library` `music_set_volume` `notion_disconnect` `notion_list_databases` `notion_list_pages` `notion_list_workspaces` `notion_open_page` `notion_read_database` `notion_read_page` `notion_search` `permissions_status` `read_email` `read_messages` `read_note` `recipe_submit_for_review` `record_marker` `rename_reminder_folder` `reply_email` `save_attachment` `screen_record_start` `screen_record_status` `screen_record_stop` `screenshot_capture` `search_contacts` `search_emails` `search_messages` `search_notes` `search_omnifocus_tasks` `send_email` `send_message` `shortcuts_list` `shortcuts_run` `shortcuts_view` `signal_compose_guidance` `signal_connect` `signal_disconnect` `signal_list_chats` `signal_read_messages` `signal_search_messages` `slack_list_channels` `slack_read_channel_messages` `slack_search_messages` `survey_respond` `survey_skip` `things_complete_todo` (beta) `things_create_todo` (beta) `things_list_areas` (beta) `things_list_projects` (beta) `things_list_todos` (beta) `things_update_todo` (beta) `update_calendar_event` `update_note` `update_reminder` `zalo_connect` `zalo_diagnose` `zalo_disconnect` `zalo_list_chats` `zalo_read_messages` `zalo_search_messages` `zalo_send_message`
91
93
 
92
- **Windows only:** `explorer_list` `explorer_search` `gdrive_set_scope` `m365_save_attachment` `outlook_calendar_create_event` `outlook_calendar_delete_event` `outlook_calendar_list_events` `outlook_calendar_list_names` `outlook_contacts_list` `outlook_contacts_search` `outlook_create_folder` `outlook_flag_email` `outlook_forward_email` `outlook_get_contact` `outlook_list_accounts` `outlook_list_emails` `outlook_mark_email_read` `outlook_move_email` `outlook_read_email` `outlook_reply_all` `outlook_reply_email` `outlook_save_attachment` `outlook_search_emails` `outlook_send_email` `sharepoint_list_files` `sharepoint_list_sites` `sharepoint_read_file` `todo_list_lists` `update_local_mcp` `update_self_diagnosis`
94
+ **Windows only:** `explorer_list` `explorer_search` `gdrive_set_scope` `outlook_calendar_create_event` `outlook_calendar_delete_event` `outlook_calendar_list_events` `outlook_calendar_list_names` `outlook_contacts_list` `outlook_contacts_search` `outlook_create_folder` `outlook_flag_email` `outlook_forward_email` `outlook_get_contact` `outlook_list_accounts` `outlook_list_emails` `outlook_mark_email_read` `outlook_move_email` `outlook_read_email` `outlook_reply_all` `outlook_reply_email` `outlook_save_attachment` `outlook_search_emails` `outlook_send_email` `sharepoint_list_files` `sharepoint_list_sites` `sharepoint_read_file` `todo_list_lists` `update_local_mcp` `update_self_diagnosis`
93
95
  <!-- /generado:tools -->
94
96
 
95
97
  &nbsp;
@@ -152,26 +154,37 @@ Full policy: **[local-mcp.com/en/privacy](https://local-mcp.com/en/privacy)**.
152
154
 
153
155
  ```bash
154
156
  npx -y local-mcp@latest setup # configure all detected AI clients
155
- npx -y local-mcp@latest link # link this machine to your LMCP account (a code you approve on the web)
157
+ npx -y local-mcp@latest link # resume linking this machine, if you did not approve it during setup
156
158
  npx -y local-mcp@latest update # how to update (npx -y local-mcp@latest)
157
159
  npx -y local-mcp@latest status # show server status
160
+ npx -y local-mcp@latest uninstall # remove what setup installed and the entries in your AI clients
158
161
  ```
159
162
 
160
- The LMCP server ships inside the npm package: npm installs the signed binary for your platform (`local-mcp-darwin-arm64`, `local-mcp-darwin-x64`, `local-mcp-windows-x64` or `local-mcp-windows-arm64`) and `npx local-mcp` runs it from there. Starting the server downloads nothing. To update, run `npx -y local-mcp@latest`.
163
+ The LMCP server ships inside the npm package: npm installs the signed binary for your platform (`local-mcp-darwin-arm64`, `local-mcp-darwin-x64`, `local-mcp-windows-x64` or `local-mcp-windows-arm64`). Starting the server downloads nothing. On a Mac, `npx local-mcp` runs it from the package. On Windows, `setup` copies it to `%LOCALAPPDATA%\local-mcp\bin\lmcp-server.exe` and your AI clients run that copy, unless the LMCP app is installed. To update, run `npx -y local-mcp@latest`.
161
164
 
162
165
  &nbsp;
163
166
 
164
167
  ## Uninstall
165
168
 
166
- Mac:
169
+ If you set LMCP up with npx, on Mac or Windows:
170
+
171
+ ```bash
172
+ npx -y local-mcp@latest uninstall
173
+ ```
174
+
175
+ It removes the LMCP entry from your AI clients and the LMCP server it keeps on this computer; on Windows, also LMCP's settings, sign-in and logs. It lists anything it could not remove. npx keeps its own copy of the package in npm's cache: the command lists it, with the command to delete it. If an AI app is using the LMCP runtime, `uninstall` stops without removing anything and exits with code 1: close that app and run it again.
176
+
177
+ If you installed the LMCP app on a Mac:
167
178
 
168
179
  ```bash
169
180
  curl -fsSL 'https://local-mcp.com/uninstall' | bash
170
181
  ```
171
182
 
172
- On a Mac: stops all background processes, removes the LaunchAgent, deletes the app and binaries, and cleans up MCP config entries from every configured AI client.
183
+ It stops all background processes, removes the LaunchAgent, deletes the app and binaries, and cleans up MCP config entries from every configured AI client.
184
+
185
+ If you installed the LMCP app on Windows: **Settings → Apps → Installed apps → LMCP → Uninstall**.
173
186
 
174
- On Windows: **Settings → Apps → Installed apps → LMCP → Uninstall**. Your emails, calendar, and other data are never stored by LMCP and remain completely untouched.
187
+ Your emails, calendar, and other data are never stored by LMCP and remain completely untouched.
175
188
 
176
189
  &nbsp;
177
190
 
package/bundled.js CHANGED
@@ -71,4 +71,39 @@ function bundledServerPath (platform = process.platform, arch = process.arch, re
71
71
  }
72
72
  }
73
73
 
74
- module.exports = { TARGETS, SERVER_MIN, serverMissing, bundledServerPath }
74
+ // lmcp-npm#199: a server embedded in the Mac app before 3.0.429 has no plan gate, so launching it
75
+ // let a Mac without an account keep working through npx after the cut. The wrapper's own server is
76
+ // no way around it: with --auto it proxies to that app's running tray, and --standalone does not
77
+ // sync the plan. So an app below this release, or of unreadable version, gets nothing launched and
78
+ // the reinstall notice: fail closed, as the API's minimum version does.
79
+ const EMBEDDED_MIN = '3.0.429'
80
+
81
+ /** Whether an app's embedded server may serve: its version read and at or above EMBEDDED_MIN. */
82
+ function embeddedCurrent (version) {
83
+ const v = _version(version)
84
+ const min = _version(EMBEDDED_MIN)
85
+ if (!v) return false
86
+ const d = v.findIndex((x, i) => x !== min[i])
87
+ return d === -1 || v[d] > min[d]
88
+ }
89
+
90
+ /** Which server to launch: { path, source (binary_source), bundled, reinstall }. path null: none. */
91
+ function chooseServer ({ embedded, embeddedVersion, bundled }) {
92
+ if (embedded) {
93
+ return embeddedCurrent(embeddedVersion)
94
+ ? { path: embedded, source: 'app_embedded', bundled: false, reinstall: false }
95
+ : { path: null, source: 'app_embedded', bundled: false, reinstall: true }
96
+ }
97
+ return { path: bundled || null, source: bundled ? 'bundled' : 'missing_platform', bundled: true, reinstall: false }
98
+ }
99
+
100
+ // lmcp-api#1114 (utils/min_version.py): the texts Darío approved on 2026-11-10, for the Mac installer.
101
+ const REINSTALL_URL = 'https://www.local-mcp.com/api/dmg?ref=needs-update'
102
+ function reinstallNotice (env = process.env) {
103
+ const lang = env.LC_ALL || env.LC_MESSAGES || env.LANG || ''
104
+ return /^es([_.-]|$)/i.test(lang)
105
+ ? `La versión de LMCP de esta computadora es demasiado vieja para seguir funcionando y no se puede actualizar sola. Reinstalala desde ${REINSTALL_URL}`
106
+ : `LMCP on this computer is too old to keep working and can't update itself. Reinstall it from ${REINSTALL_URL}`
107
+ }
108
+
109
+ module.exports = { TARGETS, SERVER_MIN, serverMissing, bundledServerPath, EMBEDDED_MIN, embeddedCurrent, chooseServer, reinstallNotice }
package/index.js CHANGED
@@ -333,7 +333,7 @@ async function main() {
333
333
 
334
334
  // #144: on Windows the installed app shares the runtime folder (its lmcp-tray.exe lives there),
335
335
  // the Roaming config and both credentials. Read before anything is removed; with the app, none of it is.
336
- const { localState, removeLocalState, localStateReport } = require('./unconfigure')
336
+ const { localState, removeLocalState, localStateReport, npxCacheRoot, npxCacheEntries } = require('./unconfigure')
337
337
  const st = localState({ appInstalled: menuBarAppInstalled() })
338
338
  if (st && st.appInstalled) {
339
339
  console.log(`The LMCP app is installed: its runtime (${CACHE_DIR}), settings and sign-in stay. Uninstall the app from Windows Settings to remove them.`)
@@ -351,7 +351,7 @@ async function main() {
351
351
  }
352
352
  // #144: without the app, also the relay token, the device key, the Roaming config, logs and caches.
353
353
  try {
354
- for (const line of localStateReport(removeLocalState(st))) console.log(line)
354
+ for (const line of localStateReport({ ...removeLocalState(st), npxLeft: npxCacheEntries(npxCacheRoot()) })) console.log(line)
355
355
  } catch (e) {
356
356
  console.log('Could not remove all of LMCP\'s data: ' + e.message)
357
357
  }
@@ -514,20 +514,40 @@ async function main() {
514
514
  // El código de salida pasa al cliente igual que siempre.
515
515
  if (arranque) {
516
516
  clearTimeout(arranque)
517
+ // lmcp-api#661: el server existió; su evento dice cuánto vivió.
518
+ const lifetimeBucket = evento.baldeDeVida(Date.now() - nacio)
517
519
  if (code === 0) reportarLanzamiento('spawned')
518
520
  else if (signal) {
519
521
  // #133: el cliente que cierra el server es `client-closed`; una señal de caída sigue siendo una falla.
520
522
  const s = evento.salidaPorSenal(signal)
521
- reportarLanzamiento(s.outcome, { reason: s.reason, signal: s.signal })
522
- } else reportarLanzamiento('spawn-failed', { reason: 'early-exit' })
523
+ reportarLanzamiento(s.outcome, { reason: s.reason, signal: s.signal, lifetimeBucket })
524
+ } else reportarLanzamiento('spawn-failed', { reason: 'early-exit', lifetimeBucket })
525
+ }
526
+ if (ES_LANZAMIENTO) {
527
+ evento.reportarSalida(Date.now() - nacio, code, signal)
528
+ evento.reportarSalidaHijo(Date.now() - nacio, code, signal)
523
529
  }
524
- if (ES_LANZAMIENTO) evento.reportarSalidaHijo(Date.now() - nacio, code, signal)
525
530
  alSalirHijo(() => process.exit(code ?? 0))
526
531
  })
527
532
  }
528
533
 
534
+ // lmcp-npm#199: the embedded server only from 3.0.429 on (bundled.js chooseServer). Its version
535
+ // is its app's: the server ships inside it and the app's updater replaces the whole bundle.
536
+ const { chooseServer, reinstallNotice } = require('./bundled')
529
537
  const embedded = findEmbeddedServer()
530
- if (embedded) {
538
+ const bundled = require('./bundled').bundledServerPath()
539
+ const elegido = chooseServer({
540
+ embedded,
541
+ embeddedVersion: embedded && require('./download')._bundleVersion(path.dirname(path.dirname(path.dirname(embedded)))),
542
+ bundled: bundled && fs.existsSync(bundled) ? bundled : null,
543
+ })
544
+ evento.fuente(elegido.source)
545
+ if (elegido.reinstall) {
546
+ avisar(reinstallNotice() + '\n')
547
+ reportarLanzamiento('spawn-failed', { reason: 'embedded-too-old' })
548
+ process.exit(1)
549
+ }
550
+ if (elegido.source === 'app_embedded') {
531
551
  let v = pkg.version
532
552
  try {
533
553
  v = fs.readFileSync(
@@ -535,14 +555,11 @@ async function main() {
535
555
  'utf8'
536
556
  ).trim() || pkg.version
537
557
  } catch {}
538
- evento.fuente('app_embedded')
539
- launchMcpStdio(embedded, v, false)
558
+ launchMcpStdio(elegido.path, v, false)
540
559
  return
541
560
  }
542
561
 
543
- const bundled = require('./bundled').bundledServerPath()
544
- evento.fuente(bundled && fs.existsSync(bundled) ? 'bundled' : 'missing_platform')
545
- if (!bundled || !fs.existsSync(bundled)) {
562
+ if (!elegido.path) {
546
563
  reportarLanzamiento('spawn-failed', { reason: 'binary-missing' })
547
564
  const { TARGETS } = require('./bundled')
548
565
  avisar(TARGETS[`${process.platform}-${process.arch}`]
package/launch-event.js CHANGED
@@ -25,7 +25,7 @@ const OUTCOMES = ['spawned', 'rejected-argument', 'unsupported-node', 'unsupport
25
25
  // clasificar (`download-failed`, `spawn-failed`, `other`); `checksum-mismatch` e `init-failed`
26
26
  // son del contrato y este wrapper no los produce.
27
27
  const RAZONES = ['network', 'timeout', 'http-status', 'checksum-mismatch', 'disk-write',
28
- 'permission-denied', 'binary-missing', 'early-exit', 'signal', 'uncaught-exception', 'init-failed', 'unknown']
28
+ 'permission-denied', 'binary-missing', 'early-exit', 'signal', 'uncaught-exception', 'init-failed', 'unknown', 'embedded-too-old']
29
29
  const CAMINO = 'npm-wrapper' // launch_path: quién arrancó el server
30
30
  // 3.0.423 (lmcp-api#548): qué binario encontró el lanzamiento. El wrapper lo fija con fuente() en
31
31
  // cuanto lo sabe; antes de saberlo (desinstalado, argumento rechazado) el evento no lo lleva.
@@ -116,6 +116,8 @@ function cuerpo (outcome, clase, deps = {}) {
116
116
  if (FUENTES.includes(f)) c.binary_source = f
117
117
  const id = 'machineId' in deps ? deps.machineId : idDeMaquina()
118
118
  if (typeof id === 'string' && RE_MAQUINA.test(id)) c.machine_id = id
119
+ // lmcp-api#661: cuánto vivió el server lanzado; `spawned` sale antes de que exista.
120
+ if (outcome !== 'spawned' && BALDES_VIDA.includes(deps.lifetimeBucket)) c.lifetime_bucket = deps.lifetimeBucket
119
121
  return c
120
122
  }
121
123
 
@@ -157,12 +159,12 @@ function reportarSalidaHijo (ms, code, signal, deps = {}) {
157
159
  // un manejador, y relanzar SIGINT cambiaría el código de salida.
158
160
  const SENALES_DE_CIERRE = ['SIGTERM', 'SIGINT', 'SIGHUP']
159
161
  function rastroAlCerrarPorSenal (nacio, deps = {}) {
160
- const { proceso = process, plataforma = process.platform, reportar = reportarSalidaHijo, diferir = setImmediate } = deps
162
+ const { proceso = process, plataforma = process.platform, reportar = reportarSalidaHijo, salida = reportarSalida, diferir = setImmediate } = deps
161
163
  if (plataforma === 'win32') return (salir) => salir()
162
164
  let reportado = false
163
165
  const soltar = () => { for (const s of SENALES_DE_CIERRE) proceso.removeListener(s, alRecibir) }
164
166
  function alRecibir (senal) {
165
- if (!reportado) try { reportar(Date.now() - nacio, null, senal) } catch {}
167
+ if (!reportado) try { salida(Date.now() - nacio, null, senal); reportar(Date.now() - nacio, null, senal) } catch {}
166
168
  soltar()
167
169
  proceso.kill(proceso.pid, senal)
168
170
  }
@@ -184,7 +186,7 @@ function lanzarSalidaSuelta (balde, clase) {
184
186
 
185
187
  // Un POST, sin reintento, respuesta ignorada. `soltar` es para el pedido que sale desde el
186
188
  // wrapper vivo: el socket no retiene al proceso.
187
- function enviar (c, { soltar = false, ruta = DESTINO.path, timeout = TIMEOUT_MS } = {}) {
189
+ function enviar (c, { soltar = false, ruta = DESTINO.path, timeout = TIMEOUT_MS, alTerminar = () => {} } = {}) {
188
190
  try {
189
191
  const datos = JSON.stringify(c)
190
192
  const req = https.request({
@@ -193,8 +195,8 @@ function enviar (c, { soltar = false, ruta = DESTINO.path, timeout = TIMEOUT_MS
193
195
  method: 'POST',
194
196
  headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(datos) },
195
197
  timeout
196
- }, (res) => res.resume())
197
- req.on('error', () => {})
198
+ }, (res) => { alTerminar(); res.resume() })
199
+ req.on('error', () => alTerminar())
198
200
  req.on('timeout', () => { try { req.destroy() } catch {} })
199
201
  if (soltar) req.on('socket', (s) => { try { s.unref() } catch {} })
200
202
  req.end(datos)
@@ -261,12 +263,14 @@ function idDeHardwareWindows (listo) {
261
263
  // Una persona en una terminal (stdin TTY) no es un cliente de IA lanzando el server: no reporta.
262
264
  let reportado = false
263
265
  let pendiente = null
264
- function reportar (outcome, clase, { enProceso = false, reason, signal, errorClass } = {}) {
266
+ let lanzado = null // lmcp-api#661: el `spawned` de este lanzamiento ({ clase, machineId }), para su salida
267
+ function reportar (outcome, clase, { enProceso = false, reason, signal, errorClass, lifetimeBucket } = {}) {
265
268
  if (reportado) return
266
269
  reportado = true
267
270
  try {
268
271
  if (apagado() || (process.stdin && process.stdin.isTTY)) return
269
272
  if (!OUTCOMES.includes(outcome) || !CLASES.includes(clase)) return
273
+ if (outcome === 'spawned') lanzado = { clase }
270
274
  if (enProceso) {
271
275
  const idEntorno = (process.env.LMCP_MACHINE_ID || '').trim()
272
276
  if (process.platform === 'win32' && !idEntorno) {
@@ -276,7 +280,7 @@ function reportar (outcome, clase, { enProceso = false, reason, signal, errorCla
276
280
  const guardado = dl._readStoredMachineId(dl.CACHE_DIR)
277
281
  if (guardado || !dl._readCachedCloudToken(dl.CACHE_DIR)) {
278
282
  const c = cuerpo(outcome, clase, { machineId: guardado })
279
- if (c) enviar(c, { soltar: true })
283
+ if (c) enviarEnProceso(c)
280
284
  return
281
285
  }
282
286
  pendiente = { outcome, clase }
@@ -284,36 +288,70 @@ function reportar (outcome, clase, { enProceso = false, reason, signal, errorCla
284
288
  if (!pendiente) return // ya salió por el proceso suelto
285
289
  pendiente = null
286
290
  const c = cuerpo(outcome, clase, { machineId: id })
287
- if (c) enviar(c, { soltar: true })
291
+ if (c) enviarEnProceso(c)
288
292
  })
289
293
  return
290
294
  }
291
295
  const c = cuerpo(outcome, clase, process.platform === 'win32' ? { machineId: idEntorno } : {})
292
- if (c) enviar(c, { soltar: true })
296
+ if (c) enviarEnProceso(c)
293
297
  return
294
298
  }
295
- lanzarSuelto(outcome, clase, { reason, signal, errorClass })
299
+ lanzarSuelto(outcome, clase, { reason, signal, errorClass, lifetimeBucket })
296
300
  } catch {}
297
301
  }
298
302
 
303
+ // lmcp-api#661: después de un `spawned` no salía nada. Sale UN `client-closed` con el balde y el machine_id de ese
304
+ // `spawned` cuando el cliente terminó la sesión (código 0 o una señal suya) antes de 10 s: el que nunca llegó a latir.
305
+ // Un crash después de `spawned` no sale (movería la alerta del release), ni una sesión larga (uno más por sesión).
306
+ // Sin el id del `spawned` (salió por el proceso suelto), el proceso suelto busca el suyo, por el mismo camino.
307
+ const VIDA_CORTA_MS = 10000
308
+ function reportarSalida (ms, code, signal) {
309
+ const l = lanzado
310
+ lanzado = null
311
+ try {
312
+ if (!l || !(ms < VIDA_CORTA_MS)) return
313
+ if (signal ? !DEL_CLIENTE.includes(signal) : code !== 0) return
314
+ lanzarSuelto('client-closed', l.clase, { signal: signal || undefined, lifetimeBucket: baldeDeVida(ms), machineId: l.machineId, despues: true })
315
+ } catch {}
316
+ }
317
+
318
+ // El `spawned` desde el wrapper vivo. Si el wrapper sale con el pedido en vuelo, process.exit lo corta y la salida de
319
+ // ese lanzamiento llegaría sola (api#1238 no la cuenta sin su `spawned` antes): soltarPendiente lo vuelve a mandar por
320
+ // el proceso suelto, con el mismo id. Si el primero ya había llegado sin contestar, la API ve dos `spawned` del mismo
321
+ // lanzamiento a milisegundos: los dos quedan seguidos por la misma salida.
322
+ let enVuelo = null
323
+ function enviarEnProceso (c) {
324
+ if (lanzado) lanzado.machineId = c.machine_id
325
+ const este = enVuelo = { outcome: c.outcome, clase: c.arg_class, machineId: c.machine_id }
326
+ enviar(c, { soltar: true, alTerminar: () => { if (enVuelo === este) enVuelo = null } })
327
+ }
328
+
299
329
  // Un lanzamiento que el wrapper decide no reportar (#48: ya avisó dentro de la ventana) se marca
300
330
  // como reportado para que la red del `exit` tampoco lo mande como `other`.
301
331
  function silenciar () { reportado = true }
302
332
 
303
333
  // La razón, la fuente del binario y la señal viajan como argumento sólo si son del conjunto (los tres no se
304
334
  // cruzan); la clase de error, sólo si pasa su regex y con prefijo. Al proceso suelto no le llega texto libre.
305
- function argumentosSueltos (outcome, clase, { reason, signal, errorClass } = {}) {
335
+ function argumentosSueltos (outcome, clase, { reason, signal, errorClass, lifetimeBucket, machineId, despues } = {}) {
306
336
  return [outcome, clase, ...(RAZONES.includes(reason) ? [reason] : []),
307
337
  ...(FUENTES.includes(fuenteBinario) ? [fuenteBinario] : []),
308
338
  ...(SENALES.includes(signal) ? [signal] : []),
309
- ...(typeof errorClass === 'string' && RE_CLASE_ERROR.test(errorClass) ? ['error_class=' + errorClass] : [])]
339
+ ...(typeof errorClass === 'string' && RE_CLASE_ERROR.test(errorClass) ? ['error_class=' + errorClass] : []),
340
+ ...(BALDES_VIDA.includes(lifetimeBucket) ? ['lifetime_bucket=' + lifetimeBucket] : []),
341
+ ...(typeof machineId === 'string' && RE_MAQUINA.test(machineId) ? ['machine_id=' + machineId] : []),
342
+ ...(despues ? ['despues'] : [])]
310
343
  }
311
344
  function desdeArgv (argv) {
312
345
  const resto = argv.slice(2)
313
346
  const clase = resto.map(a => a.startsWith('error_class=') ? a.slice(12) : null).find(a => a !== null)
347
+ const valor = (k) => { const a = resto.find(x => x.startsWith(k + '=')); return a === undefined ? undefined : a.slice(k.length + 1) }
348
+ const id = valor('machine_id')
314
349
  return { outcome: argv[0], clase: argv[1], reason: resto.find(a => RAZONES.includes(a)),
315
350
  binarySource: resto.find(a => FUENTES.includes(a)), signal: resto.find(a => SENALES.includes(a)),
316
- errorClass: clase !== undefined && RE_CLASE_ERROR.test(clase) ? clase : undefined }
351
+ errorClass: clase !== undefined && RE_CLASE_ERROR.test(clase) ? clase : undefined,
352
+ lifetimeBucket: BALDES_VIDA.find(b => b === valor('lifetime_bucket')), despues: resto.includes('despues'),
353
+ // Sin id válido por argv, la clave no va: cuerpo() busca el suyo.
354
+ ...(id !== undefined && RE_MAQUINA.test(id) ? { machineId: id } : {}) }
317
355
  }
318
356
 
319
357
  function lanzarSuelto (outcome, clase, opciones) {
@@ -327,6 +365,9 @@ function lanzarSuelto (outcome, clase, opciones) {
327
365
  // y el probe que seguía vivo se mata (el timeout de execFile vive en el wrapper y se va con él).
328
366
  function soltarPendiente () {
329
367
  cancelarProbe()
368
+ const v = enVuelo
369
+ enVuelo = null
370
+ if (v) try { lanzarSuelto(v.outcome, v.clase, { machineId: v.machineId }) } catch {}
330
371
  if (!pendiente) return
331
372
  const { outcome, clase } = pendiente
332
373
  pendiente = null
@@ -335,18 +376,21 @@ function soltarPendiente () {
335
376
 
336
377
  // Como programa es el proceso suelto: `node launch-event.js <outcome> <clase> [reason] [binary_source]`.
337
378
  if (require.main === module) {
338
- setTimeout(() => process.exit(0), TOPE_MS).unref()
339
379
  const argv = process.argv.slice(2)
380
+ // lmcp-api#661: la salida de un `spawned` espera el timeout del pedido (3 s), así llega después de él aunque el
381
+ // `spawned` haya salido a la vez por otro proceso suelto con la red lenta. api#1238 no tolera el orden inverso.
382
+ const ESPERA_MS = argv.includes('despues') ? TIMEOUT_MS : 0
383
+ setTimeout(() => process.exit(0), TOPE_MS + ESPERA_MS).unref()
340
384
  if (argv[0] === 'npm_child_exit') {
341
385
  const c = apagado() ? null : cuerpoSalidaHijo(argv[1], argv[2])
342
386
  if (c) enviar(c, { ruta: '/events', timeout: 2000 })
343
387
  } else {
344
388
  const a = desdeArgv(argv)
345
389
  const c = apagado() ? null : cuerpo(a.outcome, a.clase, a)
346
- if (c) enviar(c)
390
+ if (c) setTimeout(() => enviar(c), ESPERA_MS)
347
391
  }
348
392
  }
349
393
 
350
394
  module.exports = { BALDES_VIDA, CLASES_SALIDA, baldeDeVida, claseDeSalidaHijo, cuerpoSalidaHijo, reportarSalidaHijo, rastroAlCerrarPorSenal, PLATAFORMAS, CLASES, OUTCOMES, RAZONES, CAMINO, FUENTES, SENALES, RE_CLASE_ERROR, fuente, razonDeError,
351
- salidaPorSenal, claseDeError, argumentosSueltos, desdeArgv, RE_VERSION, RE_MAQUINA, TOPE_ID_MS, claseDeArgumento, apagado, cuerpo, reportar, silenciar, soltarPendiente,
395
+ salidaPorSenal, claseDeError, argumentosSueltos, desdeArgv, RE_VERSION, RE_MAQUINA, TOPE_ID_MS, claseDeArgumento, apagado, cuerpo, reportar, reportarSalida, silenciar, soltarPendiente,
352
396
  _idDeHardwareWindows: idDeHardwareWindows } // costura de test
package/link.js CHANGED
@@ -77,6 +77,10 @@ const TABLA = {
77
77
  not_linkable: ["This computer can't be linked to an account.", `Please report it to ${REPORT}`],
78
78
  // lmcp-mac#1550: the binary cannot read this computer's token until the app is opened again.
79
79
  open_lmcp_app: ['LMCP needs to be opened again on this computer.', `Quit LMCP, open it again, then run: ${RESUME}`],
80
+ // lmcp-win#1508: Windows cannot read this computer's key from a logon session with no credential vault (SSH,
81
+ // a service). Waiting does not fix it; the desktop session does.
82
+ device_key_unavailable_in_session: ["LMCP can't read this computer's key from this session (over SSH or from a service).",
83
+ `Sign in to this computer's desktop, open a terminal there and run: ${RESUME}`],
80
84
  // lmcp-win#1270: the device key could not be read, created or enrolled. A 5xx or a locked keychain pass, and
81
85
  // link tries again from the start. npx may have no app, so the text does not name one.
82
86
  no_key: ["Could not prepare this computer's key.", `Wait a few minutes and run: ${RESUME}. If it keeps happening, report it to ${REPORT}`],
@@ -100,6 +104,21 @@ function _falla(print, track) {
100
104
  }
101
105
  }
102
106
 
107
+ // lmcp-mac#1672 (review option A): with the LMCP app on this computer the binary links nothing from here
108
+ // (link_in_app, approve_in_app); the app does. A notice, not a failure: setup goes on. The line is
109
+ // npm's own, per system (Darío, 2026-11-14, option c): nothing the binary prints is shown.
110
+ const EN_LA_APP = {
111
+ mac: 'Link this Mac from the LMCP app: icon → More actions → Link this Mac to your local-mcp.com account.',
112
+ pc: 'Link this PC from the LMCP app: icon → More actions → Link this PC to your local-mcp.com account.',
113
+ }
114
+ const ERRORES_EN_LA_APP = ['link_in_app', 'approve_in_app']
115
+
116
+ function _enLaApp(print, track, r, platform) {
117
+ print(`\n ${platform === 'win32' ? EN_LA_APP.pc : EN_LA_APP.mac}`)
118
+ track('skipped', r.error)
119
+ return { state: 'in_app', error: r.error }
120
+ }
121
+
103
122
  // The binary keeps the one-time id on these: the same command works again a bit later.
104
123
  const REINTENTABLES = ['try_later', 'network', 'no_device_key']
105
124
 
@@ -113,6 +132,7 @@ async function runDecision(modo, opts = {}) {
113
132
  if (!opts.bin && !opts.exec) return falla('no_binary', `Could not ${que} the link on this computer`)
114
133
  // #140: written out, so the scan of npm/test/servidor-minimo-138.test.js reads each command.
115
134
  const r = _leer(opts.exec || _execDefault(opts.bin), modo === 'approve' ? ['link', '--approve', '--json'] : ['link', '--deny', '--json'])
135
+ if (ERRORES_EN_LA_APP.includes(r.error)) return _enLaApp(print, track, r, opts.platform || process.platform)
116
136
  if (REINTENTABLES.includes(r.error)) {
117
137
  print(`\n ⚠ Could not ${que} the link on this computer yet (${r.error}).`)
118
138
  print(` Try again: ${RESUME} --${modo}`)
@@ -145,6 +165,7 @@ async function runLink(opts = {}) {
145
165
  const exec = opts.exec || _execDefault(opts.bin)
146
166
 
147
167
  const pedido = _leer(exec, ['link', '--json'])
168
+ if (ERRORES_EN_LA_APP.includes(pedido.error)) return _enLaApp(print, track, pedido, opts.platform || process.platform)
148
169
  if (pedido.error === 'linked_elsewhere') {
149
170
  // Neutral, without the account hint: whoever runs setup may not be the account's owner.
150
171
  print('\n This computer is already linked to an LMCP account.')
@@ -165,13 +186,16 @@ async function runLink(opts = {}) {
165
186
  return { state: 'linked', account: pedido.account || null }
166
187
  }
167
188
  const local = pedido.local_required === true
168
- const url = pedido.url, code = pedido.code
169
- if (pedido.awaiting_local !== true) {
170
- if (typeof url !== 'string' || typeof code !== 'string') return falla(local ? 'local_required' : 'bad_output')
171
- print('\n Link this machine to your LMCP account:')
189
+ let url = pedido.url, code = pedido.code
190
+ const mostrar = () => {
172
191
  print(` Open ${url}`)
173
192
  print(' (sign in or create your account there, then confirm)')
174
193
  print(` Or enter the code ${code} in My LMCP — ${MY_LMCP}`)
194
+ }
195
+ if (pedido.awaiting_local !== true) {
196
+ if (typeof url !== 'string' || typeof code !== 'string') return falla(local ? 'local_required' : 'bad_output')
197
+ print('\n Link this machine to your LMCP account:')
198
+ mostrar()
175
199
  if (local) {
176
200
  print(' After you confirm on the web, this computer asks you to approve it here: that last step links it.')
177
201
  print(' Waiting for the web confirmation…')
@@ -192,6 +216,14 @@ async function runLink(opts = {}) {
192
216
  while (e || now() < hasta) {
193
217
  if (!e) { await sleep(CADA_MS); e = _leer(exec, ['link', '--json']) }
194
218
  if (e.linked === true) return vinculada(e)
219
+ // #192: the API gives back the same code while it lives; with 60 s or less left, or expired, a new one that
220
+ // voids the old one (lmcp-api#1009). The screen follows the last answer.
221
+ if (typeof e.code === 'string' && typeof e.url === 'string' && e.code !== code) {
222
+ // With no code shown yet (it started at awaiting_local), the first one is not «expired».
223
+ print(code !== undefined ? ' That code expired. Use this one:' : '\n Link this machine to your LMCP account:')
224
+ url = e.url; code = e.code
225
+ mostrar()
226
+ }
195
227
  if (e.error === 'local_lost') return perdida()
196
228
  if (e.awaiting_local === true && !tty) {
197
229
  // An agent ran setup: nobody can type y here. The person approves by hand, with the same binary.
@@ -262,4 +294,8 @@ async function runLinkCommand(args = []) {
262
294
  return runLink(opts)
263
295
  }
264
296
 
265
- module.exports = { runLink, runLinkCommand, runDecision, runRegister, RESUME }
297
+ // lmcp-npm#182: the classes a `failed` can carry, a fixed list for npx_setup's `detail` (plus http_<status> and exit_<n>).
298
+ const CLASES_FALLA = [...new Set([...Object.keys(TABLA), ...Object.keys(SIN_ARREGLO_EN_LA_WEB), ...Object.values(CODIGO_DE_REGISTRO),
299
+ 'bad_output', 'no_binary', 'denied', 'linked_elsewhere', 'local_lost'])]
300
+
301
+ module.exports = { runLink, runLinkCommand, runDecision, runRegister, RESUME, CLASES_FALLA }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-mcp",
3
- "version": "3.0.446",
3
+ "version": "3.0.448",
4
4
  "description": "Let ChatGPT, Claude, Cursor & any MCP client actually use your Mac or Windows PC — read & reply to email, manage your calendar, text over iMessage, find files, work with Teams, Slack, Notion & Office. Runs locally, no API keys.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -26,10 +26,10 @@
26
26
  "node": ">=20"
27
27
  },
28
28
  "optionalDependencies": {
29
- "local-mcp-darwin-arm64": "3.0.446",
30
- "local-mcp-darwin-x64": "3.0.446",
31
- "local-mcp-windows-x64": "3.0.446",
32
- "local-mcp-windows-arm64": "3.0.446"
29
+ "local-mcp-darwin-arm64": "3.0.448",
30
+ "local-mcp-darwin-x64": "3.0.448",
31
+ "local-mcp-windows-x64": "3.0.448",
32
+ "local-mcp-windows-arm64": "3.0.448"
33
33
  },
34
34
  "os": [
35
35
  "darwin",
package/setup.js CHANGED
@@ -13,7 +13,7 @@ const path = require('path')
13
13
  const os = require('os')
14
14
  const { execSync, execFileSync } = require('child_process')
15
15
  const download = require('./download')
16
- const { runLink, runRegister } = require('./link')
16
+ const { runLink, runRegister, CLASES_FALLA } = require('./link')
17
17
 
18
18
  const HOME = os.homedir()
19
19
  const NPX_COMMAND = 'npx'
@@ -377,9 +377,13 @@ async function runSetup(opts = {}) {
377
377
  let binaryVersion = ''
378
378
  // ADR-0004 phase 3 (darwin): if the notarized server is already embedded in
379
379
  // LocalMCPTray.app, the launcher (→ npx → index.js) prefers it.
380
- const _embeddedServer = process.platform === 'darwin'
380
+ const _embeddedFound = process.platform === 'darwin'
381
381
  ? download.trayAppPaths().map(app => path.join(app, 'Contents', 'MacOS', 'local-mcp-server')).find(p => { try { return fs.statSync(p).isFile() } catch { return false } })
382
382
  : null
383
+ // lmcp-npm#199: an app before 3.0.429 is not used, and the person is told to reinstall it.
384
+ const _embeddedServer = _embeddedFound && require('./bundled').embeddedCurrent(download._bundleVersion(path.dirname(path.dirname(path.dirname(_embeddedFound)))))
385
+ ? _embeddedFound : null
386
+ if (_embeddedFound && !_embeddedServer) process.stderr.write(require('./bundled').reinstallNotice() + '\n\n')
383
387
  // 3.0.423: the server comes in npm's platform package (bundled.js). Nothing is downloaded and
384
388
  // nothing is re-signed: the Mac binary keeps its Developer ID signature.
385
389
  const _bundled = (() => { const p = require('./bundled').bundledServerPath(); try { return p && fs.statSync(p).isFile() ? p : null } catch { return null } })()
@@ -757,11 +761,24 @@ const NPX_SETUP_DE_PASO = {
757
761
  'account_link:shown': 'link_shown', 'account_link:linked': 'linked', 'account_link:failed': 'failed',
758
762
  'setup_complete:failed': 'failed',
759
763
  }
760
- function _trackNpxSetup(status) {
764
+ // lmcp-npm#182: a `failed` says which step and why, «<paso>:<clase>», from a fixed list; anything else is «other».
765
+ const NPX_SETUP_PASOS_FALLA = ['relay_register', 'account_link', 'setup_complete']
766
+ const CLASES_FIN = ['no_client_detected', 'clients_failed', 'runtime_none',
767
+ ...['failed', 'no_runtime', 'not_supported_on_platform', 'runtime_too_old', 'timeout', 'unsupported_report_schema'].map(r => 'runtime_' + r)]
768
+ function _detalleNpxSetup(paso, clase) {
769
+ if (!NPX_SETUP_PASOS_FALLA.includes(paso)) return undefined
770
+ const ok = typeof clase === 'string' && (CLASES_FALLA.includes(clase) || CLASES_FIN.includes(clase) || /^http_\d{3}$/.test(clase) || /^exit_\d{1,3}$/.test(clase))
771
+ return `${paso}:${ok ? clase : 'other'}`
772
+ }
773
+ function _trackNpxSetup(status, detalle) {
761
774
  try {
762
775
  if (!NPX_SETUP.includes(status) || require('./launch-event').apagado()) return
776
+ // lmcp-npm#182: CI runs (release checks, other repos' smokes) are not users' setups; postinstall.js skips them too.
777
+ if (process.env.CI) return
763
778
  const { https } = require('./user-agent')
764
- const data = JSON.stringify({ step: 'npx_setup', status, platform: process.platform })
779
+ const cuerpo = { step: 'npx_setup', status, platform: process.platform }
780
+ if (status === 'failed' && detalle) cuerpo.detail = detalle
781
+ const data = JSON.stringify(cuerpo)
765
782
  const req = https.request({
766
783
  hostname: BACKEND_HOST,
767
784
  path: '/install/step',
@@ -776,7 +793,8 @@ function _trackNpxSetup(status) {
776
793
  }
777
794
 
778
795
  function _trackSetupStep(step, status, client, detail) {
779
- _trackNpxSetup(NPX_SETUP_DE_PASO[`${step}:${status}`])
796
+ const npx = NPX_SETUP_DE_PASO[`${step}:${status}`]
797
+ _trackNpxSetup(npx, npx === 'failed' ? _detalleNpxSetup(step, detail && detail.error) : undefined)
780
798
  try {
781
799
  const { https } = require('./user-agent')
782
800
  const payload = {
package/unconfigure.js CHANGED
@@ -562,14 +562,37 @@ function removeLocalState (st, { exec = require('child_process').execFileSync, r
562
562
  return { removed, left, credentialsLeft, unconfirmed }
563
563
  }
564
564
 
565
+ // #190: npx keeps the package in npm's cache (`_npx/<hash>`, the server .exe included) and uninstall does not
566
+ // delete it: one entry is running this command and the server can be running from another. They are listed,
567
+ // each with its command. The root is the one this command runs from, else the cache npm exports to it, else npm's default.
568
+ function npxCacheRoot ({ dir = __dirname, env = process.env, platform = process.platform, home = os.homedir() } = {}) {
569
+ const m = /^(.*[\\/]_npx)[\\/][^\\/]+[\\/]node_modules[\\/]local-mcp$/.exec(dir)
570
+ if (m) return m[1]
571
+ if (env.npm_config_cache) return path.join(env.npm_config_cache, '_npx')
572
+ if (platform === 'win32') return path.join(env.LOCALAPPDATA || path.join(home, 'AppData', 'Local'), 'npm-cache', '_npx')
573
+ return path.join(home, '.npm', '_npx')
574
+ }
575
+
576
+ // Only an absolute `_npx` folder: a relative or odd root (an empty npm_config_cache, a cwd) lists nothing.
577
+ function npxCacheEntries (root) {
578
+ if (typeof root !== 'string' || !path.isAbsolute(root) || path.basename(root) !== '_npx') return []
579
+ let hashes = []
580
+ try { hashes = fs.readdirSync(root) } catch {}
581
+ return hashes.map((h) => path.join(root, h)).filter((d) => fs.existsSync(path.join(d, 'node_modules', 'local-mcp')))
582
+ }
583
+
565
584
  // What the command prints for removeLocalState: «uninstalled» alone only when nothing is in doubt.
566
- function localStateReport ({ removed, left, credentialsLeft, unconfirmed }) {
585
+ function localStateReport ({ removed, left, credentialsLeft, unconfirmed, npxLeft = [] }, platform = process.platform) {
567
586
  const lines = []
568
587
  if (removed.length) lines.push('Removed this computer\'s LMCP data: ' + removed.join(', '))
569
588
  if (left.length) lines.push('Could not remove (in use): ' + left.join(', ') + '. Close LMCP and run uninstall again, or remove them by hand.')
570
589
  if (credentialsLeft.length) lines.push('Could not remove: ' + credentialsLeft.join(', ') + '. Remove them in Credential Manager, under Windows Credentials.')
571
590
  if (unconfirmed.length) lines.push('Not found, so not removed: ' + unconfirmed.join(', ') + '. This is expected if they were never created. Over ssh or in a service, Windows credentials cannot be seen: check Credential Manager from your desktop session.')
572
- lines.push(left.length || credentialsLeft.length || unconfirmed.length ? 'Local MCP uninstalled, except anything listed above that is still there.' : 'Local MCP uninstalled.')
591
+ // One command per line: cmd.exe has no ` ; `. `cmd /c` so the line runs in cmd and in PowerShell, where `rd` is
592
+ // Remove-Item and /s fails; inside the double quotes cmd takes `&` and spaces literally. Elsewhere single quotes.
593
+ const borrar = (d) => platform === 'win32' ? `cmd /c rd /s /q "${d}"` : `rm -rf '${d.replace(/'/g, "'\\''")}'`
594
+ if (npxLeft.length) lines.push('npx keeps a copy of LMCP in npm\'s cache. To remove it, after this command ends, run:', ...npxLeft.map((d) => ' ' + borrar(d)))
595
+ lines.push(left.length || credentialsLeft.length || unconfirmed.length || npxLeft.length ? 'Local MCP uninstalled, except anything listed above that is still there.' : 'Local MCP uninstalled.')
573
596
  return lines
574
597
  }
575
598
 
@@ -585,4 +608,4 @@ function runtimeInUse (dir, { platform = process.platform, open = fs.openSync }
585
608
  })
586
609
  }
587
610
 
588
- module.exports = { unconfigureClients, localState, removeLocalState, localStateReport, runtimeInUse }
611
+ module.exports = { unconfigureClients, localState, removeLocalState, localStateReport, runtimeInUse, npxCacheRoot, npxCacheEntries }