local-mcp 3.0.428 → 3.0.429

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 (4) hide show
  1. package/README.md +3 -0
  2. package/index.js +32 -21
  3. package/package.json +5 -5
  4. package/setup.js +51 -14
package/README.md CHANGED
@@ -20,6 +20,8 @@
20
20
  | **Terminal** | `curl -fsSL 'https://local-mcp.com/install?ref=npm' \| bash` | One-line setup |
21
21
  | **npx** | `npx -y local-mcp@latest setup` | Configuring AI clients from an existing Node environment |
22
22
 
23
+ **Windows without Node.js:** `npx` is not available there. Use the Windows installer instead: [`LMCP-Setup.exe`](https://download.local-mcp.com/LMCP-Setup.exe).
24
+
23
25
  Auto-detects and configures Claude Desktop, Claude Code, Cursor, Windsurf, VS Code, and Zed. Restart your AI client once.
24
26
 
25
27
  > **Cursor users:** LMCP tools only appear in **Agent mode**. Open a new Composer window (⌘I) and make sure the mode selector shows **Agent** (not Chat or Edit). Without Agent mode, the tools are installed but invisible.
@@ -183,6 +185,7 @@ Full policy: **[local-mcp.com/en/privacy](https://local-mcp.com/en/privacy)**.
183
185
 
184
186
  ```bash
185
187
  npx -y local-mcp@latest setup # configure all detected AI clients
188
+ npx -y local-mcp@latest link # link this machine to your LMCP account (a code you approve on the web)
186
189
  npx -y local-mcp@latest update # how to update (npx -y local-mcp@latest)
187
190
  npx -y local-mcp@latest status # show server status
188
191
  ```
package/index.js CHANGED
@@ -123,7 +123,7 @@ const cmd = process.argv[2]
123
123
 
124
124
  // Comandos que este wrapper entiende. Sin argumentos arranca el server MCP por stdio, que es
125
125
  // como lo lanzan los clientes de IA — ese camino NO cambia.
126
- const COMANDOS = ['setup', 'update', 'uninstall', 'status']
126
+ const COMANDOS = ['setup', 'link', 'update', 'uninstall', 'status']
127
127
  const PEDIDOS_DE_AYUDA = ['--help', '-h', 'help']
128
128
 
129
129
  // Evento de lanzamiento (launch-event.js, #11): cada lanzamiento del camino del server reporta
@@ -201,15 +201,18 @@ const SINONIMOS_DEL_SERVER = ['stdio']
201
201
  function mostrarAyuda() {
202
202
  console.log(`local-mcp — Local MCP Server
203
203
 
204
- Uso:
205
- local-mcp arranca el server MCP por stdio (lo que hace un cliente de IA)
206
- local-mcp stdio lo mismo, dicho explícitamente
207
- local-mcp setup instala y configura
208
- local-mcp status muestra el estado
209
- local-mcp update cómo actualizar (npx -y local-mcp@latest)
210
- local-mcp uninstall desinstala
211
-
212
- local-mcp --help esta ayuda`)
204
+ Usage:
205
+ local-mcp start the MCP server over stdio (what an AI app does)
206
+ local-mcp stdio the same, said explicitly
207
+ local-mcp setup install and configure your AI apps
208
+ local-mcp link link this computer to your LMCP account (a code)
209
+ local-mcp link --approve approve a pending link on this computer
210
+ local-mcp link --deny decline a pending link on this computer
211
+ local-mcp status show the status
212
+ local-mcp update how to update (npx -y local-mcp@latest)
213
+ local-mcp uninstall uninstall
214
+
215
+ local-mcp --help this help`)
213
216
  }
214
217
 
215
218
  async function main() {
@@ -231,7 +234,7 @@ async function main() {
231
234
  const pedidoDeAyuda = PEDIDOS_DE_AYUDA.includes(cmd)
232
235
  mostrarAyuda()
233
236
  if (!pedidoDeAyuda) {
234
- console.error(`\nNo conozco el comando "${cmd}".`)
237
+ console.error(`\nUnknown command "${cmd}".`)
235
238
  reportarLanzamiento('rejected-argument')
236
239
  }
237
240
  process.exit(pedidoDeAyuda ? 0 : 2)
@@ -246,11 +249,18 @@ async function main() {
246
249
  process.exit(process.platform === 'linux' ? 1 : 0)
247
250
  }
248
251
 
252
+ // #125: vuelve a mostrar el link y el código de la máquina y espera la aprobación (~2 min).
253
+ // Sale 0 como `status`: el estado está escrito en la salida, y un agente lo lee de ahí.
254
+ if (cmd === 'link') {
255
+ await require('./link').runLinkCommand(process.argv.slice(3))
256
+ return
257
+ }
258
+
249
259
  // 3.0.423: el server viene dentro del paquete; no hay runtime en cache que borrar (ese directorio
250
260
  // guarda el id de la máquina y el token del relay, que no son del server de npm).
251
261
  if (cmd === 'update') {
252
- console.log('El server de LMCP viene con el paquete de npm. Para la última versión: npx -y local-mcp@latest')
253
- console.log('Con la app de LMCP instalada, la app se actualiza sola.')
262
+ console.log('The LMCP server ships inside the npm package. For the latest version: npx -y local-mcp@latest')
263
+ console.log('With the LMCP app installed, the app updates itself.')
254
264
  return
255
265
  }
256
266
 
@@ -293,23 +303,23 @@ async function main() {
293
303
  ? JSON.parse(fs.readFileSync(catalogFile, 'utf8'))
294
304
  : await require('./setup')._fetchClientsCatalog()
295
305
  if (!catalog) {
296
- console.log('No se pudo leer el catálogo de clientes: las entradas "local-mcp" de tus clientes de IA quedan; quitalas a mano.')
306
+ console.log('Could not read the AI app catalog: the "local-mcp" entries in your AI apps stay; remove them by hand.')
297
307
  } else {
298
308
  const r = unconfigureClients(catalog)
299
- for (const x of r.removed) console.log(`Entrada local-mcp eliminada de ${x.client}: ${x.file}`)
300
- for (const x of r.left) console.log(`Dejada en ${x.client}${x.file ? ' (' + x.file + ')' : ''}: ${x.reason}; quitá "local-mcp" a mano.`)
309
+ for (const x of r.removed) console.log(`Removed the local-mcp entry from ${x.client}: ${x.file}`)
310
+ for (const x of r.left) console.log(`Left in ${x.client}${x.file ? ' (' + x.file + ')' : ''}: ${x.reason}; remove "local-mcp" by hand.`)
301
311
  }
302
312
  } catch (e) {
303
- console.log('No se pudieron quitar las entradas de los clientes de IA: ' + e.message)
313
+ console.log('Could not remove the entries from your AI apps: ' + e.message)
304
314
  }
305
315
 
306
316
  if (fs.existsSync(CACHE_DIR)) {
307
317
  fs.rmSync(CACHE_DIR, { recursive: true, force: true })
308
- console.log(`Runtime eliminado de ${CACHE_DIR}`)
318
+ console.log(`Removed the runtime from ${CACHE_DIR}`)
309
319
  } else {
310
- console.log('No hay runtime en cache.')
320
+ console.log('No cached runtime.')
311
321
  }
312
- console.log('Local MCP desinstalado correctamente.')
322
+ console.log('Local MCP uninstalled.')
313
323
  return
314
324
  }
315
325
 
@@ -324,7 +334,8 @@ async function main() {
324
334
  console.log(`LMCP v${s.version} — ${s.server}`)
325
335
  } catch { console.log(data) }
326
336
  })
327
- }).on('error', () => console.log('Servidor no disponible en localhost:8765'))
337
+ // #124 (7): without the LMCP app nothing listens on 8765, and that is the npx mode, not a failure.
338
+ }).on('error', () => console.log(`LMCP v${require('./package.json').version} — no background service: the server is started by your AI app when it needs it (npx -y local-mcp@latest).`))
328
339
  return
329
340
  }
330
341
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-mcp",
3
- "version": "3.0.428",
3
+ "version": "3.0.429",
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.428",
29
- "local-mcp-darwin-x64": "3.0.428",
30
- "local-mcp-windows-x64": "3.0.428",
31
- "local-mcp-windows-arm64": "3.0.428"
28
+ "local-mcp-darwin-arm64": "3.0.429",
29
+ "local-mcp-darwin-x64": "3.0.429",
30
+ "local-mcp-windows-x64": "3.0.429",
31
+ "local-mcp-windows-arm64": "3.0.429"
32
32
  },
33
33
  "os": [
34
34
  "darwin",
package/setup.js CHANGED
@@ -13,6 +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 } = require('./link')
16
17
 
17
18
  const HOME = os.homedir()
18
19
  const NPX_COMMAND = 'npx'
@@ -25,11 +26,19 @@ const NPX_ARGS = ['-y', 'local-mcp@latest']
25
26
  function _resolveNpxPath() {
26
27
  try {
27
28
  const candidate = path.join(path.dirname(process.execPath), 'npx')
28
- if (fs.existsSync(candidate)) return candidate
29
+ if (fs.existsSync(candidate)) return _stableNpxPath(candidate)
29
30
  } catch {}
30
31
  return NPX_COMMAND
31
32
  }
32
33
 
34
+ // #124 (4): Homebrew's process.execPath is the versioned Cellar path; the next `brew upgrade node@22`
35
+ // deletes it and every configured client breaks. opt/<formula> is Homebrew's stable link to it.
36
+ function _stableNpxPath(p, exists = fs.existsSync) {
37
+ const m = /^(.*)\/Cellar\/([^/]+)\/[^/]+\/bin\/([^/]+)$/.exec(p)
38
+ const opt = m && `${m[1]}/opt/${m[2]}/bin/${m[3]}`
39
+ return opt && exists(opt) ? opt : p
40
+ }
41
+
33
42
  // Write a shell launcher script that wraps npx with a Node version check and
34
43
  // curl-based telemetry. This gives us visibility into failures that happen
35
44
  // BEFORE Node loads our code (e.g. old nvm default in Claude Desktop's PATH).
@@ -49,7 +58,9 @@ function _writeLaunchScript(npxAbsPath, cacheDir, isWin = _IS_WIN) {
49
58
  // appended a SECOND copy of whatever the MCP host passed, so a client
50
59
  // configured with args ended up running `npx -y local-mcp@latest -y
51
60
  // local-mcp@latest` (#1394 §C).
52
- const script = `@echo off\r\n"${npxAbsPath}" -y local-mcp@latest\r\n`
61
+ // #124 (4): winget's Node lives in a versioned folder; if it is gone, the npx on PATH. goto, not
62
+ // an if (...) block: a path with parentheses (Program Files (x86)) would close the block.
63
+ const script = `@echo off\r\nif not exist "${npxAbsPath}" goto path_npx\r\n"${npxAbsPath}" -y local-mcp@latest\r\nexit /b %errorlevel%\r\n:path_npx\r\nnpx -y local-mcp@latest\r\n`
53
64
  fs.writeFileSync(cmdPath, script)
54
65
  return cmdPath
55
66
  } catch {
@@ -73,7 +84,10 @@ function _writeLaunchScript(npxAbsPath, cacheDir, isWin = _IS_WIN) {
73
84
  ' printf \'LMCP requires Node 16+. Current: %s\\nFix: nvm alias default 22 && nvm uninstall %s — then restart Claude Desktop.\\n\' "$NODE_VER" "$NODE_VER" >&2',
74
85
  ' exit 1',
75
86
  'fi',
76
- `exec "${npxAbsPath}" -y local-mcp@latest "$@"`,
87
+ // #124 (4): the path written here can disappear (a Node upgrade); then the npx on PATH.
88
+ `NPX="${npxAbsPath}"`,
89
+ '[ -x "$NPX" ] || NPX="$(command -v npx || echo npx)"',
90
+ 'exec "$NPX" -y local-mcp@latest "$@"',
77
91
  ].join('\n') + '\n'
78
92
  fs.writeFileSync(launcherPath, script, { mode: 0o755 })
79
93
  return launcherPath
@@ -416,6 +430,7 @@ async function runSetup(opts = {}) {
416
430
  const configured = []
417
431
  const failed = []
418
432
  let clientsRun = null // #3212: en la Mac, el reporte del binario
433
+ let clientes = []
419
434
  // #3212 — Windows now shares the exact darwin path: the go-server binary
420
435
  // decides and writes (lmcp-server --configure-clients --json), never a
421
436
  // second JS-side client list. Linux has no runtime-native writer yet
@@ -423,7 +438,7 @@ async function runSetup(opts = {}) {
423
438
  if (process.platform === 'darwin' || _IS_WIN) {
424
439
  const launcher = _launcherArgsForConfigureClients(process.platform, stableCommand, stableArgs)
425
440
  clientsRun = runConfigureClients(_findServerBinary(_embeddedServer || _bundled, CACHE_DIR), launcher.command, launcher.args)
426
- const clientes = (clientsRun.report && clientsRun.report.clients) || []
441
+ clientes = (clientsRun.report && clientsRun.report.clients) || []
427
442
  _trackSetupStep('detect', clientsRun.runtime === 'ok' ? 'ok' : clientsRun.runtime, '', {
428
443
  clientsFound: clientes.filter(c => c.status !== 'not_installed').map(c => c.id),
429
444
  clientsNotFound: clientes.filter(c => c.status === 'not_installed').map(c => c.id),
@@ -444,7 +459,7 @@ async function runSetup(opts = {}) {
444
459
  }
445
460
  }
446
461
  if (clientsRun.runtime !== 'ok') {
447
- console.error(`⚠ AI apps not configured yet (${clientsRun.runtime}) — open LMCP from the system tray and use Connect.`)
462
+ console.error(`⚠ AI apps not configured yet (${clientsRun.runtime}) — run 'npx -y local-mcp@latest setup' again, or see https://local-mcp.com/setup`)
448
463
  } else if (clientes.length > 0 && clientes.every(c => c.status === 'not_installed')) {
449
464
  console.log('\n No AI client detected yet — LMCP is installed and ready.')
450
465
  console.log(' Install one (Claude Desktop, Cursor, VS Code...), then run:')
@@ -460,11 +475,20 @@ async function runSetup(opts = {}) {
460
475
  // signing in on the web (My LMCP); the machine links by download token or device code.
461
476
 
462
477
  // Health check — verify binary works before showing success
463
- const healthOk = _runHealthCheck()
478
+ const healthOk = _runHealthCheck(_findServerBinary(_embeddedServer || _bundled, CACHE_DIR))
464
479
  _trackSetupStep('binary_health', healthOk ? 'ok' : 'failed', '', {})
465
480
 
481
+ // #125 (decisión «A»): the machine links to the person's account with a code, printed for them and
482
+ // for the agent running the setup; it waits up to ~2 min for the approval on the web.
483
+ const accountLink = await runLink({
484
+ bin: _findServerBinary(_embeddedServer || _bundled, CACHE_DIR),
485
+ track: (status, error) => _trackSetupStep('account_link', status, '', error ? { error } : {}),
486
+ })
487
+
466
488
  // setup_complete summary
467
- _trackSetupStep('setup_complete', configured.length > 0 ? 'ok' : 'failed', '', {
489
+ const fin = _setupCompleteStatus(clientsRun, clientes)
490
+ _trackSetupStep('setup_complete', fin.status, '', {
491
+ error: fin.error,
468
492
  clientsFound: configured,
469
493
  clientsNotFound: failed.map(f => f.name || f),
470
494
  })
@@ -592,8 +616,8 @@ async function runSetup(opts = {}) {
592
616
  }
593
617
  } catch { /* non-fatal */ }
594
618
 
595
- // #120: the account is created or signed in on the web; nothing here takes an email.
596
- console.log('\n \x1b[1mYour LMCP account:\x1b[0m sign in or create it in My LMCP — https://www.local-mcp.com/my-installs')
619
+ // #120: the account is created or signed in on the web; nothing here takes an email. #125: the
620
+ // machine's link to it was printed above (runLink).
597
621
  }
598
622
 
599
623
  // LMCP_METHOD lets install.sh pass 'curl' so we can distinguish it from
@@ -612,6 +636,8 @@ async function runSetup(opts = {}) {
612
636
  catalog: rep.catalog || null,
613
637
  clients: rep.clients || [],
614
638
  permissions: trayPermissions || 'unknown_until_tray_runs',
639
+ // #125: what the agent hands to the person (the code is theirs to type; never telemetry).
640
+ account_link: accountLink,
615
641
  }
616
642
  process.stdout.write(JSON.stringify(out) + '\n')
617
643
  }
@@ -626,7 +652,9 @@ async function runSetup(opts = {}) {
626
652
  // too, which would have fallen through to stdio mode and hung until the timeout (#1390
627
653
  // finding 3), on top of checking a path+name (local-mcp-server, no .exe) the go-server
628
654
  // binary never has.
629
- function _healthCheckSpec(platform = process.platform, home = HOME, cacheDir = download.CACHE_DIR) {
655
+ function _healthCheckSpec(platform = process.platform, home = HOME, cacheDir = download.CACHE_DIR, found = null) {
656
+ // #124 (2): the binary setup found (bundled in npm since 3.0.423); the paths below are the fallback.
657
+ if (found) return { binPath: found, args: platform === 'darwin' ? ['--export-tools'] : ['--version'] }
630
658
  if (platform === 'darwin') {
631
659
  return { binPath: path.join(home, '.local', 'share', 'local-mcp', 'bin', 'local-mcp-server'), args: ['--export-tools'] }
632
660
  }
@@ -634,9 +662,18 @@ function _healthCheckSpec(platform = process.platform, home = HOME, cacheDir = d
634
662
  return { binPath: path.join(cacheDir, binName), args: ['--version'] }
635
663
  }
636
664
 
637
- function _runHealthCheck() {
665
+ // #124 (3): a client already configured by an earlier install is set up, not a failure; a failure
666
+ // says why in `error` (Windows reported failed with setup exiting 0).
667
+ function _setupCompleteStatus(clientsRun, clientes) {
668
+ if (clientes.some(c => c.status === 'configured' || c.status === 'already')) return { status: 'ok' }
669
+ if (!clientsRun || clientsRun.runtime !== 'ok') return { status: 'failed', error: 'runtime_' + ((clientsRun && clientsRun.runtime) || 'none') }
670
+ if (clientes.every(c => c.status === 'not_installed')) return { status: 'failed', error: 'no_client_detected' }
671
+ return { status: 'failed', error: 'clients_failed' }
672
+ }
673
+
674
+ function _runHealthCheck(found) {
638
675
  try {
639
- const { binPath, args } = _healthCheckSpec()
676
+ const { binPath, args } = _healthCheckSpec(process.platform, HOME, download.CACHE_DIR, found)
640
677
  if (!fs.existsSync(binPath)) return false
641
678
  const result = execFileSync(binPath, args, {
642
679
  timeout: 10000,
@@ -986,11 +1023,11 @@ function _fetchClientsCatalog(totalMs = 4000) {
986
1023
 
987
1024
  module.exports = {
988
1025
  runSetup, runConfigureClients, _findServerBinary, _launcherArgsForConfigureClients,
989
- _cmdExists, _runHealthCheck,
1026
+ _cmdExists, _runHealthCheck, _setupCompleteStatus, _stableNpxPath,
990
1027
  CLIENTS_REPORT_SCHEMA,
991
1028
  _notSupportedOnPlatformResult,
992
1029
  _launcherSpawnSpec, _writeLaunchScript, _writeLaunchSpec,
993
1030
  _getMachineId, _healthCheckSpec, _localMcpConfigDir, _installRefDir,
994
1031
  _cloudTokenPath, _readCachedCloudToken, _writeCloudToken, _registerAnonToken, _pingInstall,
995
- _fetchClientsCatalog,
1032
+ _fetchClientsCatalog, _trackSetupStep,
996
1033
  }