cellium-mcp-client 1.1.1 → 1.1.2
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 +1 -1
- package/dist/client.js +63 -15
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ const program = new commander_1.Command();
|
|
|
11
11
|
program
|
|
12
12
|
.name('cellium-mcp-client')
|
|
13
13
|
.description('MCP client for connecting to remote Cellium processor server')
|
|
14
|
-
.version('1.1.
|
|
14
|
+
.version('1.1.2')
|
|
15
15
|
.option('-t, --token <token>', 'Authentication token (format: user:username:hash)')
|
|
16
16
|
.option('-e, --endpoint <url>', 'Server endpoint URL', 'http://localhost:3000/mcp')
|
|
17
17
|
.option('-v, --verbose', 'Enable verbose logging')
|
package/dist/client.js
CHANGED
|
@@ -76,36 +76,84 @@ class CelliumMCPClient {
|
|
|
76
76
|
},
|
|
77
77
|
serverInfo: {
|
|
78
78
|
name: 'cellium-mcp-client',
|
|
79
|
-
version: '1.1.
|
|
79
|
+
version: '1.1.2'
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
});
|
|
83
83
|
// Override the underlying server's tool request handlers to proxy to remote
|
|
84
84
|
this.localServer.server.setRequestHandler(ToolsListSchema, async () => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
try {
|
|
86
|
+
this.config.logger.debug('Proxying tools/list to remote server');
|
|
87
|
+
const result = await this.makeHttpRequest('tools/list', {});
|
|
88
|
+
this.config.logger.debug({ result }, 'tools/list result from remote server');
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
this.config.logger.error({ error }, 'Error proxying tools/list');
|
|
93
|
+
// Return empty tools list instead of throwing to prevent transport closure
|
|
94
|
+
return { tools: [] };
|
|
95
|
+
}
|
|
88
96
|
});
|
|
89
97
|
this.localServer.server.setRequestHandler(ToolsCallSchema, async (request) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
try {
|
|
99
|
+
this.config.logger.debug({ toolName: request.params?.name }, 'Proxying tool call to remote server');
|
|
100
|
+
const result = await this.makeHttpRequest('tools/call', request.params);
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
this.config.logger.error({ error, toolName: request.params?.name }, 'Error proxying tool call');
|
|
105
|
+
// Return error result instead of throwing
|
|
106
|
+
return {
|
|
107
|
+
content: [{
|
|
108
|
+
type: 'text',
|
|
109
|
+
text: `Error calling tool: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
110
|
+
}],
|
|
111
|
+
isError: true
|
|
112
|
+
};
|
|
113
|
+
}
|
|
93
114
|
});
|
|
94
115
|
// Handle resources as well
|
|
95
116
|
this.localServer.server.setRequestHandler(ResourcesListSchema, async () => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
117
|
+
try {
|
|
118
|
+
this.config.logger.debug('Proxying resources/list to remote server');
|
|
119
|
+
const result = await this.makeHttpRequest('resources/list', {});
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
this.config.logger.error({ error }, 'Error proxying resources/list');
|
|
124
|
+
// Return empty resources list instead of throwing
|
|
125
|
+
return { resources: [] };
|
|
126
|
+
}
|
|
99
127
|
});
|
|
100
128
|
this.localServer.server.setRequestHandler(ResourcesReadSchema, async (request) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
129
|
+
try {
|
|
130
|
+
this.config.logger.debug({ uri: request.params?.uri }, 'Proxying resources/read to remote server');
|
|
131
|
+
const result = await this.makeHttpRequest('resources/read', request.params);
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
this.config.logger.error({ error, uri: request.params?.uri }, 'Error proxying resources/read');
|
|
136
|
+
// Return error result instead of throwing
|
|
137
|
+
return {
|
|
138
|
+
contents: [{
|
|
139
|
+
uri: request.params?.uri || '',
|
|
140
|
+
mimeType: 'text/plain',
|
|
141
|
+
text: `Error reading resource: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
142
|
+
}]
|
|
143
|
+
};
|
|
144
|
+
}
|
|
104
145
|
});
|
|
105
146
|
// Handle ping
|
|
106
147
|
this.localServer.server.setRequestHandler(PingSchema, async () => {
|
|
107
|
-
|
|
108
|
-
|
|
148
|
+
try {
|
|
149
|
+
const result = await this.makeHttpRequest('ping', {});
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
this.config.logger.error({ error }, 'Error proxying ping');
|
|
154
|
+
// Return empty result instead of throwing
|
|
155
|
+
return {};
|
|
156
|
+
}
|
|
109
157
|
});
|
|
110
158
|
// Handle other common MCP methods
|
|
111
159
|
this.localServer.server.setNotificationHandler(InitializedNotificationSchema, async () => {
|