local-mcp 3.0.424 → 3.0.426

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.
Files changed (3) hide show
  1. package/index.js +48 -24
  2. package/package.json +5 -5
  3. package/setup.js +7 -88
package/index.js CHANGED
@@ -4,12 +4,12 @@
4
4
  * index.js — entry point del paquete npm local-mcp.
5
5
  *
6
6
  * Modos:
7
- * npx local-mcp → arranca el server MCP que trae el paquete (sin descargar nada); en
7
+ * npx -y local-mcp@latest → arranca el server MCP que trae el paquete (sin descargar nada); en
8
8
  * terminal interactiva muestra mensaje de listo y sale
9
- * npx local-mcp setup → wizard de configuración de clientes
10
- * npx local-mcp update → dice cómo actualizar (npx -y local-mcp@latest)
11
- * npx local-mcp uninstall → desinstala
12
- * npx local-mcp status → muestra estado del servidor local
9
+ * npx -y local-mcp@latest setup → wizard de configuración de clientes
10
+ * npx -y local-mcp@latest update → dice cómo actualizar (npx -y local-mcp@latest)
11
+ * npx -y local-mcp@latest uninstall → desinstala
12
+ * npx -y local-mcp@latest status → muestra estado del servidor local
13
13
  */
14
14
 
15
15
  const { spawn, execSync } = require('child_process')
@@ -70,15 +70,41 @@ function marcarAvisoDesinstalado() {
70
70
  try { fs.writeFileSync(avisoDesinstaladoPath(), String(Date.now())) } catch {}
71
71
  }
72
72
 
73
+ // #48 (Darío, 2026-10-17, opción A): in the «uninstalled» state the wrapper does NOT exit 0 (the AI
74
+ // client would relaunch it in a loop). It stays alive on stdio and answers initialize and every tool
75
+ // with a clear error, until the client closes stdin. Newline-delimited JSON-RPC, no dependencies.
76
+ const MENSAJE_DESINSTALADO = 'LMCP was uninstalled; remove it from this AI client'
77
+ function quedarseVivoDesinstalado() {
78
+ evento.silenciar()
79
+ if (process.stdin.isTTY) process.exit(0)
80
+ const out = (id, extra) => process.stdout.write(JSON.stringify({ jsonrpc: '2.0', id, ...extra }) + '\n')
81
+ let buf = ''
82
+ process.stdin.setEncoding('utf8')
83
+ process.stdin.on('data', (d) => {
84
+ buf += d
85
+ let i
86
+ while ((i = buf.indexOf('\n')) >= 0) {
87
+ const linea = buf.slice(0, i).trim(); buf = buf.slice(i + 1)
88
+ let m; try { m = JSON.parse(linea) } catch { continue }
89
+ if (!m || m.id === undefined || typeof m.method !== 'string') continue // notifications and replies
90
+ if (m.method === 'initialize') {
91
+ out(m.id, { result: { protocolVersion: (m.params && m.params.protocolVersion) || '2025-06-18', capabilities: { tools: {} }, serverInfo: { name: 'local-mcp', version: require('./package.json').version }, instructions: MENSAJE_DESINSTALADO } })
92
+ } else if (m.method === 'tools/list') out(m.id, { result: { tools: [] } })
93
+ else if (m.method === 'tools/call') out(m.id, { result: { isError: true, content: [{ type: 'text', text: MENSAJE_DESINSTALADO }] } })
94
+ else if (m.method === 'ping') out(m.id, { result: {} })
95
+ else out(m.id, { error: { code: -32601, message: MENSAJE_DESINSTALADO } })
96
+ }
97
+ })
98
+ process.stdin.on('end', () => process.exit(0))
99
+ }
100
+
73
101
  // Whether the LMCP menu-bar app is on this machine. The server path never installs it; when
74
102
  // it is missing the wrapper says so in one stderr line. Mac: the tray bundle in ~/Applications
75
103
  // or /Applications. Windows: lmcp-tray.exe, which LMCP-Setup.exe puts next to the server in the
76
104
  // cache dir (lmcp-win cmd/lmcp-server/tray_windows.go). On Windows `setup` installs no tray
77
- // (ensureTray is a no-op there), so the line names only the installer.
78
- function menuBarAppHowToInstall(platform = process.platform) {
79
- return platform === 'darwin'
80
- ? 'npx local-mcp setup, or the installer from https://local-mcp.com'
81
- : 'the installer from https://local-mcp.com'
105
+ // (ensureTray is a no-op there), so the line names only the installer. Neither does it on Mac now: npx is server-only.
106
+ function menuBarAppHowToInstall() {
107
+ return 'the installer from https://local-mcp.com'
82
108
  }
83
109
  function menuBarAppMissingLine(platform = process.platform) {
84
110
  return `[LMCP] The LMCP menu-bar app is not installed; running the MCP server only. To install it: ${menuBarAppHowToInstall(platform)}`
@@ -316,18 +342,16 @@ async function main() {
316
342
  // runtime-dir and durable App Support copies (see uninstallSentinelPaths).
317
343
  {
318
344
  if (anyUninstallSentinel()) {
319
- if (avisoDesinstaladoVigente()) {
320
- evento.silenciar()
321
- process.exit(0)
345
+ if (!avisoDesinstaladoVigente()) {
346
+ marcarAvisoDesinstalado()
347
+ reportarLanzamiento('uninstalled')
348
+ process.stderr.write(
349
+ '[LMCP] Local MCP was uninstalled — not starting.\n' +
350
+ ' Reinstall: npx -y local-mcp@latest setup\n' +
351
+ " Or remove the \"local-mcp\" entry from this app's MCP config.\n"
352
+ )
322
353
  }
323
- marcarAvisoDesinstalado()
324
- reportarLanzamiento('uninstalled')
325
- process.stderr.write(
326
- '[LMCP] Local MCP was uninstalled — not starting.\n' +
327
- ' Reinstall: npx local-mcp setup\n' +
328
- " Or remove the \"local-mcp\" entry from this app's MCP config.\n"
329
- )
330
- process.exit(0)
354
+ return quedarseVivoDesinstalado()
331
355
  }
332
356
  }
333
357
 
@@ -344,9 +368,9 @@ async function main() {
344
368
  writeUninstallSentinels()
345
369
  process.stderr.write(
346
370
  '[LMCP] LMCP.app was removed — treating it as an uninstall, not starting.\n' +
347
- ' Reinstall: npx local-mcp setup\n'
371
+ ' Reinstall: npx -y local-mcp@latest setup\n'
348
372
  )
349
- process.exit(0)
373
+ return quedarseVivoDesinstalado()
350
374
  }
351
375
  }
352
376
 
@@ -380,7 +404,7 @@ async function main() {
380
404
  : `✓ Local MCP v${version} — only the MCP server is set up; the menu-bar app is not installed.\n\n`)
381
405
  process.stderr.write(' • Cursor / Claude: enable the "local-mcp" MCP server in settings (they start it automatically).\n')
382
406
  if (!app) process.stderr.write(` • Menu-bar app: install it with ${menuBarAppHowToInstall()}\n`)
383
- process.stderr.write(' • You can close this terminal — do not leave `npx local-mcp` running here.\n')
407
+ process.stderr.write(' • You can close this terminal — do not leave `npx -y local-mcp@latest` running here.\n')
384
408
  if (app) process.stderr.write(' • Status: http://localhost:8765/status\n')
385
409
  process.stderr.write('\n')
386
410
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-mcp",
3
- "version": "3.0.424",
3
+ "version": "3.0.426",
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": {
@@ -25,10 +25,10 @@
25
25
  "node": ">=20"
26
26
  },
27
27
  "optionalDependencies": {
28
- "local-mcp-darwin-arm64": "3.0.424",
29
- "local-mcp-darwin-x64": "3.0.424",
30
- "local-mcp-windows-x64": "3.0.424",
31
- "local-mcp-windows-arm64": "3.0.424"
28
+ "local-mcp-darwin-arm64": "3.0.426",
29
+ "local-mcp-darwin-x64": "3.0.426",
30
+ "local-mcp-windows-x64": "3.0.426",
31
+ "local-mcp-windows-arm64": "3.0.426"
32
32
  },
33
33
  "os": [
34
34
  "darwin",
package/setup.js CHANGED
@@ -448,7 +448,7 @@ async function runSetup(opts = {}) {
448
448
  } else if (clientes.length > 0 && clientes.every(c => c.status === 'not_installed')) {
449
449
  console.log('\n No AI client detected yet — LMCP is installed and ready.')
450
450
  console.log(' Install one (Claude Desktop, Cursor, VS Code...), then run:')
451
- console.log(' npx local-mcp setup\n')
451
+ console.log(' npx -y local-mcp@latest setup\n')
452
452
  console.log(' Full setup guide: https://local-mcp.com/setup')
453
453
  }
454
454
  }
@@ -568,19 +568,14 @@ async function runSetup(opts = {}) {
568
568
  // so the tray's DaemonSupervisor doesn't race against the old server.
569
569
  _migrateCurlLaunchAgent()
570
570
 
571
- // Instalar y lanzar el tray (menu bar app) — arm64 only, non-fatal
572
- await _installTray()
571
+ // npx is server-only (owner decision): setup never downloads the tray nor loads its LaunchAgent.
572
+ // A tray that is already installed is left alone.
573
573
  // Tray permissions are a macOS-only concept (contract §3.1: Windows/Linux
574
574
  // report "not_applicable", not "unknown_until_tray_runs") — polling
575
575
  // 127.0.0.1:8765/permissions off darwin would just cost up to 10s waiting
576
576
  // on an endpoint that was never going to answer.
577
577
  const trayPermissions = _IS_MAC ? (clientsRun ? await _fetchTrayPermissions() : null) : 'not_applicable'
578
- await _installTeamsProxy()
579
- await _installSlackProxy()
580
-
581
- // Auto-launch the primary configured AI client (macOS only — win32/linux
582
- // just name the next_step) + show "Try this now" banner.
583
- await _autoLaunchClient(clientsRun)
578
+ // npx also downloads no proxies and launches no client (#112).
584
579
 
585
580
  // Anon-first cloud relay activation (replaces the interactive email prompt
586
581
  // removed 2026-04-19). When no email is set, register an anonymous tunnel
@@ -666,36 +661,6 @@ async function runSetup(opts = {}) {
666
661
  process.exitCode = clientsRun.exitCode
667
662
  }
668
663
 
669
- async function _installTeamsProxy() {
670
- try {
671
- const { ensureTeamsProxy } = require('./download')
672
- await ensureTeamsProxy()
673
- } catch (err) {
674
- process.stderr.write(` (teams-proxy not available: ${err.message})\n`)
675
- }
676
- }
677
-
678
- async function _installSlackProxy() {
679
- try {
680
- const { ensureSlackProxy } = require('./download')
681
- await ensureSlackProxy()
682
- } catch (err) {
683
- process.stderr.write(` (slack-proxy not available: ${err.message})\n`)
684
- }
685
- }
686
-
687
- async function _installTray() {
688
- if (process.platform === 'linux') return
689
- try {
690
- const { ensureTray } = require('./download')
691
- const trayApp = await ensureTray()
692
- if (!trayApp) return
693
- console.log('\n✓ Tray installed — look for the LMCP icon in your menu bar\n')
694
- } catch (err) {
695
- process.stderr.write(` (Tray not available: ${err.message})\n\n`)
696
- }
697
- }
698
-
699
664
  // Resolves what to exec to prove the installed binary launches and responds. Pulled out
700
665
  // as a pure function (platform/home/cacheDir all parameters) so it's testable without
701
666
  // being on each OS. darwin uses the Swift binary's --export-tools (unchanged, tool-count
@@ -1086,9 +1051,8 @@ function _pingInstall(clients, method, email = '', binaryVersion = '') {
1086
1051
  }
1087
1052
 
1088
1053
  // _fetchClientsCatalog fetches the served catalog (the SAME endpoint the
1089
- // go-server's RefreshFromRemote uses) so _autoLaunchClient can find a
1090
- // client's macOS .app path without ever typing a client's identity a
1091
- // second time in this file. 4s budget (#3212 §3.9): a slow/unreachable
1054
+ // go-server's RefreshFromRemote uses) for uninstall (index.js), so a client's
1055
+ // identity is never typed a second time in this file. 4s budget (#3212 §3.9): a slow/unreachable
1092
1056
  // backend must never block the rest of setup. Returns null on any failure —
1093
1057
  // callers treat that as "don't launch anything," never as an error.
1094
1058
  function _fetchClientsCatalog(totalMs = 4000) {
@@ -1107,51 +1071,6 @@ function _fetchClientsCatalog(totalMs = 4000) {
1107
1071
  })
1108
1072
  }
1109
1073
 
1110
- /**
1111
- * Auto-launch the primary configured AI client and print a "Try this now" banner —
1112
- * derived entirely from ConfigureAll's report and the served catalog (#3212 item 23):
1113
- * no client name is ever typed here. macOS actually opens the app (via the
1114
- * catalog's own .app detectPath); win32/linux only name the next_step, since
1115
- * neither platform has an "open this app" primitive LMCP can safely use.
1116
- * Non-fatal at every step — install succeeds even if the catalog fetch or
1117
- * open() fails or times out.
1118
- */
1119
- async function _autoLaunchClient(clientsRun, opts = {}) {
1120
- const platform = opts.platform || process.platform
1121
- const exec = opts.execFileSync || execFileSync
1122
- const fetchCatalog = opts.fetchCatalog || _fetchClientsCatalog
1123
-
1124
- const clientes = (clientsRun && clientsRun.report && clientsRun.report.clients) || []
1125
- // "restart"/"restart_agent_mode" are the only next_steps that name reopening
1126
- // an app; "new_session" (e.g. Claude Code, a CLI) and "open_mcp_page" have no
1127
- // app to relaunch, and the catalog lookup below naturally no-ops for them too
1128
- // (a CLI-only entry has no macOS .app detectPath to find).
1129
- const entry = clientes.find(c => c.status === 'configured' && c.next_step && c.next_step.startsWith('restart'))
1130
- if (!entry) return
1131
-
1132
- if (platform !== 'darwin') {
1133
- const verb = entry.next_step === 'restart_agent_mode'
1134
- ? `Toggle agent mode off and back on in ${entry.name}`
1135
- : `Restart ${entry.name}`
1136
- console.log(`\n✅ LMCP is ready! ${verb} to activate it.\n`)
1137
- return
1138
- }
1139
-
1140
- const catalog = await fetchCatalog()
1141
- const found = catalog && (catalog.clients || []).find(c => c.id === entry.id)
1142
- const macos = found && found.platforms && found.platforms.macos
1143
- const appPath = ((macos && macos.detectPaths) || []).find(p => p.endsWith('.app'))
1144
- if (!appPath) return
1145
-
1146
- try {
1147
- exec('open', [appPath.replace(/^~/, HOME)], { stdio: 'pipe', timeout: 5000 })
1148
- console.log(`\n✅ LMCP is ready! ${entry.name} is opening now.\n`)
1149
- console.log('Try asking: "Read my last 3 emails and summarize them"\n')
1150
- } catch {
1151
- // open failed (app not installed or already open) — non-fatal
1152
- }
1153
- }
1154
-
1155
1074
  module.exports = {
1156
1075
  runSetup, runConfigureClients, _findServerBinary, _launcherArgsForConfigureClients,
1157
1076
  _cmdExists, _runHealthCheck,
@@ -1160,5 +1079,5 @@ module.exports = {
1160
1079
  _launcherSpawnSpec, _writeLaunchScript, _writeLaunchSpec,
1161
1080
  _getMachineId, _healthCheckSpec, _localMcpConfigDir, _installRefDir,
1162
1081
  _cloudTokenPath, _readCachedCloudToken, _writeCloudToken, _registerAnonToken, _pingInstall,
1163
- _autoLaunchClient, _fetchClientsCatalog,
1082
+ _fetchClientsCatalog,
1164
1083
  }