@memly/mcp-server 0.2.7 → 0.2.9

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/dist/index.js +70 -22
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -20250,8 +20250,9 @@ I am ready to continue our work.`
20250
20250
  import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync } from "node:fs";
20251
20251
  import { join, resolve } from "node:path";
20252
20252
  import { homedir, platform } from "node:os";
20253
+ import * as readline from "node:readline";
20253
20254
  var MEMLY_INSTRUCTION_BLOCK = `
20254
- ## Memly — Persistent Memory (Auto-Enabled)
20255
+ ## Memly - Persistent Memory (Auto-Enabled)
20255
20256
 
20256
20257
  You have access to the Memly MCP server (\`memly\`).
20257
20258
 
@@ -20267,8 +20268,32 @@ You have access to the Memly MCP server (\`memly\`).
20267
20268
  - User shares important project context, preferences, or constraints
20268
20269
  - User explicitly says "remember this"
20269
20270
 
20270
- 3. **Never** ask if you should remember something — just do it silently.
20271
+ 3. **Never** ask if you should remember something - just do it silently.
20271
20272
  `.trim();
20273
+ async function promptApiKey() {
20274
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
20275
+ const isTTY = process.stdin.isTTY;
20276
+ if (isTTY) {
20277
+ rl.stdoutMuted = true;
20278
+ const origWrite = rl._writeToOutput.bind(rl);
20279
+ rl._writeToOutput = (str) => {
20280
+ if (rl.stdoutMuted) {
20281
+ process.stdout.write(str.replace(/[^\r\n]/g, "*"));
20282
+ } else {
20283
+ origWrite(str);
20284
+ }
20285
+ };
20286
+ }
20287
+ return new Promise((res) => {
20288
+ rl.question(" Memly API key: ", (answer) => {
20289
+ if (isTTY)
20290
+ process.stdout.write(`
20291
+ `);
20292
+ rl.close();
20293
+ res(answer.trim());
20294
+ });
20295
+ });
20296
+ }
20272
20297
  async function validateApiKey(apiKey) {
20273
20298
  try {
20274
20299
  const controller = new AbortController;
@@ -20608,30 +20633,45 @@ async function runInit() {
20608
20633
  process.exit(1);
20609
20634
  }
20610
20635
  console.log(`
20611
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
20612
- console.log(" Memly Init — Auto-Memory Setup");
20613
- console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
20636
+ --------------------------------`);
20637
+ console.log(" Memly Init - Auto-Memory Setup");
20638
+ console.log(`--------------------------------
20614
20639
  `);
20615
- const apiKey = process.env.MEMLY_API_KEY;
20640
+ let apiKey = process.env.MEMLY_API_KEY;
20641
+ let keyWasPrompted = false;
20616
20642
  if (!apiKey) {
20617
- console.error(`Error: MEMLY_API_KEY not set.
20643
+ console.log(`No MEMLY_API_KEY found in environment.
20618
20644
  `);
20619
- console.error("Get your API key at: https://memly.site/dashboard");
20620
- console.error(`Then run: export MEMLY_API_KEY=memly_...
20645
+ console.log(` Get your key at: https://memly.site/dashboard
20621
20646
  `);
20622
- process.exit(1);
20647
+ apiKey = await promptApiKey();
20648
+ if (!apiKey) {
20649
+ console.error(`
20650
+ No API key provided. Aborting.
20651
+ `);
20652
+ process.exit(1);
20653
+ }
20654
+ process.env.MEMLY_API_KEY = apiKey;
20655
+ keyWasPrompted = true;
20623
20656
  }
20624
20657
  process.stdout.write("Validating API key... ");
20625
20658
  const valid = await validateApiKey(apiKey);
20626
20659
  if (!valid) {
20627
- console.error(`✗ Invalid
20660
+ console.log(`INVALID
20628
20661
  `);
20629
20662
  console.error(`Check your API key at: https://memly.site/dashboard
20630
20663
  `);
20631
20664
  process.exit(1);
20632
20665
  }
20633
- console.log(`✓ Valid
20666
+ console.log(`OK
20667
+ `);
20668
+ if (keyWasPrompted) {
20669
+ const isWin = process.platform === "win32";
20670
+ const persistCmd = isWin ? `$env:MEMLY_API_KEY = "${apiKey}"` : `export MEMLY_API_KEY="${apiKey}"`;
20671
+ console.log(" To persist this key, add to your shell profile:");
20672
+ console.log(` ${persistCmd}
20634
20673
  `);
20674
+ }
20635
20675
  console.log(`Project: ${projectRoot}
20636
20676
  `);
20637
20677
  console.log(`Detecting IDEs...
@@ -20663,17 +20703,25 @@ async function runInit() {
20663
20703
  const jetbrainsResult = writeJetBrains(projectRoot);
20664
20704
  if (jetbrainsResult)
20665
20705
  results.push(jetbrainsResult);
20666
- const icons = { created: "✓", updated: "✓", skipped: "⊘", failed: "✗" };
20667
- console.log(`Results:
20706
+ const statusLabel = (r) => {
20707
+ if (r.status === "created")
20708
+ return "[created]";
20709
+ if (r.status === "updated")
20710
+ return "[updated]";
20711
+ if (r.status === "skipped")
20712
+ return "[skipped]";
20713
+ return "[FAILED] ";
20714
+ };
20715
+ console.log(`
20716
+ Results:
20668
20717
  `);
20669
- console.log(" IDE Status File");
20670
- console.log(" ──────────────────────────────────────────────────────────────────");
20718
+ console.log(" IDE Status File");
20719
+ console.log(" " + "-".repeat(72));
20671
20720
  for (const r of results) {
20672
20721
  const rel = r.file.replace(projectRoot, ".").replace(homedir(), "~");
20673
- const statusLabel = r.status === "failed" ? `failed (${r.error})` : r.status;
20674
- console.log(` ${icons[r.status]} ${r.ide.padEnd(28)} ${r.status.padEnd(8)} ${rel}`);
20722
+ console.log(` ${r.ide.padEnd(30)} ${statusLabel(r).padEnd(10)} ${rel}`);
20675
20723
  if (r.status === "failed")
20676
- console.log(` └─ ${statusLabel}`);
20724
+ console.log(` Error: ${r.error}`);
20677
20725
  }
20678
20726
  if (results.length === 0) {
20679
20727
  console.log(`
@@ -20694,7 +20742,7 @@ Resolving project ID... `);
20694
20742
  if (projectId) {
20695
20743
  try {
20696
20744
  writeFileSync(join(projectRoot, ".memly-project"), JSON.stringify({ project_id: projectId }, null, 2));
20697
- console.log(`✓ ${projectId}`);
20745
+ console.log(projectId);
20698
20746
  const MARKER = `<!-- memly-project:${projectId} -->`;
20699
20747
  const ideFiles = [
20700
20748
  join(projectRoot, ".cursorrules"),
@@ -20714,11 +20762,11 @@ Resolving project ID... `);
20714
20762
  }
20715
20763
  } catch {}
20716
20764
  } else {
20717
- console.log("skipped (proxy unreachable run init again after connecting)");
20765
+ console.log("skipped (proxy unreachable - run init again after connecting)");
20718
20766
  }
20719
20767
  await reportTelemetry(results);
20720
20768
  console.log(`
20721
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
20769
+ --------------------------------
20722
20770
  `);
20723
20771
  console.log(`Setup complete. Next steps:
20724
20772
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memly/mcp-server",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Memly MCP Server — persistent memory for any IDE",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,4 +26,4 @@
26
26
  "zod": "^3.24.2"
27
27
  },
28
28
  "license": "BSL-1.1"
29
- }
29
+ }