mcp-chat-connect 1.2.0 → 1.2.1

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 +45 -0
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -316,6 +316,17 @@ function getTools() {
316
316
  description: 'Check your current MCP Chat connection status.',
317
317
  inputSchema: { type: 'object', properties: {} },
318
318
  },
319
+ {
320
+ name: 'mcp_chat_join',
321
+ description: 'Connect to a specific MCP Chat channel by ID without opening a browser. Requires prior authentication (saved token from a previous mcp_chat_connect). Used by agents to join channels created by the parent session.',
322
+ inputSchema: {
323
+ type: 'object',
324
+ properties: {
325
+ channel_id: { type: 'number', description: 'Channel ID to join' },
326
+ },
327
+ required: ['channel_id'],
328
+ },
329
+ },
319
330
  {
320
331
  name: 'mcp_chat_create_channel',
321
332
  description: 'Create a new MCP Chat channel. You become the admin.',
@@ -400,6 +411,40 @@ async function handleToolCall(name, args) {
400
411
  }
401
412
  }
402
413
 
414
+ case 'mcp_chat_join': {
415
+ if (!sessionState.token) {
416
+ return { content: [{ type: 'text', text: 'Not authenticated. A user must run mcp_chat_connect first to save credentials.' }], isError: true };
417
+ }
418
+ const channelId = parseInt(args.channel_id, 10);
419
+ if (!channelId || isNaN(channelId)) {
420
+ return { content: [{ type: 'text', text: 'Valid channel_id is required.' }], isError: true };
421
+ }
422
+
423
+ // Verify we can access this channel
424
+ try {
425
+ const channelsResult = await apiCall('list_channels', {}, sessionState.token);
426
+ const channel = channelsResult.channels?.find(c => c.id === channelId);
427
+ if (!channel) {
428
+ return { content: [{ type: 'text', text: `Channel ${channelId} not found or you are not a member.` }], isError: true };
429
+ }
430
+
431
+ disconnectWebSocket();
432
+ const sessionToken = `mcp-${crypto.randomBytes(16).toString('hex')}`;
433
+ sessionState = {
434
+ ...sessionState,
435
+ channelId,
436
+ channelName: channel.name,
437
+ sessionToken,
438
+ connected: true,
439
+ };
440
+
441
+ connectWebSocket();
442
+ return { content: [{ type: 'text', text: `Joined #${channel.name} (ID: ${channelId}) as ${sessionState.userName}. Live messages are now being pushed.` }] };
443
+ } catch (err) {
444
+ return { content: [{ type: 'text', text: `Failed to join channel: ${err.message}` }], isError: true };
445
+ }
446
+ }
447
+
403
448
  case 'mcp_chat_send': {
404
449
  if (!sessionState.connected) {
405
450
  return { content: [{ type: 'text', text: 'Not connected. Run mcp_chat_connect first.' }], isError: true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-chat-connect",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
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": {
@@ -16,7 +16,7 @@
16
16
  "development",
17
17
  "collaboration"
18
18
  ],
19
- "author": "Dovito",
19
+ "author": "mncoleman",
20
20
  "license": "MIT",
21
21
  "repository": {
22
22
  "type": "git",