cellium-mcp-client 2.0.6 → 2.0.8

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/cli.js CHANGED
@@ -7,11 +7,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const client_1 = require("./client");
8
8
  const commander_1 = require("commander");
9
9
  const pino_1 = __importDefault(require("pino"));
10
+ const fs_1 = require("fs");
11
+ const path_1 = require("path");
12
+ // Read version from package.json
13
+ const packageJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../package.json'), 'utf8'));
14
+ const VERSION = packageJson.version;
10
15
  const program = new commander_1.Command();
11
16
  program
12
17
  .name('cellium-mcp-client')
13
18
  .description('MCP client for connecting to remote Cellium processor server')
14
- .version('2.0.0')
19
+ .version(VERSION)
15
20
  .option('-t, --token <token>', 'Authentication token (format: user:username:hash)')
16
21
  .option('-e, --endpoint <url>', 'Server endpoint URL', 'http://localhost:3000/http-stream')
17
22
  .option('-p, --port <number>', 'HTTP streaming port for MCP client', '3001')
@@ -59,7 +64,7 @@ async function main() {
59
64
  const useStdio = options.stdio || (!process.stdin.isTTY && process.stdout.isTTY);
60
65
  const transportMode = useStdio ? 'stdio' : 'http-streaming';
61
66
  logger.info({
62
- version: '2.0.0',
67
+ version: VERSION,
63
68
  debugMode: !!options.debug,
64
69
  verboseMode: !!options.verbose,
65
70
  transportMode
package/dist/client.js CHANGED
@@ -671,11 +671,47 @@ class CelliumMCPClient {
671
671
  try {
672
672
  this.logDebug('Initializing remote connection and pre-fetching tools');
673
673
  await this.testConnection();
674
- // For http-stream endpoints, connection test is skipped, so don't mark as connected yet
675
- if (!this.config.endpoint.includes('/http-stream')) {
674
+ // For http-stream endpoints, we need to do proper MCP initialization first
675
+ if (this.config.endpoint.includes('/http-stream')) {
676
+ this.logDebug('Performing MCP initialization handshake with remote server');
677
+ try {
678
+ // Step 1: Send initialize request
679
+ const initRequest = {
680
+ method: 'initialize',
681
+ params: {
682
+ protocolVersion: this.mcpProtocolVersion,
683
+ capabilities: {
684
+ tools: {},
685
+ resources: {}
686
+ }
687
+ }
688
+ };
689
+ this.logDebug('Sending initialize request to remote server', initRequest);
690
+ const initResponse = await this.makeHttpRequest('initialize', initRequest.params);
691
+ this.logDebug('Received initialize response from remote server', initResponse);
692
+ // Step 2: Send initialized notification
693
+ const initializedNotification = {
694
+ method: 'notifications/initialized',
695
+ params: {}
696
+ };
697
+ this.logDebug('Sending initialized notification to remote server', initializedNotification);
698
+ await this.makeHttpRequest('notifications/initialized', initializedNotification.params);
699
+ this.logDebug('MCP initialization handshake completed successfully');
700
+ // Mark as connected after successful MCP initialization
701
+ this.isConnected = true;
702
+ }
703
+ catch (initError) {
704
+ this.config.logger.error({
705
+ error: initError instanceof Error ? initError.message : initError
706
+ }, 'MCP initialization handshake failed');
707
+ throw initError;
708
+ }
709
+ }
710
+ else {
711
+ // For non-http-stream endpoints, mark as connected after connection test
676
712
  this.isConnected = true;
677
713
  }
678
- // Pre-fetch and cache tools list
714
+ // Pre-fetch and cache tools list after successful initialization
679
715
  try {
680
716
  const toolsResult = await this.makeHttpRequest('tools/list', {});
681
717
  if (toolsResult.tools) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cellium-mcp-client",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "MCP client for connecting to remote Cellium processor server",
5
5
  "main": "dist/index.js",
6
6
  "bin": {