local-mcp 1.3.0 → 1.4.0

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 (2) hide show
  1. package/package.json +1 -1
  2. package/setup.js +35 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-mcp",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "MCP server for macOS — connect Claude Desktop, Cursor, Windsurf to Mail, Calendar, Contacts, Teams, OneDrive. Privacy-first: all data stays on your Mac.",
5
5
  "main": "index.js",
6
6
  "bin": {
package/setup.js CHANGED
@@ -16,6 +16,7 @@ const { execSync, execFileSync } = require('child_process')
16
16
  const HOME = os.homedir()
17
17
  const NPX_COMMAND = 'npx'
18
18
  const NPX_ARGS = ['-y', 'local-mcp@latest']
19
+ const STABLE_LINK = path.join(os.homedir(), '.local', 'share', 'local-mcp', 'bin', 'local-mcp-server')
19
20
 
20
21
  // ── Rutas de config de cada cliente ──────────────────────────────────────────
21
22
 
@@ -79,24 +80,23 @@ function _writeJson(filePath, data) {
79
80
 
80
81
  // ── Inyectar config MCP en un cliente estándar ────────────────────────────────
81
82
 
82
- function injectMcpConfig(client) {
83
+ function injectMcpConfig(client, command = NPX_COMMAND, args = NPX_ARGS) {
83
84
  const cfg = _readJson(client.cfgPath)
84
85
 
85
86
  if (client.zed) {
86
87
  // Zed usa { "context_servers": { "local-mcp": { "command": {...} } } }
87
88
  cfg.context_servers = cfg.context_servers || {}
88
89
  cfg.context_servers['local-mcp'] = {
89
- command: { path: NPX_COMMAND, args: NPX_ARGS },
90
+ command: { path: command, args: args ?? [] },
90
91
  }
91
92
  } else {
92
- // Formato estándar MCP: { "mcpServers": { "local-mcp": { "command": "npx", "args": [...] } } }
93
+ // Formato estándar MCP: { "mcpServers": { "local-mcp": { "command": "...", "args": [...] } } }
93
94
  cfg.mcpServers = cfg.mcpServers || {}
94
95
  // Limpiar entradas legacy
95
96
  delete cfg.mcpServers['office-mcp']
96
- cfg.mcpServers['local-mcp'] = {
97
- command: NPX_COMMAND,
98
- args: NPX_ARGS,
99
- }
97
+ const entry = { command }
98
+ if (args !== undefined) entry.args = args
99
+ cfg.mcpServers['local-mcp'] = entry
100
100
  }
101
101
 
102
102
  _writeJson(client.cfgPath, cfg)
@@ -112,6 +112,29 @@ async function runSetup(opts = {}) {
112
112
  console.log('║ Local MCP — Setup Wizard ║')
113
113
  console.log('╚══════════════════════════════════════╝\n')
114
114
 
115
+ // Descargar el binario ahora para poder escribir el stable link en la config
116
+ // Esto elimina el 2do reinicio que de otro modo sería necesario para migrar npx → binario
117
+ let stableCommand = NPX_COMMAND
118
+ let stableArgs = NPX_ARGS
119
+ try {
120
+ const { ensureBinary, CACHE_DIR } = require('./download')
121
+ process.stderr.write('Downloading Local MCP runtime...\n')
122
+ const { binPath } = await ensureBinary()
123
+ // Crear stable symlink
124
+ const stableLink = path.join(CACHE_DIR, 'local-mcp-server')
125
+ try {
126
+ if (fs.existsSync(stableLink)) fs.unlinkSync(stableLink)
127
+ fs.symlinkSync(binPath, stableLink)
128
+ } catch { /* no crítico — fallback a npx */ }
129
+ if (fs.existsSync(stableLink)) {
130
+ stableCommand = stableLink
131
+ stableArgs = undefined
132
+ process.stderr.write('✓ Runtime ready\n\n')
133
+ }
134
+ } catch (err) {
135
+ process.stderr.write(` (Runtime download failed, will download on first run: ${err.message})\n\n`)
136
+ }
137
+
115
138
  // Detectar clientes
116
139
  const detected = CLIENTS.filter(c => c.detect())
117
140
 
@@ -119,7 +142,10 @@ async function runSetup(opts = {}) {
119
142
  console.log('No AI clients detected.')
120
143
  console.log('Install Claude Desktop, Cursor, Windsurf, or VS Code and run this command again.\n')
121
144
  console.log('Or add this manually to your AI client config:')
122
- console.log(JSON.stringify({ mcpServers: { 'local-mcp': { command: NPX_COMMAND, args: NPX_ARGS } } }, null, 2))
145
+ const manualEntry = stableArgs !== undefined
146
+ ? { command: stableCommand, args: stableArgs }
147
+ : { command: stableCommand }
148
+ console.log(JSON.stringify({ mcpServers: { 'local-mcp': manualEntry } }, null, 2))
123
149
  return
124
150
  }
125
151
 
@@ -130,7 +156,7 @@ async function runSetup(opts = {}) {
130
156
 
131
157
  for (const client of detected) {
132
158
  try {
133
- injectMcpConfig(client)
159
+ injectMcpConfig(client, stableCommand, stableArgs)
134
160
  configured.push(client.name)
135
161
  console.log(`✓ ${client.name} configured`)
136
162
  } catch (err) {