@toolsdk.ai/registry 1.0.113 → 1.0.115
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/README.md +66 -11
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +23 -25
- package/dist/domains/config/config-route.d.ts +2 -0
- package/dist/domains/config/config-route.js +31 -0
- package/dist/domains/config/config-schema.d.ts +57 -0
- package/dist/domains/config/config-schema.js +10 -0
- package/dist/domains/config/config-types.d.ts +3 -0
- package/dist/domains/executor/executor-factory.d.ts +9 -0
- package/dist/domains/executor/executor-factory.js +17 -0
- package/dist/domains/executor/executor-types.d.ts +15 -0
- package/dist/domains/executor/local-executor.d.ts +12 -0
- package/dist/domains/executor/local-executor.js +48 -0
- package/dist/domains/executor/sandbox-executor.d.ts +16 -0
- package/dist/domains/executor/sandbox-executor.js +83 -0
- package/dist/domains/package/package-handler.d.ts +17 -0
- package/dist/domains/package/package-handler.js +58 -0
- package/dist/domains/package/package-repository.d.ts +9 -0
- package/dist/domains/package/package-repository.js +26 -0
- package/dist/domains/package/package-route.d.ts +2 -0
- package/dist/{api → domains/package}/package-route.js +38 -52
- package/dist/domains/package/package-schema.d.ts +244 -0
- package/dist/domains/package/package-schema.js +52 -0
- package/dist/domains/package/package-so.d.ts +78 -0
- package/dist/domains/package/package-so.js +61 -0
- package/dist/domains/package/package-so.test.js +378 -0
- package/dist/domains/package/package-types.d.ts +9 -0
- package/dist/domains/package/package-types.js +1 -0
- package/dist/domains/sandbox/clients/daytona-client.d.ts +17 -0
- package/dist/domains/sandbox/clients/daytona-client.js +112 -0
- package/dist/domains/sandbox/clients/sandock-client.d.ts +19 -0
- package/dist/domains/sandbox/clients/sandock-client.js +178 -0
- package/dist/domains/sandbox/sandbox-factory.d.ts +8 -0
- package/dist/domains/sandbox/sandbox-factory.js +23 -0
- package/dist/domains/sandbox/sandbox-pool-so.d.ts +25 -0
- package/dist/domains/sandbox/sandbox-pool-so.js +123 -0
- package/dist/domains/sandbox/sandbox-types.d.ts +25 -0
- package/dist/domains/sandbox/sandbox-types.js +1 -0
- package/dist/domains/sandbox/sandbox-utils.d.ts +3 -0
- package/dist/domains/sandbox/sandbox-utils.js +109 -0
- package/dist/domains/search/search-handler.d.ts +47 -0
- package/dist/domains/search/search-handler.js +113 -0
- package/dist/domains/search/search-route.d.ts +2 -0
- package/dist/domains/search/search-route.js +101 -0
- package/dist/domains/search/search-schema.d.ts +384 -0
- package/dist/domains/search/search-schema.js +99 -0
- package/dist/domains/search/search-so.d.ts +55 -0
- package/dist/{search/search-service.js → domains/search/search-so.js} +200 -297
- package/dist/shared/config/environment.d.ts +16 -0
- package/dist/shared/config/environment.js +41 -0
- package/dist/shared/schemas/common-schema.d.ts +249 -0
- package/dist/{schema.js → shared/schemas/common-schema.js} +37 -80
- package/dist/shared/schemas/index.d.ts +1 -0
- package/dist/shared/schemas/index.js +1 -0
- package/dist/shared/scripts-helpers/index.d.ts +60 -0
- package/dist/shared/scripts-helpers/index.js +61 -0
- package/dist/shared/utils/file-util.d.ts +1 -0
- package/dist/shared/utils/file-util.js +5 -0
- package/dist/shared/utils/index.d.ts +5 -0
- package/dist/shared/utils/index.js +5 -0
- package/dist/shared/utils/mcp-client-util.d.ts +31 -0
- package/dist/shared/utils/mcp-client-util.js +79 -0
- package/dist/shared/utils/package-util.d.ts +6 -0
- package/dist/shared/utils/package-util.js +53 -0
- package/dist/shared/utils/promise-util.d.ts +1 -0
- package/dist/shared/utils/promise-util.js +14 -0
- package/dist/{utils.d.ts → shared/utils/response-util.d.ts} +6 -2
- package/dist/{utils.js → shared/utils/response-util.js} +1 -6
- package/dist/shared/utils/string-util.d.ts +1 -0
- package/dist/shared/utils/string-util.js +25 -0
- package/dist/shared/utils/validation-util.d.ts +12 -0
- package/dist/shared/utils/validation-util.js +99 -0
- package/indexes/categories-list.json +1 -0
- package/indexes/packages-list.json +6 -0
- package/package.json +9 -2
- package/packages/developer-tools/neurolink.json +23 -0
- package/packages/search-data-extraction/ref-tools-mcp.json +7 -2
- package/README.dev.md +0 -195
- package/dist/api/package-handler.d.ts +0 -18
- package/dist/api/package-handler.js +0 -72
- package/dist/api/package-route.d.ts +0 -2
- package/dist/api/package-so.d.ts +0 -19
- package/dist/api/package-so.js +0 -263
- package/dist/api/package.test.js +0 -19
- package/dist/helper.d.ts +0 -72
- package/dist/helper.js +0 -278
- package/dist/sandbox/mcp-sandbox-client.d.ts +0 -37
- package/dist/sandbox/mcp-sandbox-client.js +0 -428
- package/dist/schema.d.ts +0 -806
- package/dist/search/search-route.d.ts +0 -3
- package/dist/search/search-route.js +0 -305
- package/dist/search/search-service.d.ts +0 -120
- package/dist/search/search.test.js +0 -100
- package/dist/types.d.ts +0 -27
- /package/dist/{api/package.test.d.ts → domains/config/config-types.js} +0 -0
- /package/dist/{search/search.test.d.ts → domains/executor/executor-types.js} +0 -0
- /package/dist/{types.js → domains/package/package-so.test.d.ts} +0 -0
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
|
2
|
-
import { BaseResponseSchema } from "../schema";
|
|
3
|
-
import { createErrorResponse, createResponse, createRouteResponses } from "../utils";
|
|
4
|
-
import searchService from "./search-service";
|
|
5
|
-
const searchRoutes = new OpenAPIHono();
|
|
6
|
-
// Define search query parameter schema
|
|
7
|
-
const searchQuerySchema = z.object({
|
|
8
|
-
q: z.string().openapi({
|
|
9
|
-
description: "Search query",
|
|
10
|
-
example: "database",
|
|
11
|
-
}),
|
|
12
|
-
limit: z.coerce.number().min(1).max(100).optional().openapi({
|
|
13
|
-
description: "Limit the number of results",
|
|
14
|
-
example: 20,
|
|
15
|
-
}),
|
|
16
|
-
offset: z.coerce.number().min(0).optional().openapi({
|
|
17
|
-
description: "Offset for pagination",
|
|
18
|
-
example: 0,
|
|
19
|
-
}),
|
|
20
|
-
category: z.string().optional().openapi({
|
|
21
|
-
description: "Filter by category",
|
|
22
|
-
example: "databases",
|
|
23
|
-
}),
|
|
24
|
-
});
|
|
25
|
-
// Define search result response schema
|
|
26
|
-
const searchResultSchema = z
|
|
27
|
-
.object({
|
|
28
|
-
id: z.string(),
|
|
29
|
-
name: z.string(),
|
|
30
|
-
packageName: z.string(),
|
|
31
|
-
description: z.string(),
|
|
32
|
-
category: z.string(),
|
|
33
|
-
validated: z.boolean(),
|
|
34
|
-
author: z.string(),
|
|
35
|
-
toolCount: z.number(),
|
|
36
|
-
hasTools: z.boolean(),
|
|
37
|
-
popularity: z.number(),
|
|
38
|
-
})
|
|
39
|
-
.openapi("SearchResult");
|
|
40
|
-
const searchResponseSchema = BaseResponseSchema.extend({
|
|
41
|
-
data: z
|
|
42
|
-
.object({
|
|
43
|
-
hits: z.array(searchResultSchema),
|
|
44
|
-
query: z.string(),
|
|
45
|
-
processingTimeMs: z.number(),
|
|
46
|
-
limit: z.number(),
|
|
47
|
-
offset: z.number(),
|
|
48
|
-
estimatedTotalHits: z.number(),
|
|
49
|
-
})
|
|
50
|
-
.optional(),
|
|
51
|
-
}).openapi("SearchResponse");
|
|
52
|
-
// Search route definition
|
|
53
|
-
const searchRoute = createRoute({
|
|
54
|
-
method: "get",
|
|
55
|
-
path: "/search",
|
|
56
|
-
request: {
|
|
57
|
-
query: searchQuerySchema,
|
|
58
|
-
},
|
|
59
|
-
responses: createRouteResponses(searchResponseSchema, {
|
|
60
|
-
includeErrorResponses: true,
|
|
61
|
-
}),
|
|
62
|
-
});
|
|
63
|
-
searchRoutes.openapi(searchRoute, async (c) => {
|
|
64
|
-
try {
|
|
65
|
-
const { q, limit, offset, category } = c.req.valid("query");
|
|
66
|
-
// Build filter condition
|
|
67
|
-
const filter = category ? `category = '${category}'` : undefined;
|
|
68
|
-
// Execute search
|
|
69
|
-
const results = await searchService.search(q, {
|
|
70
|
-
limit,
|
|
71
|
-
offset,
|
|
72
|
-
filter,
|
|
73
|
-
});
|
|
74
|
-
const response = createResponse(results);
|
|
75
|
-
return c.json(response, 200);
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
console.error("Search failed:", error.stack);
|
|
79
|
-
const errorResponse = createErrorResponse(error.message || "Search failed", 500);
|
|
80
|
-
return c.json(errorResponse, 500);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
// Define suggest query parameter schema
|
|
84
|
-
const suggestQuerySchema = z.object({
|
|
85
|
-
q: z.string().openapi({
|
|
86
|
-
description: "Suggestion query",
|
|
87
|
-
example: "data",
|
|
88
|
-
}),
|
|
89
|
-
limit: z.coerce.number().min(1).max(20).optional().openapi({
|
|
90
|
-
description: "Limit the number of results",
|
|
91
|
-
example: 10,
|
|
92
|
-
}),
|
|
93
|
-
});
|
|
94
|
-
// Define suggest result response schema
|
|
95
|
-
const suggestResultSchema = z
|
|
96
|
-
.object({
|
|
97
|
-
name: z.string(),
|
|
98
|
-
packageName: z.string(),
|
|
99
|
-
category: z.string(),
|
|
100
|
-
highlighted: z.string(),
|
|
101
|
-
})
|
|
102
|
-
.openapi("SuggestResult");
|
|
103
|
-
const suggestResponseSchema = BaseResponseSchema.extend({
|
|
104
|
-
data: z
|
|
105
|
-
.object({
|
|
106
|
-
suggestions: z.array(suggestResultSchema),
|
|
107
|
-
})
|
|
108
|
-
.optional(),
|
|
109
|
-
}).openapi("SuggestResponse");
|
|
110
|
-
// Search suggest route definition
|
|
111
|
-
const suggestRoute = createRoute({
|
|
112
|
-
method: "get",
|
|
113
|
-
path: "/search/suggest",
|
|
114
|
-
request: {
|
|
115
|
-
query: suggestQuerySchema,
|
|
116
|
-
},
|
|
117
|
-
responses: createRouteResponses(suggestResponseSchema, {
|
|
118
|
-
includeErrorResponses: true,
|
|
119
|
-
}),
|
|
120
|
-
});
|
|
121
|
-
searchRoutes.openapi(suggestRoute, async (c) => {
|
|
122
|
-
try {
|
|
123
|
-
const { q, limit } = c.req.valid("query");
|
|
124
|
-
const suggestions = await searchService.suggest(q, limit);
|
|
125
|
-
const response = createResponse({ suggestions });
|
|
126
|
-
return c.json(response, 200);
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
129
|
-
console.error("Failed to get suggestions:", error.stack);
|
|
130
|
-
const errorResponse = createErrorResponse(error.message || "Failed to get suggestions");
|
|
131
|
-
return c.json(errorResponse, 400);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
// Define facets response schema
|
|
135
|
-
const facetsResponseSchema = BaseResponseSchema.extend({
|
|
136
|
-
data: z
|
|
137
|
-
.object({
|
|
138
|
-
categories: z.record(z.string(), z.number()).optional(),
|
|
139
|
-
authors: z.record(z.string(), z.number()).optional(),
|
|
140
|
-
validated: z.record(z.string(), z.number()).optional(),
|
|
141
|
-
})
|
|
142
|
-
.optional(),
|
|
143
|
-
}).openapi("FacetsResponse");
|
|
144
|
-
// Facets route definition
|
|
145
|
-
const facetsRoute = createRoute({
|
|
146
|
-
method: "get",
|
|
147
|
-
path: "/search/facets",
|
|
148
|
-
responses: createRouteResponses(facetsResponseSchema, {
|
|
149
|
-
includeErrorResponses: true,
|
|
150
|
-
}),
|
|
151
|
-
});
|
|
152
|
-
searchRoutes.openapi(facetsRoute, async (c) => {
|
|
153
|
-
try {
|
|
154
|
-
// Get facets information
|
|
155
|
-
const facets = await searchService.getFacets();
|
|
156
|
-
const response = createResponse({
|
|
157
|
-
categories: facets === null || facets === void 0 ? void 0 : facets.category,
|
|
158
|
-
authors: facets === null || facets === void 0 ? void 0 : facets.author,
|
|
159
|
-
validated: facets === null || facets === void 0 ? void 0 : facets.validated,
|
|
160
|
-
});
|
|
161
|
-
return c.json(response, 200);
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
console.error("Failed to get facets:", error.stack);
|
|
165
|
-
const errorResponse = createErrorResponse(error.message || "Failed to get facets", 500);
|
|
166
|
-
return c.json(errorResponse, 500);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
// Define health check response schema
|
|
170
|
-
const healthResponseSchema = BaseResponseSchema.extend({
|
|
171
|
-
data: z
|
|
172
|
-
.object({
|
|
173
|
-
status: z.string(),
|
|
174
|
-
host: z.string(),
|
|
175
|
-
initialized: z.boolean(),
|
|
176
|
-
indexName: z.string(),
|
|
177
|
-
documentCount: z.number(),
|
|
178
|
-
})
|
|
179
|
-
.optional(),
|
|
180
|
-
}).openapi("HealthResponse");
|
|
181
|
-
// Health check route definition
|
|
182
|
-
const healthRoute = createRoute({
|
|
183
|
-
method: "get",
|
|
184
|
-
path: "/search/health",
|
|
185
|
-
responses: createRouteResponses(healthResponseSchema, {
|
|
186
|
-
includeErrorResponses: true,
|
|
187
|
-
}),
|
|
188
|
-
});
|
|
189
|
-
searchRoutes.openapi(healthRoute, async (c) => {
|
|
190
|
-
try {
|
|
191
|
-
// Perform health check
|
|
192
|
-
const health = await searchService.healthCheck();
|
|
193
|
-
const response = createResponse(health);
|
|
194
|
-
return c.json(response, 200);
|
|
195
|
-
}
|
|
196
|
-
catch (error) {
|
|
197
|
-
console.error("Health check failed:", error.stack);
|
|
198
|
-
const errorResponse = createErrorResponse(error.message || "Health check failed", 500);
|
|
199
|
-
return c.json(errorResponse, 500);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
// Define management response schema
|
|
203
|
-
const managementResponseSchema = BaseResponseSchema.extend({
|
|
204
|
-
data: z
|
|
205
|
-
.object({
|
|
206
|
-
message: z.string(),
|
|
207
|
-
details: z.any().optional(),
|
|
208
|
-
})
|
|
209
|
-
.optional(),
|
|
210
|
-
}).openapi("ManagementResponse");
|
|
211
|
-
// Initialize search service route definition
|
|
212
|
-
const initRoute = createRoute({
|
|
213
|
-
method: "post",
|
|
214
|
-
path: "/search/manage/init",
|
|
215
|
-
responses: createRouteResponses(managementResponseSchema, {
|
|
216
|
-
includeErrorResponses: true,
|
|
217
|
-
}),
|
|
218
|
-
});
|
|
219
|
-
searchRoutes.openapi(initRoute, async (c) => {
|
|
220
|
-
try {
|
|
221
|
-
// Initialize search service
|
|
222
|
-
await searchService.initialize();
|
|
223
|
-
const response = createResponse({
|
|
224
|
-
message: "Search service initialized successfully",
|
|
225
|
-
});
|
|
226
|
-
return c.json(response, 200);
|
|
227
|
-
}
|
|
228
|
-
catch (error) {
|
|
229
|
-
console.error("Failed to initialize search service:", error.stack);
|
|
230
|
-
const errorResponse = createErrorResponse(error.message || "Failed to initialize search service", 500);
|
|
231
|
-
return c.json(errorResponse, 500);
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
// Index packages route definition
|
|
235
|
-
const indexRoute = createRoute({
|
|
236
|
-
method: "post",
|
|
237
|
-
path: "/search/manage/index",
|
|
238
|
-
responses: createRouteResponses(managementResponseSchema, {
|
|
239
|
-
includeErrorResponses: true,
|
|
240
|
-
}),
|
|
241
|
-
});
|
|
242
|
-
searchRoutes.openapi(indexRoute, async (c) => {
|
|
243
|
-
try {
|
|
244
|
-
// Index all packages
|
|
245
|
-
const stats = await searchService.indexPackages();
|
|
246
|
-
const response = createResponse({
|
|
247
|
-
message: `Indexed ${stats.numberOfDocuments} documents`,
|
|
248
|
-
details: stats,
|
|
249
|
-
});
|
|
250
|
-
return c.json(response, 200);
|
|
251
|
-
}
|
|
252
|
-
catch (error) {
|
|
253
|
-
console.error("Failed to index packages:", error.stack);
|
|
254
|
-
const errorResponse = createErrorResponse(error.message || "Failed to index packages", 500);
|
|
255
|
-
return c.json(errorResponse, 500);
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
// Clear index route definition
|
|
259
|
-
const clearRoute = createRoute({
|
|
260
|
-
method: "post",
|
|
261
|
-
path: "/search/manage/clear",
|
|
262
|
-
responses: createRouteResponses(managementResponseSchema, {
|
|
263
|
-
includeErrorResponses: true,
|
|
264
|
-
}),
|
|
265
|
-
});
|
|
266
|
-
searchRoutes.openapi(clearRoute, async (c) => {
|
|
267
|
-
try {
|
|
268
|
-
// Clear the index
|
|
269
|
-
await searchService.clearIndex();
|
|
270
|
-
const response = createResponse({
|
|
271
|
-
message: "Index cleared successfully",
|
|
272
|
-
});
|
|
273
|
-
return c.json(response, 200);
|
|
274
|
-
}
|
|
275
|
-
catch (error) {
|
|
276
|
-
console.error("Failed to clear index:", error.stack);
|
|
277
|
-
const errorResponse = createErrorResponse(error.message || "Failed to clear index", 500);
|
|
278
|
-
return c.json(errorResponse, 500);
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
// Get index stats route definition
|
|
282
|
-
const statsRoute = createRoute({
|
|
283
|
-
method: "get",
|
|
284
|
-
path: "/search/manage/stats",
|
|
285
|
-
responses: createRouteResponses(managementResponseSchema, {
|
|
286
|
-
includeErrorResponses: true,
|
|
287
|
-
}),
|
|
288
|
-
});
|
|
289
|
-
searchRoutes.openapi(statsRoute, async (c) => {
|
|
290
|
-
try {
|
|
291
|
-
// Get index statistics
|
|
292
|
-
const stats = await searchService.getStats();
|
|
293
|
-
const response = createResponse({
|
|
294
|
-
message: "Index statistics retrieved successfully",
|
|
295
|
-
details: stats,
|
|
296
|
-
});
|
|
297
|
-
return c.json(response, 200);
|
|
298
|
-
}
|
|
299
|
-
catch (error) {
|
|
300
|
-
console.error("Failed to get index statistics:", error.stack);
|
|
301
|
-
const errorResponse = createErrorResponse(error.message || "Failed to get index statistics", 500);
|
|
302
|
-
return c.json(errorResponse, 500);
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
export { searchRoutes };
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeiliSearch Service for Awesome MCP Registry
|
|
3
|
-
* Handles search indexing and querying for MCP packages
|
|
4
|
-
*/
|
|
5
|
-
import { type Index, MeiliSearch } from "meilisearch";
|
|
6
|
-
interface PackageData {
|
|
7
|
-
name?: string;
|
|
8
|
-
description?: string;
|
|
9
|
-
category?: string;
|
|
10
|
-
validated?: boolean;
|
|
11
|
-
tools?: Record<string, {
|
|
12
|
-
description?: string;
|
|
13
|
-
}>;
|
|
14
|
-
path?: string;
|
|
15
|
-
}
|
|
16
|
-
interface SearchOptions {
|
|
17
|
-
limit?: number;
|
|
18
|
-
offset?: number;
|
|
19
|
-
filter?: string | string[];
|
|
20
|
-
sort?: string[];
|
|
21
|
-
matchingStrategy?: string;
|
|
22
|
-
}
|
|
23
|
-
interface SearchResults {
|
|
24
|
-
hits: unknown[];
|
|
25
|
-
query: string;
|
|
26
|
-
processingTimeMs: number;
|
|
27
|
-
limit: number;
|
|
28
|
-
offset: number;
|
|
29
|
-
estimatedTotalHits: number;
|
|
30
|
-
}
|
|
31
|
-
interface IndexStats {
|
|
32
|
-
numberOfDocuments: number;
|
|
33
|
-
isIndexing: boolean;
|
|
34
|
-
fieldDistribution: Record<string, number>;
|
|
35
|
-
}
|
|
36
|
-
declare class SearchService {
|
|
37
|
-
private host;
|
|
38
|
-
private apiKey;
|
|
39
|
-
private indexName;
|
|
40
|
-
protected client: MeiliSearch;
|
|
41
|
-
protected _index: Index | null;
|
|
42
|
-
protected isInitialized: boolean;
|
|
43
|
-
constructor(indexName?: string);
|
|
44
|
-
/**
|
|
45
|
-
* Get the initialization status
|
|
46
|
-
*/
|
|
47
|
-
getIsInitialized(): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Get the MeiliSearch client
|
|
50
|
-
*/
|
|
51
|
-
getClient(): MeiliSearch;
|
|
52
|
-
get index(): Index | null;
|
|
53
|
-
set index(value: Index | null);
|
|
54
|
-
initialize(): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Configure search index settings for optimal MCP package search
|
|
57
|
-
*/
|
|
58
|
-
configureIndex(): Promise<void>;
|
|
59
|
-
/**
|
|
60
|
-
* Transform package data for search indexing
|
|
61
|
-
*/
|
|
62
|
-
transformPackageForIndex(packageName: string, packageData: PackageData): Record<string, unknown>;
|
|
63
|
-
/**
|
|
64
|
-
* Create a safe ID for MeiliSearch (alphanumeric, hyphens, underscores only)
|
|
65
|
-
*/
|
|
66
|
-
createSafeId(packageName: string): string;
|
|
67
|
-
/**
|
|
68
|
-
* Calculate a popularity score for ranking
|
|
69
|
-
*/
|
|
70
|
-
calculatePopularityScore(packageData: PackageData): number;
|
|
71
|
-
/**
|
|
72
|
-
* Extract author from package name
|
|
73
|
-
*/
|
|
74
|
-
extractAuthor(packageName: string): string;
|
|
75
|
-
/**
|
|
76
|
-
* Extract relevant keywords from package data
|
|
77
|
-
*/
|
|
78
|
-
extractKeywords(packageData: PackageData, packageName: string): string;
|
|
79
|
-
/**
|
|
80
|
-
* Index all packages from the packages-list.json file
|
|
81
|
-
*/
|
|
82
|
-
indexPackages(): Promise<IndexStats>;
|
|
83
|
-
/**
|
|
84
|
-
* Search packages with advanced options
|
|
85
|
-
*/
|
|
86
|
-
search(query: string, options?: SearchOptions): Promise<SearchResults>;
|
|
87
|
-
/**
|
|
88
|
-
* Get search suggestions/autocomplete
|
|
89
|
-
*/
|
|
90
|
-
suggest(query: string, limit?: number): Promise<{
|
|
91
|
-
name: string;
|
|
92
|
-
packageName: string;
|
|
93
|
-
category: string;
|
|
94
|
-
highlighted: string;
|
|
95
|
-
}[]>;
|
|
96
|
-
/**
|
|
97
|
-
* Get faceted search results (for filters)
|
|
98
|
-
*/
|
|
99
|
-
getFacets(): Promise<Record<string, unknown> | undefined>;
|
|
100
|
-
/**
|
|
101
|
-
* Get index statistics
|
|
102
|
-
*/
|
|
103
|
-
getStats(): Promise<IndexStats>;
|
|
104
|
-
/**
|
|
105
|
-
* Clear the index
|
|
106
|
-
*/
|
|
107
|
-
clearIndex(): Promise<void>;
|
|
108
|
-
/**
|
|
109
|
-
* Health check for the search service
|
|
110
|
-
*/
|
|
111
|
-
healthCheck(): Promise<{
|
|
112
|
-
status: string;
|
|
113
|
-
host: string;
|
|
114
|
-
initialized: boolean;
|
|
115
|
-
indexName: string;
|
|
116
|
-
documentCount: number;
|
|
117
|
-
}>;
|
|
118
|
-
}
|
|
119
|
-
declare const searchService: SearchService;
|
|
120
|
-
export default searchService;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from "vitest";
|
|
2
|
-
import searchService from "./search-service";
|
|
3
|
-
// Mock the MeiliSearch client
|
|
4
|
-
vi.mock("meilisearch", () => {
|
|
5
|
-
return {
|
|
6
|
-
MeiliSearch: vi.fn().mockImplementation(() => {
|
|
7
|
-
const mockIndex = {
|
|
8
|
-
updateSettings: vi.fn().mockResolvedValue({ taskUid: "settings-task" }),
|
|
9
|
-
addDocuments: vi.fn().mockResolvedValue({ taskUid: "documents-task" }),
|
|
10
|
-
getStats: vi.fn().mockResolvedValue({
|
|
11
|
-
numberOfDocuments: 100,
|
|
12
|
-
isIndexing: false,
|
|
13
|
-
fieldDistribution: {},
|
|
14
|
-
}),
|
|
15
|
-
search: vi.fn().mockResolvedValue({
|
|
16
|
-
hits: [{ id: "1", name: "Test Package" }],
|
|
17
|
-
query: "test",
|
|
18
|
-
processingTimeMs: 10,
|
|
19
|
-
limit: 20,
|
|
20
|
-
offset: 0,
|
|
21
|
-
estimatedTotalHits: 1,
|
|
22
|
-
}),
|
|
23
|
-
getTask: vi.fn().mockResolvedValue({ status: "succeeded" }),
|
|
24
|
-
deleteAllDocuments: vi.fn().mockResolvedValue({ taskUid: "clear-task" }),
|
|
25
|
-
};
|
|
26
|
-
return {
|
|
27
|
-
health: vi.fn().mockResolvedValue({ status: "available" }),
|
|
28
|
-
createIndex: vi.fn().mockResolvedValue({ uid: "test-task" }),
|
|
29
|
-
getIndex: vi.fn().mockResolvedValue(mockIndex),
|
|
30
|
-
index: vi.fn().mockReturnValue(mockIndex),
|
|
31
|
-
waitForTask: vi.fn().mockResolvedValue({ status: "succeeded" }),
|
|
32
|
-
};
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
// Mock fs module
|
|
37
|
-
vi.mock("node:fs/promises", () => {
|
|
38
|
-
return {
|
|
39
|
-
default: {
|
|
40
|
-
readFile: vi.fn().mockResolvedValue(JSON.stringify({
|
|
41
|
-
"@test/package": {
|
|
42
|
-
name: "Test Package",
|
|
43
|
-
description: "A test package",
|
|
44
|
-
},
|
|
45
|
-
})),
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
describe("SearchService - MCP Registry Search Service Test", () => {
|
|
50
|
-
it("should initialize search service successfully", async () => {
|
|
51
|
-
const result = await searchService.initialize();
|
|
52
|
-
expect(result).toBeUndefined();
|
|
53
|
-
});
|
|
54
|
-
it("should transform package data for indexing", () => {
|
|
55
|
-
const packageName = "@test/package";
|
|
56
|
-
const packageData = {
|
|
57
|
-
name: "Test Package",
|
|
58
|
-
description: "A test package",
|
|
59
|
-
category: "testing",
|
|
60
|
-
validated: true,
|
|
61
|
-
tools: {
|
|
62
|
-
"test-tool": { description: "A test tool" },
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
const result = searchService.transformPackageForIndex(packageName, packageData);
|
|
66
|
-
expect(result).toEqual({
|
|
67
|
-
id: "at-test-package",
|
|
68
|
-
name: "Test Package",
|
|
69
|
-
packageName: "@test/package",
|
|
70
|
-
description: "A test package",
|
|
71
|
-
category: "testing",
|
|
72
|
-
validated: true,
|
|
73
|
-
author: "test",
|
|
74
|
-
tools: "test-tool A test tool",
|
|
75
|
-
toolCount: 1,
|
|
76
|
-
hasTools: true,
|
|
77
|
-
keywords: expect.any(String),
|
|
78
|
-
popularity: expect.any(Number),
|
|
79
|
-
path: "",
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
it("should perform search successfully", async () => {
|
|
83
|
-
// First initialize the service
|
|
84
|
-
await searchService.initialize();
|
|
85
|
-
// Mock the search result
|
|
86
|
-
const mockResult = {
|
|
87
|
-
hits: [{ id: "1", name: "Test Package" }],
|
|
88
|
-
query: "test",
|
|
89
|
-
processingTimeMs: 10,
|
|
90
|
-
limit: 20,
|
|
91
|
-
offset: 0,
|
|
92
|
-
estimatedTotalHits: 1,
|
|
93
|
-
};
|
|
94
|
-
if (searchService.index) {
|
|
95
|
-
searchService.index.search = vi.fn().mockResolvedValue(mockResult);
|
|
96
|
-
}
|
|
97
|
-
const result = await searchService.search("test");
|
|
98
|
-
expect(result).toEqual(mockResult);
|
|
99
|
-
});
|
|
100
|
-
});
|
package/dist/types.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import type { z } from "zod";
|
|
3
|
-
import type { BaseResponseSchema, CategoriesResponseSchema, CategoryConfigSchema, ErrorResponseSchema, ExecuteToolResponseSchema, FeaturedResponseSchema, MCPServerPackageConfigSchema, PackageConfigSchema, PackageDetailDataSchema, PackageDetailResponseSchema, PackagesListResponseSchema, PackagesListSchema, ToolDataSchema, ToolExecuteSchema, ToolsResponseSchema } from "./schema";
|
|
4
|
-
export type MCPServerPackageConfig = z.infer<typeof MCPServerPackageConfigSchema>;
|
|
5
|
-
export type PackageConfig = z.infer<typeof PackageConfigSchema>;
|
|
6
|
-
export type CategoryConfig = z.infer<typeof CategoryConfigSchema>;
|
|
7
|
-
export type PackagesList = z.infer<typeof PackagesListSchema>;
|
|
8
|
-
export type ToolExecute = z.infer<typeof ToolExecuteSchema>;
|
|
9
|
-
export interface Response<T> {
|
|
10
|
-
success: boolean;
|
|
11
|
-
code: number;
|
|
12
|
-
message: string;
|
|
13
|
-
data?: T;
|
|
14
|
-
}
|
|
15
|
-
export type MCPServerPackageConfigWithTools = MCPServerPackageConfig & {
|
|
16
|
-
tools?: Tool[];
|
|
17
|
-
};
|
|
18
|
-
export type BaseResponse = z.infer<typeof BaseResponseSchema>;
|
|
19
|
-
export type FeaturedResponse = z.infer<typeof FeaturedResponseSchema>;
|
|
20
|
-
export type CategoriesResponse = z.infer<typeof CategoriesResponseSchema>;
|
|
21
|
-
export type PackagesListResponse = z.infer<typeof PackagesListResponseSchema>;
|
|
22
|
-
export type PackageDetailData = z.infer<typeof PackageDetailDataSchema>;
|
|
23
|
-
export type PackageDetailResponse = z.infer<typeof PackageDetailResponseSchema>;
|
|
24
|
-
export type ToolData = z.infer<typeof ToolDataSchema>;
|
|
25
|
-
export type ToolsResponse = z.infer<typeof ToolsResponseSchema>;
|
|
26
|
-
export type ExecuteToolResponse = z.infer<typeof ExecuteToolResponseSchema>;
|
|
27
|
-
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|