@memly/mcp-server 0.2.7 → 0.2.8

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 +45 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -20250,6 +20250,7 @@ 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
20255
  ## Memly — Persistent Memory (Auto-Enabled)
20255
20256
 
@@ -20269,6 +20270,30 @@ You have access to the Memly MCP server (\`memly\`).
20269
20270
 
20270
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;
@@ -20612,14 +20637,22 @@ async function runInit() {
20612
20637
  console.log(" Memly Init — Auto-Memory Setup");
20613
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);
@@ -20632,6 +20665,13 @@ async function runInit() {
20632
20665
  }
20633
20666
  console.log(`✓ Valid
20634
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}
20673
+ `);
20674
+ }
20635
20675
  console.log(`Project: ${projectRoot}
20636
20676
  `);
20637
20677
  console.log(`Detecting IDEs...
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.8",
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
+ }