@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.
Files changed (97) hide show
  1. package/README.md +66 -11
  2. package/dist/api/index.d.ts +1 -1
  3. package/dist/api/index.js +23 -25
  4. package/dist/domains/config/config-route.d.ts +2 -0
  5. package/dist/domains/config/config-route.js +31 -0
  6. package/dist/domains/config/config-schema.d.ts +57 -0
  7. package/dist/domains/config/config-schema.js +10 -0
  8. package/dist/domains/config/config-types.d.ts +3 -0
  9. package/dist/domains/executor/executor-factory.d.ts +9 -0
  10. package/dist/domains/executor/executor-factory.js +17 -0
  11. package/dist/domains/executor/executor-types.d.ts +15 -0
  12. package/dist/domains/executor/local-executor.d.ts +12 -0
  13. package/dist/domains/executor/local-executor.js +48 -0
  14. package/dist/domains/executor/sandbox-executor.d.ts +16 -0
  15. package/dist/domains/executor/sandbox-executor.js +83 -0
  16. package/dist/domains/package/package-handler.d.ts +17 -0
  17. package/dist/domains/package/package-handler.js +58 -0
  18. package/dist/domains/package/package-repository.d.ts +9 -0
  19. package/dist/domains/package/package-repository.js +26 -0
  20. package/dist/domains/package/package-route.d.ts +2 -0
  21. package/dist/{api → domains/package}/package-route.js +38 -52
  22. package/dist/domains/package/package-schema.d.ts +244 -0
  23. package/dist/domains/package/package-schema.js +52 -0
  24. package/dist/domains/package/package-so.d.ts +78 -0
  25. package/dist/domains/package/package-so.js +61 -0
  26. package/dist/domains/package/package-so.test.js +378 -0
  27. package/dist/domains/package/package-types.d.ts +9 -0
  28. package/dist/domains/package/package-types.js +1 -0
  29. package/dist/domains/sandbox/clients/daytona-client.d.ts +17 -0
  30. package/dist/domains/sandbox/clients/daytona-client.js +112 -0
  31. package/dist/domains/sandbox/clients/sandock-client.d.ts +19 -0
  32. package/dist/domains/sandbox/clients/sandock-client.js +178 -0
  33. package/dist/domains/sandbox/sandbox-factory.d.ts +8 -0
  34. package/dist/domains/sandbox/sandbox-factory.js +23 -0
  35. package/dist/domains/sandbox/sandbox-pool-so.d.ts +25 -0
  36. package/dist/domains/sandbox/sandbox-pool-so.js +123 -0
  37. package/dist/domains/sandbox/sandbox-types.d.ts +25 -0
  38. package/dist/domains/sandbox/sandbox-types.js +1 -0
  39. package/dist/domains/sandbox/sandbox-utils.d.ts +3 -0
  40. package/dist/domains/sandbox/sandbox-utils.js +109 -0
  41. package/dist/domains/search/search-handler.d.ts +47 -0
  42. package/dist/domains/search/search-handler.js +113 -0
  43. package/dist/domains/search/search-route.d.ts +2 -0
  44. package/dist/domains/search/search-route.js +101 -0
  45. package/dist/domains/search/search-schema.d.ts +384 -0
  46. package/dist/domains/search/search-schema.js +99 -0
  47. package/dist/domains/search/search-so.d.ts +55 -0
  48. package/dist/{search/search-service.js → domains/search/search-so.js} +200 -297
  49. package/dist/shared/config/environment.d.ts +16 -0
  50. package/dist/shared/config/environment.js +41 -0
  51. package/dist/shared/schemas/common-schema.d.ts +249 -0
  52. package/dist/{schema.js → shared/schemas/common-schema.js} +37 -80
  53. package/dist/shared/schemas/index.d.ts +1 -0
  54. package/dist/shared/schemas/index.js +1 -0
  55. package/dist/shared/scripts-helpers/index.d.ts +60 -0
  56. package/dist/shared/scripts-helpers/index.js +61 -0
  57. package/dist/shared/utils/file-util.d.ts +1 -0
  58. package/dist/shared/utils/file-util.js +5 -0
  59. package/dist/shared/utils/index.d.ts +5 -0
  60. package/dist/shared/utils/index.js +5 -0
  61. package/dist/shared/utils/mcp-client-util.d.ts +31 -0
  62. package/dist/shared/utils/mcp-client-util.js +79 -0
  63. package/dist/shared/utils/package-util.d.ts +6 -0
  64. package/dist/shared/utils/package-util.js +53 -0
  65. package/dist/shared/utils/promise-util.d.ts +1 -0
  66. package/dist/shared/utils/promise-util.js +14 -0
  67. package/dist/{utils.d.ts → shared/utils/response-util.d.ts} +6 -2
  68. package/dist/{utils.js → shared/utils/response-util.js} +1 -6
  69. package/dist/shared/utils/string-util.d.ts +1 -0
  70. package/dist/shared/utils/string-util.js +25 -0
  71. package/dist/shared/utils/validation-util.d.ts +12 -0
  72. package/dist/shared/utils/validation-util.js +99 -0
  73. package/indexes/categories-list.json +1 -0
  74. package/indexes/packages-list.json +6 -0
  75. package/package.json +9 -2
  76. package/packages/developer-tools/neurolink.json +23 -0
  77. package/packages/search-data-extraction/ref-tools-mcp.json +7 -2
  78. package/README.dev.md +0 -195
  79. package/dist/api/package-handler.d.ts +0 -18
  80. package/dist/api/package-handler.js +0 -72
  81. package/dist/api/package-route.d.ts +0 -2
  82. package/dist/api/package-so.d.ts +0 -19
  83. package/dist/api/package-so.js +0 -263
  84. package/dist/api/package.test.js +0 -19
  85. package/dist/helper.d.ts +0 -72
  86. package/dist/helper.js +0 -278
  87. package/dist/sandbox/mcp-sandbox-client.d.ts +0 -37
  88. package/dist/sandbox/mcp-sandbox-client.js +0 -428
  89. package/dist/schema.d.ts +0 -806
  90. package/dist/search/search-route.d.ts +0 -3
  91. package/dist/search/search-route.js +0 -305
  92. package/dist/search/search-service.d.ts +0 -120
  93. package/dist/search/search.test.js +0 -100
  94. package/dist/types.d.ts +0 -27
  95. /package/dist/{api/package.test.d.ts → domains/config/config-types.js} +0 -0
  96. /package/dist/{search/search.test.d.ts → domains/executor/executor-types.js} +0 -0
  97. /package/dist/{types.js → domains/package/package-so.test.d.ts} +0 -0
@@ -0,0 +1,249 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ export declare const BaseResponseSchema: z.ZodObject<{
3
+ success: z.ZodBoolean;
4
+ code: z.ZodNumber;
5
+ message: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ success: boolean;
8
+ code: number;
9
+ message: string;
10
+ }, {
11
+ success: boolean;
12
+ code: number;
13
+ message: string;
14
+ }>;
15
+ export declare const ErrorResponseSchema: z.ZodObject<{
16
+ code: z.ZodNumber;
17
+ message: z.ZodString;
18
+ } & {
19
+ success: z.ZodLiteral<false>;
20
+ data: z.ZodOptional<z.ZodNull>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ success: false;
23
+ code: number;
24
+ message: string;
25
+ data?: null | undefined;
26
+ }, {
27
+ success: false;
28
+ code: number;
29
+ message: string;
30
+ data?: null | undefined;
31
+ }>;
32
+ export declare const createSuccessResponseSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
33
+ code: z.ZodNumber;
34
+ message: z.ZodString;
35
+ } & {
36
+ success: z.ZodLiteral<true>;
37
+ data: z.ZodOptional<T>;
38
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
39
+ code: z.ZodNumber;
40
+ message: z.ZodString;
41
+ } & {
42
+ success: z.ZodLiteral<true>;
43
+ data: z.ZodOptional<T>;
44
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
45
+ code: z.ZodNumber;
46
+ message: z.ZodString;
47
+ } & {
48
+ success: z.ZodLiteral<true>;
49
+ data: z.ZodOptional<T>;
50
+ }>, any>[k]; } : never, z.baseObjectInputType<{
51
+ code: z.ZodNumber;
52
+ message: z.ZodString;
53
+ } & {
54
+ success: z.ZodLiteral<true>;
55
+ data: z.ZodOptional<T>;
56
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
57
+ code: z.ZodNumber;
58
+ message: z.ZodString;
59
+ } & {
60
+ success: z.ZodLiteral<true>;
61
+ data: z.ZodOptional<T>;
62
+ }>[k_1]; } : never>;
63
+ export declare const PackageKeySchema: z.ZodString;
64
+ export declare const CategoryConfigSchema: z.ZodObject<{
65
+ key: z.ZodString;
66
+ name: z.ZodString;
67
+ description: z.ZodOptional<z.ZodString>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ name: string;
70
+ key: string;
71
+ description?: string | undefined;
72
+ }, {
73
+ name: string;
74
+ key: string;
75
+ description?: string | undefined;
76
+ }>;
77
+ export declare const HostingBlackListSchema: z.ZodArray<z.ZodString, "many">;
78
+ export declare const FeaturedListSchema: z.ZodArray<z.ZodString, "many">;
79
+ export declare const MCPServerPackageConfigSchema: z.ZodObject<{
80
+ type: z.ZodLiteral<"mcp-server">;
81
+ runtime: z.ZodEnum<["node", "python", "java", "go"]>;
82
+ packageName: z.ZodString;
83
+ packageVersion: z.ZodOptional<z.ZodString>;
84
+ bin: z.ZodOptional<z.ZodString>;
85
+ binArgs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
86
+ key: z.ZodOptional<z.ZodString>;
87
+ name: z.ZodOptional<z.ZodString>;
88
+ description: z.ZodOptional<z.ZodString>;
89
+ readme: z.ZodOptional<z.ZodString>;
90
+ url: z.ZodOptional<z.ZodString>;
91
+ license: z.ZodOptional<z.ZodString>;
92
+ logo: z.ZodOptional<z.ZodString>;
93
+ author: z.ZodOptional<z.ZodString>;
94
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
95
+ description: z.ZodString;
96
+ required: z.ZodBoolean;
97
+ }, "strip", z.ZodTypeAny, {
98
+ description: string;
99
+ required: boolean;
100
+ }, {
101
+ description: string;
102
+ required: boolean;
103
+ }>>>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ type: "mcp-server";
106
+ runtime: "node" | "python" | "java" | "go";
107
+ packageName: string;
108
+ description?: string | undefined;
109
+ name?: string | undefined;
110
+ key?: string | undefined;
111
+ packageVersion?: string | undefined;
112
+ bin?: string | undefined;
113
+ binArgs?: string[] | undefined;
114
+ readme?: string | undefined;
115
+ url?: string | undefined;
116
+ license?: string | undefined;
117
+ logo?: string | undefined;
118
+ author?: string | undefined;
119
+ env?: Record<string, {
120
+ description: string;
121
+ required: boolean;
122
+ }> | undefined;
123
+ }, {
124
+ type: "mcp-server";
125
+ runtime: "node" | "python" | "java" | "go";
126
+ packageName: string;
127
+ description?: string | undefined;
128
+ name?: string | undefined;
129
+ key?: string | undefined;
130
+ packageVersion?: string | undefined;
131
+ bin?: string | undefined;
132
+ binArgs?: string[] | undefined;
133
+ readme?: string | undefined;
134
+ url?: string | undefined;
135
+ license?: string | undefined;
136
+ logo?: string | undefined;
137
+ author?: string | undefined;
138
+ env?: Record<string, {
139
+ description: string;
140
+ required: boolean;
141
+ }> | undefined;
142
+ }>;
143
+ export declare const PackageConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
144
+ type: z.ZodLiteral<"mcp-server">;
145
+ runtime: z.ZodEnum<["node", "python", "java", "go"]>;
146
+ packageName: z.ZodString;
147
+ packageVersion: z.ZodOptional<z.ZodString>;
148
+ bin: z.ZodOptional<z.ZodString>;
149
+ binArgs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
150
+ key: z.ZodOptional<z.ZodString>;
151
+ name: z.ZodOptional<z.ZodString>;
152
+ description: z.ZodOptional<z.ZodString>;
153
+ readme: z.ZodOptional<z.ZodString>;
154
+ url: z.ZodOptional<z.ZodString>;
155
+ license: z.ZodOptional<z.ZodString>;
156
+ logo: z.ZodOptional<z.ZodString>;
157
+ author: z.ZodOptional<z.ZodString>;
158
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
159
+ description: z.ZodString;
160
+ required: z.ZodBoolean;
161
+ }, "strip", z.ZodTypeAny, {
162
+ description: string;
163
+ required: boolean;
164
+ }, {
165
+ description: string;
166
+ required: boolean;
167
+ }>>>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ type: "mcp-server";
170
+ runtime: "node" | "python" | "java" | "go";
171
+ packageName: string;
172
+ description?: string | undefined;
173
+ name?: string | undefined;
174
+ key?: string | undefined;
175
+ packageVersion?: string | undefined;
176
+ bin?: string | undefined;
177
+ binArgs?: string[] | undefined;
178
+ readme?: string | undefined;
179
+ url?: string | undefined;
180
+ license?: string | undefined;
181
+ logo?: string | undefined;
182
+ author?: string | undefined;
183
+ env?: Record<string, {
184
+ description: string;
185
+ required: boolean;
186
+ }> | undefined;
187
+ }, {
188
+ type: "mcp-server";
189
+ runtime: "node" | "python" | "java" | "go";
190
+ packageName: string;
191
+ description?: string | undefined;
192
+ name?: string | undefined;
193
+ key?: string | undefined;
194
+ packageVersion?: string | undefined;
195
+ bin?: string | undefined;
196
+ binArgs?: string[] | undefined;
197
+ readme?: string | undefined;
198
+ url?: string | undefined;
199
+ license?: string | undefined;
200
+ logo?: string | undefined;
201
+ author?: string | undefined;
202
+ env?: Record<string, {
203
+ description: string;
204
+ required: boolean;
205
+ }> | undefined;
206
+ }>, z.ZodObject<{
207
+ type: z.ZodLiteral<"toolapp">;
208
+ packageName: z.ZodString;
209
+ url: z.ZodOptional<z.ZodString>;
210
+ }, "strip", z.ZodTypeAny, {
211
+ type: "toolapp";
212
+ packageName: string;
213
+ url?: string | undefined;
214
+ }, {
215
+ type: "toolapp";
216
+ packageName: string;
217
+ url?: string | undefined;
218
+ }>]>;
219
+ export declare const PackagesListSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
220
+ category: z.ZodOptional<z.ZodString>;
221
+ path: z.ZodString;
222
+ validated: z.ZodOptional<z.ZodBoolean>;
223
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
224
+ name: z.ZodOptional<z.ZodString>;
225
+ description: z.ZodOptional<z.ZodString>;
226
+ }, "strip", z.ZodTypeAny, {
227
+ description?: string | undefined;
228
+ name?: string | undefined;
229
+ }, {
230
+ description?: string | undefined;
231
+ name?: string | undefined;
232
+ }>>>;
233
+ }, "strip", z.ZodTypeAny, {
234
+ path: string;
235
+ category?: string | undefined;
236
+ validated?: boolean | undefined;
237
+ tools?: Record<string, {
238
+ description?: string | undefined;
239
+ name?: string | undefined;
240
+ }> | undefined;
241
+ }, {
242
+ path: string;
243
+ category?: string | undefined;
244
+ validated?: boolean | undefined;
245
+ tools?: Record<string, {
246
+ description?: string | undefined;
247
+ name?: string | undefined;
248
+ }> | undefined;
249
+ }>>;
@@ -1,22 +1,36 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- export const PackageKeySchema = z.string();
3
- export const HostingBlackListSchema = z.array(PackageKeySchema);
4
- export const FeaturedListSchema = z.array(PackageKeySchema);
5
- export const ToolExecuteSchema = z.object({
6
- packageName: z.string(),
7
- toolKey: z.string(),
8
- inputData: z.record(z.unknown()),
9
- envs: z.record(z.string()).optional(),
2
+ export const BaseResponseSchema = z.object({
3
+ success: z.boolean(),
4
+ code: z.number(),
5
+ message: z.string(),
10
6
  });
11
- export const CategoryConfigSchema = z.object({
7
+ export const ErrorResponseSchema = BaseResponseSchema.extend({
8
+ success: z.literal(false),
9
+ data: z.null().optional().openapi({
10
+ description: "No data for error responses",
11
+ }),
12
+ }).openapi("ErrorResponse");
13
+ export const createSuccessResponseSchema = (dataSchema) => {
14
+ return BaseResponseSchema.extend({
15
+ success: z.literal(true),
16
+ data: dataSchema.optional(),
17
+ });
18
+ };
19
+ export const PackageKeySchema = z.string();
20
+ export const CategoryConfigSchema = z
21
+ .object({
12
22
  key: z.string(),
13
23
  name: z.string(),
14
24
  description: z.string().optional(),
15
- });
16
- export const MCPServerPackageConfigSchema = z.object({
25
+ })
26
+ .openapi("CategoryConfig");
27
+ export const HostingBlackListSchema = z.array(PackageKeySchema);
28
+ export const FeaturedListSchema = z.array(PackageKeySchema);
29
+ export const MCPServerPackageConfigSchema = z
30
+ .object({
17
31
  type: z.literal("mcp-server"),
18
32
  runtime: z.enum(["node", "python", "java", "go"]),
19
- packageName: z.string().describe("Name of the node, python, java package "),
33
+ packageName: z.string().describe("Name of the node, python, java package"),
20
34
  packageVersion: z
21
35
  .string()
22
36
  .optional()
@@ -41,7 +55,7 @@ export const MCPServerPackageConfigSchema = z.object({
41
55
  .optional()
42
56
  .describe("URL to the README file, if not provided then it will use the package URL"),
43
57
  url: z.string().optional(),
44
- license: z.string().optional().describe("Open source license lie MIT, AGPL, GPL, etc"),
58
+ license: z.string().optional().describe("Open source license like MIT, AGPL, GPL, etc"),
45
59
  logo: z
46
60
  .string()
47
61
  .optional()
@@ -53,16 +67,20 @@ export const MCPServerPackageConfigSchema = z.object({
53
67
  required: z.boolean(),
54
68
  }))
55
69
  .optional(),
56
- });
57
- export const PackageConfigSchema = z.discriminatedUnion("type", [
70
+ })
71
+ .openapi("MCPServerPackageConfig");
72
+ export const PackageConfigSchema = z
73
+ .discriminatedUnion("type", [
58
74
  MCPServerPackageConfigSchema,
59
75
  z.object({
60
76
  type: z.literal("toolapp"),
61
77
  packageName: z.string(),
62
78
  url: z.string().optional(),
63
79
  }),
64
- ]);
65
- export const PackagesListSchema = z.record(z.object({
80
+ ])
81
+ .openapi("PackageConfig");
82
+ export const PackagesListSchema = z
83
+ .record(z.object({
66
84
  category: z.string().optional(),
67
85
  path: z.string(),
68
86
  validated: z.boolean().optional(),
@@ -72,66 +90,5 @@ export const PackagesListSchema = z.record(z.object({
72
90
  description: z.string().optional(),
73
91
  }))
74
92
  .optional(),
75
- }));
76
- export const BaseResponseSchema = z.object({
77
- success: z.boolean(),
78
- code: z.number(),
79
- message: z.string(),
80
- });
81
- export const ErrorResponseSchema = BaseResponseSchema.omit({
82
- success: true,
83
- }).extend({
84
- success: z.literal(false),
85
- });
86
- export const FeaturedResponseSchema = BaseResponseSchema.extend({
87
- data: z.array(z.string()).optional(),
88
- });
89
- export const CategoriesResponseSchema = BaseResponseSchema.extend({
90
- data: z.array(CategoryConfigSchema).optional(),
91
- });
92
- export const PackagesListResponseSchema = BaseResponseSchema.extend({
93
- data: PackagesListSchema.optional(),
94
- });
95
- export const PackageDetailDataSchema = MCPServerPackageConfigSchema.extend({
96
- tools: z
97
- .array(z.object({
98
- name: z.string(),
99
- description: z.string().optional(),
100
- inputSchema: z
101
- .object({
102
- type: z.string(),
103
- properties: z.record(z.unknown()).optional(),
104
- required: z.array(z.string()).optional(),
105
- })
106
- .optional(),
107
- }))
108
- .optional(),
109
- });
110
- export const PackageDetailResponseSchema = BaseResponseSchema.extend({
111
- data: PackageDetailDataSchema.optional(),
112
- });
113
- export const ToolDataSchema = z.object({
114
- name: z.string(),
115
- description: z.string().optional(),
116
- inputSchema: z
117
- .object({
118
- type: z.string(),
119
- properties: z.record(z.unknown()).optional(),
120
- required: z.array(z.string()).optional(),
121
- })
122
- .optional(),
123
- });
124
- export const ToolsResponseSchema = BaseResponseSchema.extend({
125
- data: z.array(ToolDataSchema).optional(),
126
- });
127
- export const ExecuteToolResponseSchema = BaseResponseSchema.extend({
128
- data: z.unknown().optional(),
129
- });
130
- export const createSuccessResponseSchema = (dataSchema) => {
131
- return BaseResponseSchema.extend({
132
- data: dataSchema.optional(),
133
- });
134
- };
135
- export const packageNameQuerySchema = z.object({
136
- packageName: z.string().optional(),
137
- });
93
+ }))
94
+ .openapi("PackagesList");
@@ -0,0 +1 @@
1
+ export * from "./common-schema";
@@ -0,0 +1 @@
1
+ export * from "./common-schema";
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Scripts Helper Module
3
+ *
4
+ * This module provides unified helper functions, types, and constant exports for scripts in the scripts/ directory.
5
+ * It serves as a bridge between src/ and scripts/, maintaining clear boundaries.
6
+ */
7
+ /**
8
+ * Path to the packages directory
9
+ */
10
+ export declare const PACKAGES_DIR_PATH: string;
11
+ export type { CategoryConfig } from "../../domains/config/config-types";
12
+ export type { MCPServerPackageConfig, PackageConfig, PackagesList, } from "../../domains/package/package-types";
13
+ export { CategoryConfigSchema, MCPServerPackageConfigSchema, PackagesListSchema, } from "../schemas/common-schema";
14
+ export { getDirname } from "../utils/file-util";
15
+ export { getMcpClient } from "../utils/mcp-client-util";
16
+ export { getActualVersion, updatePackageJsonDependencies, } from "../utils/package-util";
17
+ export { withTimeout } from "../utils/promise-util";
18
+ export { extractPackageName, getPythonDependencies, isValidNpmPackage, parsePyprojectToml, } from "../utils/validation-util";
19
+ /**
20
+ * Get package configuration by package key
21
+ *
22
+ * @param key - Package key to look up
23
+ * @returns Package configuration object
24
+ */
25
+ export declare function getPackageConfigByKey(key: string): {
26
+ type: "mcp-server";
27
+ runtime: "node" | "python" | "java" | "go";
28
+ packageName: string;
29
+ description?: string | undefined;
30
+ name?: string | undefined;
31
+ key?: string | undefined;
32
+ packageVersion?: string | undefined;
33
+ bin?: string | undefined;
34
+ binArgs?: string[] | undefined;
35
+ readme?: string | undefined;
36
+ url?: string | undefined;
37
+ license?: string | undefined;
38
+ logo?: string | undefined;
39
+ author?: string | undefined;
40
+ env?: Record<string, {
41
+ description: string;
42
+ required: boolean;
43
+ }> | undefined;
44
+ };
45
+ /**
46
+ * Get list of all packages
47
+ * Note: This function reads from the file system each time it's called.
48
+ * If you need to iterate and modify the list, consider using a local variable.
49
+ *
50
+ * @returns Object containing all packages indexed by their keys
51
+ */
52
+ export declare function getAllPackages(): Record<string, {
53
+ path: string;
54
+ category?: string | undefined;
55
+ validated?: boolean | undefined;
56
+ tools?: Record<string, {
57
+ description?: string | undefined;
58
+ name?: string | undefined;
59
+ }> | undefined;
60
+ }>;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Scripts Helper Module
3
+ *
4
+ * This module provides unified helper functions, types, and constant exports for scripts in the scripts/ directory.
5
+ * It serves as a bridge between src/ and scripts/, maintaining clear boundaries.
6
+ */
7
+ import path from "node:path";
8
+ import { PackageRepository } from "../../domains/package/package-repository";
9
+ // ==================== Constants ====================
10
+ /**
11
+ * Path to the packages directory
12
+ */
13
+ export const PACKAGES_DIR_PATH = path.resolve(process.cwd(), "./packages");
14
+ // ==================== Re-export Schemas ====================
15
+ export { CategoryConfigSchema, MCPServerPackageConfigSchema, PackagesListSchema, } from "../schemas/common-schema";
16
+ // ==================== Re-export Utils ====================
17
+ // File utilities
18
+ export { getDirname } from "../utils/file-util";
19
+ // MCP client utilities
20
+ export { getMcpClient } from "../utils/mcp-client-util";
21
+ // Package utilities
22
+ export { getActualVersion, updatePackageJsonDependencies, } from "../utils/package-util";
23
+ // Promise utilities
24
+ export { withTimeout } from "../utils/promise-util";
25
+ // Validation utilities
26
+ export { extractPackageName, getPythonDependencies, isValidNpmPackage, parsePyprojectToml, } from "../utils/validation-util";
27
+ // ==================== PackageRepository Instance ====================
28
+ /**
29
+ * Singleton PackageRepository instance for scripts to use
30
+ * Lazily initialized on first access to avoid side effects during module loading
31
+ */
32
+ let packageRepositoryInstance = null;
33
+ /**
34
+ * Get the singleton PackageRepository instance
35
+ */
36
+ function getPackageRepository() {
37
+ if (!packageRepositoryInstance) {
38
+ packageRepositoryInstance = new PackageRepository(PACKAGES_DIR_PATH);
39
+ }
40
+ return packageRepositoryInstance;
41
+ }
42
+ // ==================== Package Access Functions ====================
43
+ /**
44
+ * Get package configuration by package key
45
+ *
46
+ * @param key - Package key to look up
47
+ * @returns Package configuration object
48
+ */
49
+ export function getPackageConfigByKey(key) {
50
+ return getPackageRepository().getPackageConfig(key);
51
+ }
52
+ /**
53
+ * Get list of all packages
54
+ * Note: This function reads from the file system each time it's called.
55
+ * If you need to iterate and modify the list, consider using a local variable.
56
+ *
57
+ * @returns Object containing all packages indexed by their keys
58
+ */
59
+ export function getAllPackages() {
60
+ return getPackageRepository().getAllPackages();
61
+ }
@@ -0,0 +1 @@
1
+ export declare function getDirname(metaUrl: string): string;
@@ -0,0 +1,5 @@
1
+ import { dirname } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ export function getDirname(metaUrl) {
4
+ return dirname(fileURLToPath(metaUrl));
5
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./file-util";
2
+ export * from "./mcp-client-util";
3
+ export * from "./response-util";
4
+ export * from "./string-util";
5
+ export * from "./validation-util";
@@ -0,0 +1,5 @@
1
+ export * from "./file-util";
2
+ export * from "./mcp-client-util";
3
+ export * from "./response-util";
4
+ export * from "./string-util";
5
+ export * from "./validation-util";
@@ -0,0 +1,31 @@
1
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
+ import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
3
+ import type { MCPServerPackageConfig } from "../../domains/package/package-types";
4
+ export declare function getPackageJSON(packageName: string): any;
5
+ export declare function getMcpClient(mcpServerConfig: MCPServerPackageConfig, env?: Record<string, string>): Promise<{
6
+ client: Client<{
7
+ method: string;
8
+ params?: {
9
+ [x: string]: unknown;
10
+ _meta?: {
11
+ [x: string]: unknown;
12
+ progressToken?: string | number | undefined;
13
+ } | undefined;
14
+ } | undefined;
15
+ }, {
16
+ method: string;
17
+ params?: {
18
+ [x: string]: unknown;
19
+ _meta?: {
20
+ [x: string]: unknown;
21
+ } | undefined;
22
+ } | undefined;
23
+ }, {
24
+ [x: string]: unknown;
25
+ _meta?: {
26
+ [x: string]: unknown;
27
+ } | undefined;
28
+ }>;
29
+ transport: StdioClientTransport;
30
+ closeConnection: () => Promise<void>;
31
+ }>;
@@ -0,0 +1,79 @@
1
+ import assert from "node:assert";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
5
+ import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
6
+ import { getDirname } from "./file-util";
7
+ const __dirname = getDirname(import.meta.url);
8
+ export function getPackageJSON(packageName) {
9
+ const packageJSONFilePath = path.join(__dirname, "../../../node_modules", packageName, "package.json");
10
+ if (!fs.existsSync(packageJSONFilePath)) {
11
+ throw new Error(`Package '${packageName}' not found in node_modules. Install it first with: pnpm add ${packageName}`);
12
+ }
13
+ const packageJSONStr = fs.readFileSync(packageJSONFilePath, "utf8");
14
+ const packageJSON = JSON.parse(packageJSONStr);
15
+ return packageJSON;
16
+ }
17
+ async function createMcpClient(mcpServerConfig, transport) {
18
+ const { packageName, name } = mcpServerConfig;
19
+ const client = new Client({
20
+ name: `mcp-server-${name}-client`,
21
+ version: "1.0.0",
22
+ }, {
23
+ capabilities: {
24
+ tools: {},
25
+ },
26
+ });
27
+ await client.connect(transport);
28
+ const closeConnection = async () => {
29
+ try {
30
+ await client.close();
31
+ }
32
+ catch (e) {
33
+ console.warn(`${packageName} mcp client close failure.`, e);
34
+ }
35
+ };
36
+ return { client, transport, closeConnection };
37
+ }
38
+ async function getNodeMcpClient(mcpServerConfig, env) {
39
+ const { packageName } = mcpServerConfig;
40
+ const packageJSON = getPackageJSON(packageName);
41
+ let binFilePath = "";
42
+ let binPath;
43
+ if (typeof packageJSON.bin === "string") {
44
+ binPath = packageJSON.bin;
45
+ }
46
+ else if (typeof packageJSON.bin === "object") {
47
+ binPath = Object.values(packageJSON.bin)[0];
48
+ }
49
+ else {
50
+ binPath = packageJSON.main;
51
+ }
52
+ assert(binPath, `Package ${packageName} does not have a valid bin path in package.json.`);
53
+ binFilePath = path.join(__dirname, "../../../node_modules", packageName, binPath);
54
+ const mcpServerBinPath = mcpServerConfig.bin || binFilePath;
55
+ const binArgs = mcpServerConfig.binArgs || [];
56
+ const transport = new StdioClientTransport({
57
+ args: [mcpServerBinPath, ...binArgs],
58
+ command: process.execPath,
59
+ env: env || {},
60
+ });
61
+ return createMcpClient(mcpServerConfig, transport);
62
+ }
63
+ async function getPyMcpClient(mcpServerConfig, env) {
64
+ const { packageName } = mcpServerConfig;
65
+ const pythonModuleName = packageName;
66
+ const transport = new StdioClientTransport({
67
+ command: "uv",
68
+ args: ["run", "--directory", "./python-mcp", pythonModuleName],
69
+ env: Object.assign(Object.assign({}, Object.fromEntries(Object.entries(process.env).filter(([_, v]) => v !== undefined))), env),
70
+ });
71
+ return createMcpClient(mcpServerConfig, transport);
72
+ }
73
+ export async function getMcpClient(mcpServerConfig, env) {
74
+ const { runtime } = mcpServerConfig;
75
+ if (runtime === "python") {
76
+ return getPyMcpClient(mcpServerConfig, env);
77
+ }
78
+ return getNodeMcpClient(mcpServerConfig, env);
79
+ }
@@ -0,0 +1,6 @@
1
+ export declare function updatePackageJsonDependencies({ packageDeps, enableValidation, packagesListPath, }: {
2
+ packageDeps: Record<string, string>;
3
+ enableValidation?: boolean;
4
+ packagesListPath?: string;
5
+ }): void;
6
+ export declare function getActualVersion(packageName: string, configuredVersion?: string): string;