@closedloop-ai/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/index.js +18 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -18,7 +18,7 @@ if (!CLOSEDLOOP_API_KEY) {
|
|
|
18
18
|
const server = new Server(
|
|
19
19
|
{
|
|
20
20
|
name: 'closedloop-mcp-server',
|
|
21
|
-
version: '1.1.
|
|
21
|
+
version: '1.1.2',
|
|
22
22
|
description: 'Provides access to ClosedLoop AI product feedback data and insights with advanced search capabilities.',
|
|
23
23
|
},
|
|
24
24
|
{
|
|
@@ -178,7 +178,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
178
178
|
if (!args.query) {
|
|
179
179
|
throw new Error('query is required');
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
// Use MCP protocol for search_insights
|
|
182
|
+
response = await axios.post(CLOSEDLOOP_SERVER_URL, {
|
|
183
|
+
jsonrpc: '2.0',
|
|
184
|
+
id: 1,
|
|
185
|
+
method: 'tools/call',
|
|
186
|
+
params: {
|
|
187
|
+
name: 'search_insights',
|
|
188
|
+
arguments: args
|
|
189
|
+
}
|
|
190
|
+
}, {
|
|
182
191
|
headers
|
|
183
192
|
});
|
|
184
193
|
break;
|
|
@@ -187,11 +196,17 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
187
196
|
throw new Error(`Unknown tool: ${name}`);
|
|
188
197
|
}
|
|
189
198
|
|
|
199
|
+
// Handle MCP protocol response for search_insights
|
|
200
|
+
let responseData = response.data;
|
|
201
|
+
if (name === 'search_insights' && responseData.result) {
|
|
202
|
+
responseData = responseData.result;
|
|
203
|
+
}
|
|
204
|
+
|
|
190
205
|
return {
|
|
191
206
|
content: [
|
|
192
207
|
{
|
|
193
208
|
type: 'text',
|
|
194
|
-
text: JSON.stringify(
|
|
209
|
+
text: JSON.stringify(responseData, null, 2)
|
|
195
210
|
}
|
|
196
211
|
]
|
|
197
212
|
};
|