local-mcp 3.0.140 → 3.0.141

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 +31 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-mcp",
3
- "version": "3.0.140",
3
+ "version": "3.0.141",
4
4
  "description": "LMCP — connect Claude Desktop, Cursor, Windsurf to Mail, Calendar, Contacts, Teams, OneDrive on macOS. Privacy-first: all data stays on your Mac.",
5
5
  "main": "index.js",
6
6
  "bin": {
package/setup.js CHANGED
@@ -514,35 +514,44 @@ async function runSetup(opts = {}) {
514
514
  let emailPromptResult = 'not_shown_no_tty'
515
515
  let emailPromptError = ''
516
516
  try {
517
- const ttyFd = fs.openSync('/dev/tty', 'r+')
518
- const ttyIn = require('stream').Readable.from(
519
- (function* () {
520
- const buf = Buffer.alloc(256)
521
- let line = ''
522
- while (true) {
523
- const n = fs.readSync(ttyFd, buf, 0, 1, null)
524
- if (n === 0) break
525
- const ch = buf.slice(0, n).toString()
526
- if (ch === '\n' || ch === '\r') break
527
- line += ch
528
- }
529
- yield line
530
- })()
531
- )
532
- const ttyOut = new (require('stream').Writable)({
533
- write(chunk, _enc, cb) { fs.writeSync(ttyFd, chunk); cb() },
534
- })
535
- const rl = require('readline').createInterface({ input: ttyIn, output: ttyOut, terminal: true })
517
+ let rl
518
+ let ttyFd = null
519
+
520
+ if (_IS_WIN) {
521
+ // Windows: use process.stdin directly (works in PowerShell and cmd)
522
+ rl = require('readline').createInterface({ input: process.stdin, output: process.stderr })
523
+ } else {
524
+ // macOS/Linux: open /dev/tty to read from terminal even when stdin is piped
525
+ ttyFd = fs.openSync('/dev/tty', 'r+')
526
+ const ttyIn = require('stream').Readable.from(
527
+ (function* () {
528
+ const buf = Buffer.alloc(256)
529
+ let line = ''
530
+ while (true) {
531
+ const n = fs.readSync(ttyFd, buf, 0, 1, null)
532
+ if (n === 0) break
533
+ const ch = buf.slice(0, n).toString()
534
+ if (ch === '\n' || ch === '\r') break
535
+ line += ch
536
+ }
537
+ yield line
538
+ })()
539
+ )
540
+ const ttyOut = new (require('stream').Writable)({
541
+ write(chunk, _enc, cb) { fs.writeSync(ttyFd, chunk); cb() },
542
+ })
543
+ rl = require('readline').createInterface({ input: ttyIn, output: ttyOut, terminal: true })
544
+ }
536
545
 
537
- process.stdout.write('\n 📧 Email for update notifications (optional, press Enter to skip): ')
546
+ process.stderr.write('\n Email for update notifications (optional, press Enter to skip): ')
538
547
  emailPromptResult = 'shown'
539
548
  const ans = await Promise.race([
540
549
  new Promise(res => {
541
- rl.once('line', a => { rl.close(); try { fs.closeSync(ttyFd) } catch {} ; res((a || '').trim()) })
550
+ rl.once('line', a => { rl.close(); if (ttyFd !== null) try { fs.closeSync(ttyFd) } catch {} ; res((a || '').trim()) })
542
551
  }),
543
552
  new Promise(res => setTimeout(() => {
544
553
  try { rl.close() } catch {}
545
- try { fs.closeSync(ttyFd) } catch {}
554
+ if (ttyFd !== null) try { fs.closeSync(ttyFd) } catch {}
546
555
  res('')
547
556
  }, 30000)),
548
557
  ])