@toolsdk.ai/registry 1.0.114 → 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/sandbox/clients/daytona-client.d.ts +17 -0
  29. package/dist/domains/sandbox/clients/daytona-client.js +112 -0
  30. package/dist/domains/sandbox/clients/sandock-client.d.ts +19 -0
  31. package/dist/domains/sandbox/clients/sandock-client.js +178 -0
  32. package/dist/domains/sandbox/sandbox-factory.d.ts +8 -0
  33. package/dist/domains/sandbox/sandbox-factory.js +23 -0
  34. package/dist/domains/sandbox/sandbox-pool-so.d.ts +25 -0
  35. package/dist/domains/sandbox/sandbox-pool-so.js +123 -0
  36. package/dist/domains/sandbox/sandbox-types.d.ts +25 -0
  37. package/dist/domains/sandbox/sandbox-types.js +1 -0
  38. package/dist/domains/sandbox/sandbox-utils.d.ts +3 -0
  39. package/dist/domains/sandbox/sandbox-utils.js +109 -0
  40. package/dist/domains/search/search-handler.d.ts +47 -0
  41. package/dist/domains/search/search-handler.js +113 -0
  42. package/dist/domains/search/search-route.d.ts +2 -0
  43. package/dist/domains/search/search-route.js +101 -0
  44. package/dist/domains/search/search-schema.d.ts +384 -0
  45. package/dist/domains/search/search-schema.js +99 -0
  46. package/dist/domains/search/search-so.d.ts +55 -0
  47. package/dist/{search/search-service.js → domains/search/search-so.js} +200 -297
  48. package/dist/shared/config/environment.d.ts +16 -0
  49. package/dist/shared/config/environment.js +41 -0
  50. package/dist/shared/schemas/common-schema.d.ts +249 -0
  51. package/dist/{schema.js → shared/schemas/common-schema.js} +37 -80
  52. package/dist/shared/schemas/index.d.ts +1 -0
  53. package/dist/shared/schemas/index.js +1 -0
  54. package/dist/shared/scripts-helpers/index.d.ts +60 -0
  55. package/dist/shared/scripts-helpers/index.js +61 -0
  56. package/dist/shared/utils/file-util.d.ts +1 -0
  57. package/dist/shared/utils/file-util.js +5 -0
  58. package/dist/shared/utils/index.d.ts +5 -0
  59. package/dist/shared/utils/index.js +5 -0
  60. package/dist/shared/utils/mcp-client-util.d.ts +31 -0
  61. package/dist/shared/utils/mcp-client-util.js +79 -0
  62. package/dist/shared/utils/package-util.d.ts +6 -0
  63. package/dist/shared/utils/package-util.js +53 -0
  64. package/dist/shared/utils/promise-util.d.ts +1 -0
  65. package/dist/shared/utils/promise-util.js +14 -0
  66. package/dist/{utils.d.ts → shared/utils/response-util.d.ts} +6 -2
  67. package/dist/{utils.js → shared/utils/response-util.js} +1 -6
  68. package/dist/shared/utils/string-util.d.ts +1 -0
  69. package/dist/shared/utils/string-util.js +25 -0
  70. package/dist/shared/utils/validation-util.d.ts +12 -0
  71. package/dist/shared/utils/validation-util.js +99 -0
  72. package/indexes/categories-list.json +1 -0
  73. package/indexes/packages-list.json +6 -0
  74. package/package.json +8 -2
  75. package/packages/developer-tools/neurolink.json +23 -0
  76. package/README.dev.md +0 -195
  77. package/dist/api/package-handler.d.ts +0 -18
  78. package/dist/api/package-handler.js +0 -73
  79. package/dist/api/package-route.d.ts +0 -2
  80. package/dist/api/package-so.d.ts +0 -19
  81. package/dist/api/package-so.js +0 -223
  82. package/dist/api/package.test.js +0 -19
  83. package/dist/helper.d.ts +0 -74
  84. package/dist/helper.js +0 -312
  85. package/dist/sandbox/mcp-sandbox-client.d.ts +0 -16
  86. package/dist/sandbox/mcp-sandbox-client.js +0 -229
  87. package/dist/sandbox/mcp-sandbox-client.test.js +0 -491
  88. package/dist/schema.d.ts +0 -806
  89. package/dist/search/search-route.d.ts +0 -3
  90. package/dist/search/search-route.js +0 -305
  91. package/dist/search/search-service.d.ts +0 -120
  92. package/dist/search/search.test.js +0 -100
  93. package/dist/types.d.ts +0 -28
  94. /package/dist/{api/package.test.d.ts → domains/config/config-types.js} +0 -0
  95. /package/dist/{sandbox/mcp-sandbox-client.test.d.ts → domains/executor/executor-types.js} +0 -0
  96. /package/dist/{search/search.test.d.ts → domains/package/package-so.test.d.ts} +0 -0
  97. /package/dist/{types.js → domains/package/package-types.js} +0 -0
@@ -1,229 +0,0 @@
1
- import { Daytona, Image } from "@daytonaio/sdk";
2
- import { extractLastOuterJSON, getPackageConfigByKey } from "../helper";
3
- export class MCPSandboxClient {
4
- constructor(runtime = "node", provider = "DAYTONA") {
5
- this.sandbox = null;
6
- this.initializing = null;
7
- this.runtime = "node";
8
- this.apiKey = process.env.DAYTONA_API_KEY || "daytona-api-key-placeholder";
9
- this.runtime = runtime;
10
- this.provider = provider;
11
- }
12
- // Safe initialize: ensures concurrent calls don't create duplicate sandboxes
13
- async initialize() {
14
- if (this.sandbox) {
15
- return;
16
- }
17
- if (this.initializing) {
18
- // Wait for existing initialization to complete
19
- await this.initializing;
20
- return;
21
- }
22
- this.initializing = (async () => {
23
- try {
24
- const daytonaConfig = {
25
- apiKey: this.apiKey,
26
- };
27
- if (this.provider === "SANDOCK") {
28
- daytonaConfig.apiUrl = process.env.SANDOCK_DAYTONA_API_URL || process.env.DAYTONA_API_URL;
29
- if (!daytonaConfig.apiUrl) {
30
- console.warn("[MCPSandboxClient] SANDOCK provider selected but SANDOCK_DAYTONA_API_URL is not set. Falling back to default Daytona API URL.");
31
- }
32
- }
33
- const daytona = new Daytona(daytonaConfig);
34
- // Create image with required dependencies
35
- const declarativeImage = Image.base("node:20")
36
- .runCommands("npm install -g pnpm", "mkdir -p /workspace", "cd /workspace && npm init -y", "cd /workspace && pnpm add @modelcontextprotocol/sdk")
37
- .workdir("/workspace");
38
- // const pnpmStoreVolume = await daytona.volume.get("pnpm-store-shared", true);
39
- this.sandbox = await daytona.create({
40
- language: "javascript",
41
- image: declarativeImage,
42
- // volumes: [
43
- // {
44
- // volumeId: pnpmStoreVolume.id,
45
- // mountPath: "/pnpm-store",
46
- // },
47
- // ],
48
- });
49
- console.log("[MCPSandboxClient] Daytona Sandbox created successfully");
50
- }
51
- finally {
52
- this.initializing = null;
53
- }
54
- })();
55
- await this.initializing;
56
- }
57
- // Force close and cleanup
58
- async kill() {
59
- try {
60
- if (this.sandbox) {
61
- await this.sandbox.delete();
62
- }
63
- }
64
- catch (err) {
65
- console.log(err.message);
66
- }
67
- finally {
68
- this.sandbox = null;
69
- // clear cache
70
- // this.toolCache.clear();
71
- }
72
- }
73
- async listTools(packageKey) {
74
- if (!this.sandbox) {
75
- throw new Error("Sandbox not initialized. Call initialize() first.");
76
- }
77
- const mcpServerConfig = await getPackageConfigByKey(packageKey);
78
- const testCode = this.generateMCPTestCode(mcpServerConfig, "listTools");
79
- try {
80
- const response = await this.sandbox.process.codeRun(testCode);
81
- if (response.exitCode !== 0) {
82
- throw new Error(`Failed to list tools: ${response.result}`);
83
- }
84
- const parsedResultStr = extractLastOuterJSON(response.result);
85
- const result = JSON.parse(parsedResultStr);
86
- return result.tools;
87
- }
88
- catch (err) {
89
- console.error("[MCPSandboxClient] Error listing tools:", err);
90
- throw err;
91
- }
92
- }
93
- async executeTool(packageKey, toolName, argumentsObj, envs) {
94
- if (!this.sandbox) {
95
- throw new Error("Sandbox not initialized. Call initialize() first.");
96
- }
97
- const mcpServerConfig = await getPackageConfigByKey(packageKey);
98
- const testCode = this.generateMCPTestCode(mcpServerConfig, "executeTool", toolName, argumentsObj, envs);
99
- try {
100
- const response = await this.sandbox.process.codeRun(testCode);
101
- if (response.exitCode !== 0) {
102
- throw new Error(`Failed to execute tool: ${response.result}`);
103
- }
104
- const parsedResultStr = extractLastOuterJSON(response.result);
105
- const result = JSON.parse(parsedResultStr);
106
- if (result.isError) {
107
- console.error("[MCPSandboxClient] Tool execution error:", result.errorMessage);
108
- throw new Error(result.errorMessage);
109
- }
110
- return result;
111
- }
112
- catch (err) {
113
- console.error("[MCPSandboxClient] Error executing tool:", err);
114
- throw err;
115
- }
116
- }
117
- generateMCPTestCode(mcpServerConfig, operation, toolName, argumentsObj, envs) {
118
- const commonCode = `
119
- import { Client } from "@modelcontextprotocol/sdk/client/index.js";
120
- import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
121
-
122
- async function runMCP() {
123
- let client;
124
- try {
125
- const packageName = "${mcpServerConfig.packageName}";
126
-
127
- const transport = new StdioClientTransport({
128
- command: "pnpx",
129
- args: ["--silent", packageName],
130
- env: {
131
- ...Object.fromEntries(
132
- Object.entries(process.env).filter(([_, v]) => v !== undefined)
133
- ),
134
- PNPM_HOME: "/root/.local/share/pnpm",
135
- PNPM_STORE_PATH: "/pnpm-store",
136
- ${this.generateEnvVariables(mcpServerConfig.env, envs)}
137
- },
138
- });
139
-
140
- client = new Client(
141
- {
142
- name: "mcp-server-${mcpServerConfig.packageName}-client",
143
- version: "1.0.0",
144
- },
145
- {
146
- capabilities: {
147
- tools: {},
148
- },
149
- },
150
- );
151
-
152
- await client.connect(transport);
153
- `;
154
- if (operation === "listTools") {
155
- const toolsCode = `${commonCode}
156
- const toolsObj = await client.listTools();
157
-
158
- const result = {
159
- toolCount: toolsObj.tools.length,
160
- tools: toolsObj.tools
161
- };
162
-
163
- process.stdout.write(JSON.stringify(result));
164
- } catch (error) {
165
- console.error("Error in MCP test:", error);
166
- process.exitCode = 1;
167
- process.stdout.write(JSON.stringify({ error: error.message || "Unknown error occurred" }));
168
- } finally {
169
- if (client) {
170
- try {
171
- await client.close();
172
- } catch (closeError) {
173
- console.error("Error closing MCP client:", closeError);
174
- }
175
- }
176
- }
177
- }
178
-
179
- runMCP();
180
- `;
181
- return toolsCode;
182
- // } else if (operation === "executeTool" && toolName) {
183
- }
184
- else {
185
- const toolExecuteCode = `${commonCode}
186
-
187
- const result = await client.callTool({
188
- name: "${toolName}",
189
- arguments: ${JSON.stringify(argumentsObj)}
190
- });
191
-
192
- process.stdout.write(JSON.stringify(result));
193
- } catch (error) {
194
- console.error("Error in MCP test:", error);
195
- process.exitCode = 1;
196
- process.stdout.write(JSON.stringify({
197
- result: null,
198
- isError: true,
199
- errorMessage: error.message
200
- }));
201
- } finally {
202
- if (client) {
203
- try {
204
- await client.close();
205
- } catch (closeError) {
206
- console.error("Error closing MCP client:", closeError);
207
- }
208
- }
209
- }
210
- }
211
-
212
- runMCP();
213
- `;
214
- return toolExecuteCode;
215
- }
216
- }
217
- generateEnvVariables(env, realEnvs) {
218
- if (!env) {
219
- return "";
220
- }
221
- const envEntries = Object.entries(env).map(([key, _]) => {
222
- if (realEnvs === null || realEnvs === void 0 ? void 0 : realEnvs[key]) {
223
- return `${JSON.stringify(key)}: ${JSON.stringify(realEnvs[key])}`;
224
- }
225
- return `${JSON.stringify(key)}: "mock_value"`;
226
- });
227
- return envEntries.join(",\n ");
228
- }
229
- }