mcp-chat-connect 1.1.5 → 1.1.7

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/index.js +33 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -11,7 +11,15 @@ const WebSocket = require('ws');
11
11
  const CONFIG_DIR = path.join(require('os').homedir(), '.mcp-chat');
12
12
  const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
13
13
 
14
- const MCP_CHAT_URL = process.env.MCP_CHAT_URL || 'https://mcpchat.dovito.com';
14
+ const MCP_CHAT_URL = process.env.MCP_CHAT_URL;
15
+ if (!MCP_CHAT_URL) {
16
+ process.stderr.write('FATAL: MCP_CHAT_URL environment variable is required.\n');
17
+ process.stderr.write('Set it when adding the MCP server, e.g.:\n');
18
+ process.stderr.write(' claude mcp add -e MCP_CHAT_URL=https://your-domain.com -s user mcp-chat $(which mcp-chat-connect)\n');
19
+ process.exit(1);
20
+ }
21
+
22
+ const LOCAL_VERSION = require('./package.json').version;
15
23
 
16
24
  // ─── Helpers ─────────────────────────────────────────────────────────────────
17
25
 
@@ -57,6 +65,20 @@ async function apiCall(tool, args, token) {
57
65
  return response.json();
58
66
  }
59
67
 
68
+ // ─── Version check ──────────────────────────────────────────────────────────
69
+
70
+ async function checkForUpdate() {
71
+ try {
72
+ const response = await fetch(`${MCP_CHAT_URL}/api/version`);
73
+ if (!response.ok) return null;
74
+ const { latest } = await response.json();
75
+ if (latest && latest !== LOCAL_VERSION) {
76
+ 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
+ }
78
+ } catch {}
79
+ return null;
80
+ }
81
+
60
82
  // ─── Channel notification (push messages into Claude's context) ──────────────
61
83
 
62
84
  function sendNotification(method, params) {
@@ -79,6 +101,8 @@ let wsReconnectTimeout = null;
79
101
  function connectWebSocket() {
80
102
  if (!sessionState.connected || !sessionState.token || !sessionState.channelId) return;
81
103
 
104
+ // Note: JWT is passed as a query parameter because WebSocket does not support custom headers.
105
+ // Be aware this token may appear in server/proxy access logs.
82
106
  const wsUrl = `${MCP_CHAT_URL.replace('https://', 'wss://').replace('http://', 'ws://')}/ws?token=${sessionState.token}&channel=${sessionState.channelId}&session=${sessionState.sessionToken}`;
83
107
 
84
108
  if (wsConnection) {
@@ -326,7 +350,14 @@ async function handleToolCall(name, args) {
326
350
  // Start WebSocket listener for real-time push
327
351
  connectWebSocket();
328
352
 
329
- return { content: [{ type: 'text', text: `Connected to #${result.channelName} as ${result.userName}. Live messages will now be pushed into this session. You can also use mcp_chat_send to send messages and mcp_chat_read to fetch history.` }] };
353
+ // Check for package updates
354
+ const updateNotice = await checkForUpdate();
355
+ let responseText = `Connected to #${result.channelName} as ${result.userName}. Live messages will now be pushed into this session. You can also use mcp_chat_send to send messages and mcp_chat_read to fetch history.`;
356
+ if (updateNotice) {
357
+ responseText += `\n\n${updateNotice}`;
358
+ }
359
+
360
+ return { content: [{ type: 'text', text: responseText }] };
330
361
  } catch (err) {
331
362
  return { content: [{ type: 'text', text: `Connection failed: ${err.message}` }], isError: true };
332
363
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-chat-connect",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "MCP server with channels support for connecting Claude Code sessions to MCP Chat -- real-time team messaging for AI-assisted development",
5
5
  "main": "index.js",
6
6
  "bin": {