@z_ai/mcp-server 0.1.3 → 0.1.4-beta.0
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/build/core/environment.js +9 -6
- package/build/index.js +1 -9
- package/package.json +1 -1
|
@@ -34,14 +34,17 @@ export class EnvironmentService {
|
|
|
34
34
|
// for zhipuai is https://open.bigmodel.cn/api/paas/v4/
|
|
35
35
|
envConfig.Z_AI_BASE_URL = 'https://open.bigmodel.cn/api/paas/v4/';
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
// Support both PLATFORM_MODE and Z_AI_MODE for backward compatibility
|
|
38
|
+
// Priority: PLATFORM_MODE > Z_AI_MODE > default(ZHIPU)
|
|
39
|
+
const platformMode = envConfig.PLATFORM_MODE || envConfig.Z_AI_MODE;
|
|
40
|
+
if (platformMode != null) {
|
|
41
|
+
console.info('Running in mode', { mode: platformMode });
|
|
42
|
+
if (platformMode === 'Z_AI' || platformMode === 'ZAI' || platformMode === 'Z') {
|
|
40
43
|
envConfig.Z_AI_BASE_URL = 'https://api.z.ai/api/paas/v4/';
|
|
41
44
|
envConfig.PLATFORM_MODE = 'ZAI';
|
|
42
45
|
}
|
|
43
|
-
else if (
|
|
44
|
-
||
|
|
46
|
+
else if (platformMode === 'ZHIPU_AI' || platformMode === 'ZHIPUAI'
|
|
47
|
+
|| platformMode === 'ZHIPU' || platformMode === 'BIGMODEL') {
|
|
45
48
|
envConfig.Z_AI_BASE_URL = 'https://open.bigmodel.cn/api/paas/v4/';
|
|
46
49
|
envConfig.PLATFORM_MODE = 'ZHIPU';
|
|
47
50
|
}
|
|
@@ -92,7 +95,7 @@ export class EnvironmentService {
|
|
|
92
95
|
/**
|
|
93
96
|
* Get platform mode
|
|
94
97
|
*/
|
|
95
|
-
|
|
98
|
+
getPlatformMode() {
|
|
96
99
|
const config = this.getConfig();
|
|
97
100
|
return config.PLATFORM_MODE || 'ZHIPU';
|
|
98
101
|
}
|
package/build/index.js
CHANGED
|
@@ -63,14 +63,6 @@ class McpServerApplication {
|
|
|
63
63
|
* Setup error handling
|
|
64
64
|
*/
|
|
65
65
|
setupErrorHandling() {
|
|
66
|
-
process.on('uncaughtException', (error) => {
|
|
67
|
-
console.error('Uncaught exception:', error);
|
|
68
|
-
this.gracefulShutdown(1);
|
|
69
|
-
});
|
|
70
|
-
process.on('unhandledRejection', (reason, promise) => {
|
|
71
|
-
console.error('Unhandled rejection at:', { promise, reason });
|
|
72
|
-
this.gracefulShutdown(1);
|
|
73
|
-
});
|
|
74
66
|
process.on('SIGINT', () => {
|
|
75
67
|
console.info('Received SIGINT, shutting down gracefully...');
|
|
76
68
|
this.gracefulShutdown(0);
|
|
@@ -125,7 +117,7 @@ class McpServerApplication {
|
|
|
125
117
|
// Start server
|
|
126
118
|
await this.server.connect(transport);
|
|
127
119
|
console.info('MCP Server started successfully', {
|
|
128
|
-
mode: configurationService.
|
|
120
|
+
mode: configurationService.getPlatformMode(),
|
|
129
121
|
name: configurationService.getServerConfig().name,
|
|
130
122
|
version: configurationService.getServerConfig().version
|
|
131
123
|
});
|