@nextnext/mcp-server 0.1.2 → 0.1.5

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 +46 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51168,15 +51168,49 @@ var require_main3 = __commonJS((exports) => {
51168
51168
 
51169
51169
  // src/crypto/encryption.ts
51170
51170
  import { createCipheriv, createDecipheriv, randomBytes as randomBytes5 } from "crypto";
51171
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
51172
+ import { homedir } from "os";
51173
+ import { join as join3 } from "path";
51174
+ function getOrCreateLocalKey() {
51175
+ if (existsSync(LOCAL_KEY_FILE)) {
51176
+ try {
51177
+ const keyHex2 = readFileSync(LOCAL_KEY_FILE, "utf-8").trim();
51178
+ if (keyHex2.length === 64) {
51179
+ console.error("[Encryption] Using local key from ~/.nextnext/encryption.key");
51180
+ return Buffer.from(keyHex2, "hex");
51181
+ }
51182
+ } catch (error2) {
51183
+ console.error("[Encryption] Error reading local key, generating new one");
51184
+ }
51185
+ }
51186
+ const newKey = randomBytes5(32);
51187
+ const keyHex = newKey.toString("hex");
51188
+ try {
51189
+ if (!existsSync(LOCAL_KEY_DIR)) {
51190
+ mkdirSync(LOCAL_KEY_DIR, { recursive: true, mode: 448 });
51191
+ }
51192
+ writeFileSync(LOCAL_KEY_FILE, keyHex, { mode: 384 });
51193
+ console.error("[Encryption] Generated and saved local key to ~/.nextnext/encryption.key");
51194
+ } catch (error2) {
51195
+ console.error("[Encryption] Could not save local key, using session-only key");
51196
+ }
51197
+ return newKey;
51198
+ }
51171
51199
  function getEncryptionKey() {
51172
- const key = process.env.SERVER_ENCRYPTION_KEY;
51173
- if (!key) {
51174
- throw new Error("SERVER_ENCRYPTION_KEY environment variable not set");
51200
+ if (cachedEncryptionKey) {
51201
+ return cachedEncryptionKey;
51175
51202
  }
51176
- if (key.length !== 64) {
51177
- throw new Error("SERVER_ENCRYPTION_KEY must be 64 hex characters (32 bytes)");
51203
+ const envKey = process.env.SERVER_ENCRYPTION_KEY;
51204
+ if (envKey) {
51205
+ if (envKey.length !== 64) {
51206
+ throw new Error("SERVER_ENCRYPTION_KEY must be 64 hex characters (32 bytes)");
51207
+ }
51208
+ cachedEncryptionKey = Buffer.from(envKey, "hex");
51209
+ console.error("[Encryption] Using SERVER_ENCRYPTION_KEY from environment");
51210
+ return cachedEncryptionKey;
51178
51211
  }
51179
- return Buffer.from(key, "hex");
51212
+ cachedEncryptionKey = getOrCreateLocalKey();
51213
+ return cachedEncryptionKey;
51180
51214
  }
51181
51215
  function encryptNostrKey(privateKey) {
51182
51216
  const key = getEncryptionKey();
@@ -51214,7 +51248,10 @@ function isEncryptedNostrKey(value) {
51214
51248
  function generateEncryptionKey() {
51215
51249
  return randomBytes5(32).toString("hex");
51216
51250
  }
51251
+ var cachedEncryptionKey = null, LOCAL_KEY_DIR, LOCAL_KEY_FILE;
51217
51252
  var init_encryption = __esm(() => {
51253
+ LOCAL_KEY_DIR = join3(homedir(), ".nextnext");
51254
+ LOCAL_KEY_FILE = join3(LOCAL_KEY_DIR, "encryption.key");
51218
51255
  if (import.meta.url === `file://${process.argv[1]}`) {
51219
51256
  if (process.argv.includes("--generate-key")) {
51220
51257
  console.error("Generated SERVER_ENCRYPTION_KEY:");
@@ -102941,7 +102978,7 @@ var walletTools = [
102941
102978
  ];
102942
102979
 
102943
102980
  // src/tools/index.ts
102944
- var RELAY_URL = process.env.NOSTR_RELAY_URL || "ws://localhost:8008";
102981
+ var RELAY_URL = process.env.NOSTR_RELAY_URL || "wss://relay.nextnext.dev";
102945
102982
  var FACTORY_API_URL = process.env.FACTORY_API_URL || "https://factory-api-842534750338.us-central1.run.app";
102946
102983
  var nostrClient = null;
102947
102984
  function getNostrClient() {
@@ -103409,7 +103446,7 @@ class GatewayServer {
103409
103446
  }
103410
103447
 
103411
103448
  // src/config/manager.ts
103412
- import { readFileSync } from "fs";
103449
+ import { readFileSync as readFileSync2 } from "fs";
103413
103450
 
103414
103451
  // ../../node_modules/yaml/dist/index.js
103415
103452
  var composer = require_composer();
@@ -107524,7 +107561,7 @@ class ConfigManager {
107524
107561
  config = null;
107525
107562
  loadFromFile(filePath) {
107526
107563
  try {
107527
- const fileContent = readFileSync(filePath, "utf-8");
107564
+ const fileContent = readFileSync2(filePath, "utf-8");
107528
107565
  const processedContent = this.substituteEnvVars(fileContent);
107529
107566
  let rawConfig;
107530
107567
  if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextnext/mcp-server",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "description": "NextNext MCP Server - A sovereign shopping agent with crypto wallet integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",