@nextnext/mcp-server 0.1.1 → 0.1.2
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.
- package/dist/index.js +29 -29
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51217,8 +51217,8 @@ function generateEncryptionKey() {
|
|
|
51217
51217
|
var init_encryption = __esm(() => {
|
|
51218
51218
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
51219
51219
|
if (process.argv.includes("--generate-key")) {
|
|
51220
|
-
console.
|
|
51221
|
-
console.
|
|
51220
|
+
console.error("Generated SERVER_ENCRYPTION_KEY:");
|
|
51221
|
+
console.error(generateEncryptionKey());
|
|
51222
51222
|
}
|
|
51223
51223
|
}
|
|
51224
51224
|
});
|
|
@@ -54223,19 +54223,19 @@ function initRedis() {
|
|
|
54223
54223
|
if (url3 && token) {
|
|
54224
54224
|
redisClient = new Redis2({ url: url3, token });
|
|
54225
54225
|
useRedis = true;
|
|
54226
|
-
console.
|
|
54226
|
+
console.error("[Redis] Connected via Upstash REST API");
|
|
54227
54227
|
return true;
|
|
54228
54228
|
} else if (url3) {
|
|
54229
54229
|
try {
|
|
54230
54230
|
redisClient = Redis2.fromEnv();
|
|
54231
54231
|
useRedis = true;
|
|
54232
|
-
console.
|
|
54232
|
+
console.error("[Redis] Connected via REDIS_URL");
|
|
54233
54233
|
return true;
|
|
54234
54234
|
} catch (e7) {
|
|
54235
54235
|
console.warn("[Redis] Failed to connect, falling back to in-memory storage");
|
|
54236
54236
|
}
|
|
54237
54237
|
}
|
|
54238
|
-
console.
|
|
54238
|
+
console.error("[Redis] Not configured, using in-memory storage (data will not survive restarts)");
|
|
54239
54239
|
return false;
|
|
54240
54240
|
}
|
|
54241
54241
|
async function getIdentity(pubkey) {
|
|
@@ -54313,7 +54313,7 @@ async function markSessionInitialized(sessionId) {
|
|
|
54313
54313
|
if (useRedis && redisClient) {
|
|
54314
54314
|
try {
|
|
54315
54315
|
await redisClient.set(`${SESSION_PREFIX}${sessionId}`, state, { ex: SESSION_TTL });
|
|
54316
|
-
console.
|
|
54316
|
+
console.error(`[Redis] Session ${sessionId.slice(0, 8)} marked as initialized`);
|
|
54317
54317
|
} catch (error2) {
|
|
54318
54318
|
console.error("[Redis] Error marking session initialized:", error2);
|
|
54319
54319
|
}
|
|
@@ -54381,7 +54381,7 @@ __export(exports_context, {
|
|
|
54381
54381
|
import { AsyncLocalStorage } from "async_hooks";
|
|
54382
54382
|
function runWithSessionContext(sessionId, fn) {
|
|
54383
54383
|
const cachedIdentity = sessionIdentityCache.get(sessionId);
|
|
54384
|
-
console.
|
|
54384
|
+
console.error(`[runWithSessionContext] Session: ${sessionId.slice(0, 8)}, cached identity: ${cachedIdentity ? cachedIdentity.npub?.slice(0, 16) || "yes" : "none"}, cache size: ${sessionIdentityCache.size}`);
|
|
54385
54385
|
return sessionStorage.run({ sessionId, identity: cachedIdentity }, fn);
|
|
54386
54386
|
}
|
|
54387
54387
|
function getCurrentSessionId() {
|
|
@@ -54401,7 +54401,7 @@ async function authenticateSession(encryptedKey) {
|
|
|
54401
54401
|
let privateKeyHex;
|
|
54402
54402
|
try {
|
|
54403
54403
|
privateKeyHex = decryptNostrKey(encryptedKey);
|
|
54404
|
-
console.
|
|
54404
|
+
console.error(`[Session] Decrypted key length: ${privateKeyHex.length}, first4: ${privateKeyHex.slice(0, 4)}`);
|
|
54405
54405
|
} catch (error2) {
|
|
54406
54406
|
console.error(`[Session] Decryption failed:`, error2);
|
|
54407
54407
|
throw new Error(`Decryption failed: ${error2.message}. The key may have been created with a different server or is corrupted.`);
|
|
@@ -54413,10 +54413,10 @@ async function authenticateSession(encryptedKey) {
|
|
|
54413
54413
|
let pubkey;
|
|
54414
54414
|
let npub;
|
|
54415
54415
|
try {
|
|
54416
|
-
console.
|
|
54416
|
+
console.error(`[Session] Calling getPublicKey with hex (length=${privateKeyHex.length})`);
|
|
54417
54417
|
pubkey = getPublicKey2(privateKeyHex);
|
|
54418
54418
|
npub = nip19_exports.npubEncode(pubkey);
|
|
54419
|
-
console.
|
|
54419
|
+
console.error(`[Session] Derived pubkey: ${pubkey.slice(0, 8)}...`);
|
|
54420
54420
|
} catch (error2) {
|
|
54421
54421
|
console.error(`[Session] getPublicKey failed:`, error2);
|
|
54422
54422
|
throw new Error(`Failed to derive public key: ${error2.message}`);
|
|
@@ -54427,14 +54427,14 @@ async function authenticateSession(encryptedKey) {
|
|
|
54427
54427
|
npub
|
|
54428
54428
|
};
|
|
54429
54429
|
sessionIdentityCache.set(sessionId, identity);
|
|
54430
|
-
console.
|
|
54430
|
+
console.error(`[authenticateSession] Cached identity for session ${sessionId.slice(0, 8)}, cache size now: ${sessionIdentityCache.size}`);
|
|
54431
54431
|
const store = sessionStorage.getStore();
|
|
54432
54432
|
if (store) {
|
|
54433
54433
|
store.identity = identity;
|
|
54434
54434
|
}
|
|
54435
54435
|
const existingIdentity = await getIdentity(pubkey);
|
|
54436
54436
|
if (existingIdentity) {
|
|
54437
|
-
console.
|
|
54437
|
+
console.error(`[SessionContext] Returning user: ${npub.slice(0, 16)}... (sessions: ${existingIdentity.stats?.totalSessions || 0})`);
|
|
54438
54438
|
await recordNewSession(pubkey);
|
|
54439
54439
|
} else {
|
|
54440
54440
|
const newIdentity = {
|
|
@@ -54448,9 +54448,9 @@ async function authenticateSession(encryptedKey) {
|
|
|
54448
54448
|
}
|
|
54449
54449
|
};
|
|
54450
54450
|
await saveIdentity(pubkey, newIdentity);
|
|
54451
|
-
console.
|
|
54451
|
+
console.error(`[SessionContext] New user registered: ${npub.slice(0, 16)}...`);
|
|
54452
54452
|
}
|
|
54453
|
-
console.
|
|
54453
|
+
console.error(`[SessionContext] Session ${sessionId.slice(0, 8)}... authenticated as ${npub.slice(0, 16)}...`);
|
|
54454
54454
|
return identity;
|
|
54455
54455
|
}
|
|
54456
54456
|
function clearSessionIdentity() {
|
|
@@ -102131,7 +102131,7 @@ function getSupabaseClient() {
|
|
|
102131
102131
|
supabase = createClient2(url3, key, {
|
|
102132
102132
|
auth: { persistSession: false }
|
|
102133
102133
|
});
|
|
102134
|
-
console.
|
|
102134
|
+
console.error("[Supabase] Connected to:", url3);
|
|
102135
102135
|
return supabase;
|
|
102136
102136
|
}
|
|
102137
102137
|
function isSupabaseConfigured() {
|
|
@@ -102230,10 +102230,10 @@ async function createBurnerWallet(label, nostrPubkey) {
|
|
|
102230
102230
|
label,
|
|
102231
102231
|
nostrPubkey
|
|
102232
102232
|
});
|
|
102233
|
-
console.
|
|
102233
|
+
console.error(`[BurnerWallet] Created (Supabase): ${wallet.address} (${label || "unlabeled"}) ${nostrPubkey ? `linked to ${nostrPubkey.slice(0, 16)}...` : ""}`);
|
|
102234
102234
|
} else {
|
|
102235
102235
|
memoryWallets.set(wallet.id, wallet);
|
|
102236
|
-
console.
|
|
102236
|
+
console.error(`[BurnerWallet] Created (memory): ${wallet.address} (${label || "unlabeled"})`);
|
|
102237
102237
|
}
|
|
102238
102238
|
return wallet;
|
|
102239
102239
|
}
|
|
@@ -102415,7 +102415,7 @@ async function createPaymentAuthorization(walletId, recipientAddress, amountUsdc
|
|
|
102415
102415
|
r,
|
|
102416
102416
|
s: s3
|
|
102417
102417
|
};
|
|
102418
|
-
console.
|
|
102418
|
+
console.error(`[x402Payer] Created authorization: ${amountUsdc} USDC from ${account.address} to ${recipientAddress}`);
|
|
102419
102419
|
return {
|
|
102420
102420
|
success: true,
|
|
102421
102421
|
authorization,
|
|
@@ -102442,13 +102442,13 @@ function deriveEvmAddress(nostrPrivateKeyHex) {
|
|
|
102442
102442
|
}
|
|
102443
102443
|
function getCurrentIdentity() {
|
|
102444
102444
|
const sessionId = getCurrentSessionId();
|
|
102445
|
-
console.
|
|
102445
|
+
console.error(`[getCurrentIdentity] Session: ${sessionId?.slice(0, 8) || "none"}`);
|
|
102446
102446
|
const sessionIdentity = getSessionIdentity();
|
|
102447
102447
|
if (sessionIdentity) {
|
|
102448
|
-
console.
|
|
102448
|
+
console.error(`[getCurrentIdentity] Found identity: ${sessionIdentity.npub?.slice(0, 16) || sessionIdentity.pubkey.slice(0, 8)}`);
|
|
102449
102449
|
return { pubkey: sessionIdentity.pubkey, privateKeyHex: sessionIdentity.privateKeyHex };
|
|
102450
102450
|
}
|
|
102451
|
-
console.
|
|
102451
|
+
console.error(`[getCurrentIdentity] No session identity found`);
|
|
102452
102452
|
const privateKeyHex = process.env.NOSTR_PRIVATE_KEY_HEX;
|
|
102453
102453
|
if (privateKeyHex) {
|
|
102454
102454
|
try {
|
|
@@ -102684,7 +102684,7 @@ var identityTools = [
|
|
|
102684
102684
|
|
|
102685
102685
|
// src/tools/wallet-tools.ts
|
|
102686
102686
|
function identityRequiredResponse(toolName) {
|
|
102687
|
-
console.
|
|
102687
|
+
console.error(`[${toolName}] No identity found - session may have expired or instance restarted`);
|
|
102688
102688
|
return {
|
|
102689
102689
|
content: [{
|
|
102690
102690
|
type: "text",
|
|
@@ -102947,7 +102947,7 @@ var nostrClient = null;
|
|
|
102947
102947
|
function getNostrClient() {
|
|
102948
102948
|
if (!nostrClient) {
|
|
102949
102949
|
nostrClient = new NostrClient({ relayUrl: RELAY_URL });
|
|
102950
|
-
console.
|
|
102950
|
+
console.error(`[NostrTools] Initialized with pubkey: ${nostrClient.getPublicKey()}`);
|
|
102951
102951
|
}
|
|
102952
102952
|
return nostrClient;
|
|
102953
102953
|
}
|
|
@@ -102984,13 +102984,13 @@ var postIntentTool = {
|
|
|
102984
102984
|
const { authenticateSession: authenticateSession2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
102985
102985
|
await authenticateSession2(args.encryptedKey);
|
|
102986
102986
|
identity = getCurrentIdentity();
|
|
102987
|
-
console.
|
|
102987
|
+
console.error(`[post_intent] Auto-authenticated with provided key`);
|
|
102988
102988
|
} catch (error2) {
|
|
102989
102989
|
console.error(`[post_intent] Auto-auth failed: ${error2.message}`);
|
|
102990
102990
|
}
|
|
102991
102991
|
}
|
|
102992
102992
|
if (!identity) {
|
|
102993
|
-
console.
|
|
102993
|
+
console.error(`[post_intent] No identity found - session may have expired or instance restarted`);
|
|
102994
102994
|
return {
|
|
102995
102995
|
content: [{
|
|
102996
102996
|
type: "text",
|
|
@@ -103049,7 +103049,7 @@ var postIntentTool = {
|
|
|
103049
103049
|
};
|
|
103050
103050
|
} catch (error2) {
|
|
103051
103051
|
console.error("[postIntent] Error routing through Factory-API:", error2);
|
|
103052
|
-
console.
|
|
103052
|
+
console.error("[postIntent] Falling back to direct relay post...");
|
|
103053
103053
|
const client = getNostrClient();
|
|
103054
103054
|
const result = await client.postIntent(intent);
|
|
103055
103055
|
return {
|
|
@@ -107612,7 +107612,7 @@ class ConfigManager {
|
|
|
107612
107612
|
}
|
|
107613
107613
|
const enabledServers = config3.servers.filter((s3) => s3.enabled);
|
|
107614
107614
|
if (enabledServers.length === 0) {
|
|
107615
|
-
console.
|
|
107615
|
+
console.error("[ConfigManager] No external servers configured. Native tools will be available.");
|
|
107616
107616
|
}
|
|
107617
107617
|
}
|
|
107618
107618
|
}
|
|
@@ -109186,7 +109186,7 @@ function createLogger(logLevel, useStderrOnly = false) {
|
|
|
109186
109186
|
if (useStderrOnly) {
|
|
109187
109187
|
console.error("[INFO]", ...args);
|
|
109188
109188
|
} else {
|
|
109189
|
-
console.
|
|
109189
|
+
console.error("[INFO]", ...args);
|
|
109190
109190
|
}
|
|
109191
109191
|
}
|
|
109192
109192
|
},
|
|
@@ -109217,7 +109217,7 @@ function createLogger(logLevel, useStderrOnly = false) {
|
|
|
109217
109217
|
};
|
|
109218
109218
|
}
|
|
109219
109219
|
function showHelp() {
|
|
109220
|
-
console.
|
|
109220
|
+
console.error(`
|
|
109221
109221
|
NextNext MCP Server - Sovereign Shopping Agent
|
|
109222
109222
|
|
|
109223
109223
|
USAGE:
|