cellium-mcp-client 2.0.5 → 2.0.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.
- package/dist/cli.js +7 -2
- package/dist/client.js +36 -9
- package/package.json +1 -1
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(
|
|
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:
|
|
67
|
+
version: VERSION,
|
|
63
68
|
debugMode: !!options.debug,
|
|
64
69
|
verboseMode: !!options.verbose,
|
|
65
70
|
transportMode
|
package/dist/client.js
CHANGED
|
@@ -352,14 +352,23 @@ class CelliumMCPClient {
|
|
|
352
352
|
this.config.logger.info('Connected to remote Cellium server');
|
|
353
353
|
}
|
|
354
354
|
catch (error) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
|
|
355
|
+
// For http-stream endpoints, connection might fail during ping but succeed during MCP requests
|
|
356
|
+
if (this.config.endpoint.includes('/http-stream')) {
|
|
357
|
+
this.logDebug('Connection test failed for http-stream endpoint, will attempt actual request', {
|
|
358
|
+
error: error instanceof Error ? error.message : error
|
|
359
|
+
});
|
|
360
|
+
this.config.logger.info('Skipping connection test failure for http-stream endpoint - will test with actual MCP request');
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
this.config.logger.error({
|
|
364
|
+
error: error instanceof Error ? {
|
|
365
|
+
name: error.name,
|
|
366
|
+
message: error.message,
|
|
367
|
+
stack: error.stack
|
|
368
|
+
} : error
|
|
369
|
+
}, 'Failed to connect to remote server');
|
|
370
|
+
throw new Error('Cannot connect to remote Cellium server');
|
|
371
|
+
}
|
|
363
372
|
}
|
|
364
373
|
}
|
|
365
374
|
const endpoint = this.config.endpoint;
|
|
@@ -430,6 +439,12 @@ class CelliumMCPClient {
|
|
|
430
439
|
}, 'Remote server returned error');
|
|
431
440
|
throw new Error(`Remote server error: ${jsonResponse.error.message}`);
|
|
432
441
|
}
|
|
442
|
+
// Mark as connected on first successful response for http-stream endpoints
|
|
443
|
+
if (!this.isConnected && this.config.endpoint.includes('/http-stream')) {
|
|
444
|
+
this.isConnected = true;
|
|
445
|
+
this.config.logger.info('Successfully connected to http-stream endpoint via MCP request');
|
|
446
|
+
this.logDebug('Connection established through successful MCP request', { method, requestId });
|
|
447
|
+
}
|
|
433
448
|
return jsonResponse.result;
|
|
434
449
|
}
|
|
435
450
|
catch (error) {
|
|
@@ -608,6 +623,15 @@ class CelliumMCPClient {
|
|
|
608
623
|
async testConnection() {
|
|
609
624
|
const startTime = Date.now();
|
|
610
625
|
const endpoint = this.config.endpoint;
|
|
626
|
+
// Skip connection test for http-stream endpoints as they require MCP initialization first
|
|
627
|
+
if (endpoint.includes('/http-stream')) {
|
|
628
|
+
this.logDebug('Skipping connection test for http-stream endpoint', {
|
|
629
|
+
endpoint: endpoint,
|
|
630
|
+
reason: 'http-stream endpoints require MCP initialization before any requests'
|
|
631
|
+
});
|
|
632
|
+
this.config.logger.debug('Skipped connection test for http-stream endpoint - will connect during MCP handshake');
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
611
635
|
this.logDebug('Testing connection', {
|
|
612
636
|
endpoint: endpoint,
|
|
613
637
|
hasToken: !!this.config.token
|
|
@@ -647,7 +671,10 @@ class CelliumMCPClient {
|
|
|
647
671
|
try {
|
|
648
672
|
this.logDebug('Initializing remote connection and pre-fetching tools');
|
|
649
673
|
await this.testConnection();
|
|
650
|
-
|
|
674
|
+
// For http-stream endpoints, connection test is skipped, so don't mark as connected yet
|
|
675
|
+
if (!this.config.endpoint.includes('/http-stream')) {
|
|
676
|
+
this.isConnected = true;
|
|
677
|
+
}
|
|
651
678
|
// Pre-fetch and cache tools list
|
|
652
679
|
try {
|
|
653
680
|
const toolsResult = await this.makeHttpRequest('tools/list', {});
|