mcp-chat-connect 1.3.0 → 1.3.3
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/index.js +16 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -67,12 +67,22 @@ async function apiCall(tool, args, token) {
|
|
|
67
67
|
|
|
68
68
|
// ─── Version check ──────────────────────────────────────────────────────────
|
|
69
69
|
|
|
70
|
+
function isNewerVersion(latest, current) {
|
|
71
|
+
const l = latest.split('.').map(Number);
|
|
72
|
+
const c = current.split('.').map(Number);
|
|
73
|
+
for (let i = 0; i < 3; i++) {
|
|
74
|
+
if ((l[i] || 0) > (c[i] || 0)) return true;
|
|
75
|
+
if ((l[i] || 0) < (c[i] || 0)) return false;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
70
80
|
async function checkForUpdate() {
|
|
71
81
|
try {
|
|
72
82
|
const response = await fetch(`${MCP_CHAT_URL}/api/version`);
|
|
73
83
|
if (!response.ok) return null;
|
|
74
84
|
const { latest } = await response.json();
|
|
75
|
-
if (latest && latest
|
|
85
|
+
if (latest && isNewerVersion(latest, LOCAL_VERSION)) {
|
|
76
86
|
return `UPDATE AVAILABLE: You are running mcp-chat-connect v${LOCAL_VERSION}, but v${latest} is available. Run: npm install -g mcp-chat-connect`;
|
|
77
87
|
}
|
|
78
88
|
} catch {}
|
|
@@ -362,6 +372,7 @@ function getTools() {
|
|
|
362
372
|
type: 'object',
|
|
363
373
|
properties: {
|
|
364
374
|
channel_id: { type: 'number', description: 'Channel ID to join' },
|
|
375
|
+
label: { type: 'string', description: 'Custom session label (e.g. "QA Agent", "Security Checker"). Defaults to sequential "Session N".' },
|
|
365
376
|
},
|
|
366
377
|
required: ['channel_id'],
|
|
367
378
|
},
|
|
@@ -490,14 +501,15 @@ async function handleToolCall(name, args) {
|
|
|
490
501
|
connected: true,
|
|
491
502
|
};
|
|
492
503
|
|
|
493
|
-
// Register session to get sequential
|
|
494
|
-
let sessionLabel = 'Session';
|
|
504
|
+
// Register session to get label (custom or sequential)
|
|
505
|
+
let sessionLabel = args.label || 'Session';
|
|
495
506
|
try {
|
|
496
507
|
const regResult = await apiCall('register_session', {
|
|
497
508
|
channel_id: channelId,
|
|
498
509
|
session_token: sessionToken,
|
|
510
|
+
label: args.label || undefined,
|
|
499
511
|
}, sessionState.token);
|
|
500
|
-
sessionLabel = regResult.label ||
|
|
512
|
+
sessionLabel = regResult.label || sessionLabel;
|
|
501
513
|
sessionState.sessionLabel = sessionLabel;
|
|
502
514
|
} catch {}
|
|
503
515
|
|
package/package.json
CHANGED