mcp-chat-connect 1.1.8 → 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 +128 -0
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -316,6 +316,54 @@ 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
+ },
330
+ {
331
+ name: 'mcp_chat_create_channel',
332
+ description: 'Create a new MCP Chat channel. You become the admin.',
333
+ inputSchema: {
334
+ type: 'object',
335
+ properties: {
336
+ name: { type: 'string', description: 'Channel name' },
337
+ description: { type: 'string', description: 'Channel description' },
338
+ member_ids: { type: 'array', items: { type: 'number' }, description: 'User IDs to add as members' },
339
+ },
340
+ required: ['name'],
341
+ },
342
+ },
343
+ {
344
+ name: 'mcp_chat_add_member',
345
+ description: 'Add a user to a channel (requires channel admin). Specify user by ID or email.',
346
+ inputSchema: {
347
+ type: 'object',
348
+ properties: {
349
+ channel_id: { type: 'number', description: 'Channel ID (defaults to connected channel)' },
350
+ user_id: { type: 'number', description: 'User ID to add' },
351
+ email: { type: 'string', description: 'Email of user to add (alternative to user_id)' },
352
+ },
353
+ },
354
+ },
355
+ {
356
+ name: 'mcp_chat_modify_channel',
357
+ description: 'Update a channel name and/or description (requires channel admin).',
358
+ inputSchema: {
359
+ type: 'object',
360
+ properties: {
361
+ channel_id: { type: 'number', description: 'Channel ID (defaults to connected channel)' },
362
+ name: { type: 'string', description: 'New channel name' },
363
+ description: { type: 'string', description: 'New channel description' },
364
+ },
365
+ },
366
+ },
319
367
  ];
320
368
  }
321
369
 
@@ -363,6 +411,40 @@ async function handleToolCall(name, args) {
363
411
  }
364
412
  }
365
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
+
366
448
  case 'mcp_chat_send': {
367
449
  if (!sessionState.connected) {
368
450
  return { content: [{ type: 'text', text: 'Not connected. Run mcp_chat_connect first.' }], isError: true };
@@ -435,6 +517,52 @@ async function handleToolCall(name, args) {
435
517
  return { content: [{ type: 'text', text: `Connected to #${sessionState.channelName} as ${sessionState.userName}\nWebSocket: ${wsStatus}` }] };
436
518
  }
437
519
 
520
+ case 'mcp_chat_create_channel': {
521
+ if (!sessionState.token) {
522
+ return { content: [{ type: 'text', text: 'Not authenticated. Run mcp_chat_connect first.' }], isError: true };
523
+ }
524
+ const channelName = String(args.name || '').trim();
525
+ if (!channelName) return { content: [{ type: 'text', text: 'Channel name is required.' }], isError: true };
526
+ const result = await apiCall('create_channel', {
527
+ name: channelName,
528
+ description: args.description || null,
529
+ member_ids: args.member_ids || [],
530
+ }, sessionState.token);
531
+ if (result.error) return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
532
+ return { content: [{ type: 'text', text: `Channel #${result.channel.name} created (ID: ${result.channel.id})${result.channel.description ? ` -- ${result.channel.description}` : ''}` }] };
533
+ }
534
+
535
+ case 'mcp_chat_add_member': {
536
+ if (!sessionState.token) {
537
+ return { content: [{ type: 'text', text: 'Not authenticated. Run mcp_chat_connect first.' }], isError: true };
538
+ }
539
+ const channelId = args.channel_id || sessionState.channelId;
540
+ if (!channelId) return { content: [{ type: 'text', text: 'No channel specified and not connected to one.' }], isError: true };
541
+ if (!args.user_id && !args.email) return { content: [{ type: 'text', text: 'Provide user_id or email.' }], isError: true };
542
+ const result = await apiCall('add_channel_member', {
543
+ channel_id: channelId,
544
+ user_id: args.user_id || undefined,
545
+ email: args.email || undefined,
546
+ }, sessionState.token);
547
+ if (result.error) return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
548
+ return { content: [{ type: 'text', text: result.message }] };
549
+ }
550
+
551
+ case 'mcp_chat_modify_channel': {
552
+ if (!sessionState.token) {
553
+ return { content: [{ type: 'text', text: 'Not authenticated. Run mcp_chat_connect first.' }], isError: true };
554
+ }
555
+ const channelId = args.channel_id || sessionState.channelId;
556
+ if (!channelId) return { content: [{ type: 'text', text: 'No channel specified and not connected to one.' }], isError: true };
557
+ const result = await apiCall('modify_channel', {
558
+ channel_id: channelId,
559
+ name: args.name || undefined,
560
+ description: args.description !== undefined ? args.description : undefined,
561
+ }, sessionState.token);
562
+ if (result.error) return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
563
+ return { content: [{ type: 'text', text: `Channel updated: #${result.channel.name}${result.channel.description ? ` -- ${result.channel.description}` : ''}` }] };
564
+ }
565
+
438
566
  default:
439
567
  return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
440
568
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-chat-connect",
3
- "version": "1.1.8",
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",