artifact-hub-mcp 1.0.2 → 1.0.4
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/client.js +20 -4
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -198,8 +198,23 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (req) => {
|
|
|
198
198
|
}
|
|
199
199
|
case 'search_artifacts': {
|
|
200
200
|
const limit = args['limit'] ?? 20;
|
|
201
|
-
const
|
|
202
|
-
|
|
201
|
+
const query = args['query'].toLowerCase().trim();
|
|
202
|
+
const catalog = await apiGet('/catalog');
|
|
203
|
+
const results = [];
|
|
204
|
+
for (const a of catalog.artifacts) {
|
|
205
|
+
if (a.title.toLowerCase().includes(query) ||
|
|
206
|
+
(a.description?.toLowerCase().includes(query) ?? false) ||
|
|
207
|
+
a.tags.some(t => t.toLowerCase().includes(query)) ||
|
|
208
|
+
a.path.toLowerCase().includes(query))
|
|
209
|
+
results.push({ type: 'artifact', ...a });
|
|
210
|
+
}
|
|
211
|
+
for (const f of catalog.folders) {
|
|
212
|
+
if (f.path.toLowerCase().includes(query) ||
|
|
213
|
+
(f.title?.toLowerCase().includes(query) ?? false) ||
|
|
214
|
+
f.allTags.some(t => t.toLowerCase().includes(query)))
|
|
215
|
+
results.push({ type: 'folder', ...f });
|
|
216
|
+
}
|
|
217
|
+
return { content: [{ type: 'text', text: JSON.stringify(results.slice(0, limit), null, 2) }] };
|
|
203
218
|
}
|
|
204
219
|
case 'browse_folder': {
|
|
205
220
|
const path = args['path'];
|
|
@@ -225,12 +240,13 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (req) => {
|
|
|
225
240
|
tags: args['tags'],
|
|
226
241
|
contentType: args['contentType'],
|
|
227
242
|
});
|
|
228
|
-
const
|
|
243
|
+
const uploadUrl = `${BASE_URL}/upload?token=${encodeURIComponent(data.token)}`;
|
|
244
|
+
const curlCmd = `curl -s -X POST '${uploadUrl}' -F 'file=@${args['fileLocalPath']}'`;
|
|
229
245
|
return {
|
|
230
246
|
content: [{
|
|
231
247
|
type: 'text',
|
|
232
248
|
text: JSON.stringify({
|
|
233
|
-
uploadUrl
|
|
249
|
+
uploadUrl,
|
|
234
250
|
expiresIn: data.expiresIn,
|
|
235
251
|
curlCommand: curlCmd,
|
|
236
252
|
instruction: 'Run the curlCommand now to upload the file.',
|