@toolplex/client 0.1.27 → 0.1.29
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/mcp-server/toolHandlers/installServerHandler.js +3 -3
- package/dist/mcp-server/toolHandlers/lookupEntityHandler.js +1 -1
- package/dist/mcp-server/toolplexApi/service.d.ts +1 -1
- package/dist/mcp-server/toolplexApi/service.js +2 -1
- package/dist/shared/mcpServerTypes.d.ts +6 -0
- package/dist/shared/mcpServerTypes.js +2 -0
- package/dist/shared/stdioServerManagerClient.d.ts +1 -1
- package/dist/shared/stdioServerManagerClient.js +3 -2
- package/dist/src/mcp-server/toolplexApi/service.js +2 -1
- package/dist/src/shared/mcpServerTypes.js +2 -0
- package/dist/src/shared/stdioServerManagerClient.js +3 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -68,7 +68,7 @@ function sanitizeServerConfig(config) {
|
|
|
68
68
|
env_count: config.env ? Object.keys(config.env).length : 0,
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
async function installServer(serverId, serverName, description, serverManagerClient, serverConfig) {
|
|
71
|
+
async function installServer(serverId, serverName, description, serverManagerClient, serverConfig, timeoutMs) {
|
|
72
72
|
await logger.info(`Starting installation of tool ${serverId}: ${serverName}`);
|
|
73
73
|
await logger.debug(`Server config: ${JSON.stringify(serverConfig)}, Server ID: ${serverId}`);
|
|
74
74
|
const response = await serverManagerClient.sendRequest("install", {
|
|
@@ -76,7 +76,7 @@ async function installServer(serverId, serverName, description, serverManagerCli
|
|
|
76
76
|
server_name: serverName,
|
|
77
77
|
description: description,
|
|
78
78
|
config: serverConfig,
|
|
79
|
-
});
|
|
79
|
+
}, timeoutMs);
|
|
80
80
|
if ("error" in response) {
|
|
81
81
|
const error = `Server installation failed: ${response.error.message}`;
|
|
82
82
|
await logger.error(error);
|
|
@@ -147,7 +147,7 @@ export async function handleInstallServer(params) {
|
|
|
147
147
|
throw new Error(`Unsupported runtime: ${runtime}`);
|
|
148
148
|
}
|
|
149
149
|
// Install server
|
|
150
|
-
const installResult = await installServer(server_id, server_name, description, client, config);
|
|
150
|
+
const installResult = await installServer(server_id, server_name, description, client, config, params.timeout_ms);
|
|
151
151
|
// After successful install, refresh the servers cache
|
|
152
152
|
await serversCache.refreshCache(serverManagerClients);
|
|
153
153
|
// List tools on the newly installed server
|
|
@@ -20,7 +20,7 @@ export async function handleLookupEntityTool(params) {
|
|
|
20
20
|
if (params.entity_type === "server") {
|
|
21
21
|
policyEnforcer.enforceUseServerPolicy(params.entity_id);
|
|
22
22
|
}
|
|
23
|
-
const lookupResponse = await apiService.lookupEntity(params.entity_type, params.entity_id);
|
|
23
|
+
const lookupResponse = await apiService.lookupEntity(params.entity_type, params.entity_id, params.include_readme);
|
|
24
24
|
// Annotate installed server using resultAnnotators
|
|
25
25
|
if (params.entity_type === "server" &&
|
|
26
26
|
lookupResponse &&
|
|
@@ -20,7 +20,7 @@ export declare class ToolplexApiService {
|
|
|
20
20
|
eventType: LogTelemetryRequest["event_type"];
|
|
21
21
|
data: Partial<Omit<LogTelemetryRequest, "event_type">>;
|
|
22
22
|
}>): Promise<LogTelemetryBatchResponse>;
|
|
23
|
-
lookupEntity(entityType: "server" | "playbook" | "feedback", entityId: string): Promise<any>;
|
|
23
|
+
lookupEntity(entityType: "server" | "playbook" | "feedback", entityId: string, includeReadme?: boolean): Promise<any>;
|
|
24
24
|
search(query: string, expandedKeywords?: string[], filter?: string, size?: number, scope?: string): Promise<SearchResponse>;
|
|
25
25
|
createPlaybook(playbook_name: string, description: string, actions: Array<PlaybookAction>, domain?: string, keywords?: string[], requirements?: string[], privacy?: "public" | "private", sourcePlaybookId?: string, forkReason?: string): Promise<CreatePlaybookResponse>;
|
|
26
26
|
logPlaybookUsage(playbookId: string, success: boolean, errorMessage?: string): Promise<LogPlaybookUsageResponse>;
|
|
@@ -93,7 +93,7 @@ export class ToolplexApiService {
|
|
|
93
93
|
return { success: false };
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
async lookupEntity(entityType, entityId) {
|
|
96
|
+
async lookupEntity(entityType, entityId, includeReadme) {
|
|
97
97
|
try {
|
|
98
98
|
const response = await fetch(`${this.baseUrl}/lookup-entity`, {
|
|
99
99
|
method: "POST",
|
|
@@ -101,6 +101,7 @@ export class ToolplexApiService {
|
|
|
101
101
|
body: JSON.stringify({
|
|
102
102
|
entity_type: entityType,
|
|
103
103
|
entity_id: entityId,
|
|
104
|
+
include_readme: includeReadme,
|
|
104
105
|
}),
|
|
105
106
|
});
|
|
106
107
|
return this.handleFetchResponse(response);
|
|
@@ -140,12 +140,15 @@ export type SearchParams = z.infer<typeof SearchParamsSchema>;
|
|
|
140
140
|
export declare const LookupEntityParamsSchema: z.ZodObject<{
|
|
141
141
|
entity_type: z.ZodEnum<["server", "playbook", "feedback"]>;
|
|
142
142
|
entity_id: z.ZodString;
|
|
143
|
+
include_readme: z.ZodOptional<z.ZodBoolean>;
|
|
143
144
|
}, "strip", z.ZodTypeAny, {
|
|
144
145
|
entity_type: "server" | "playbook" | "feedback";
|
|
145
146
|
entity_id: string;
|
|
147
|
+
include_readme?: boolean | undefined;
|
|
146
148
|
}, {
|
|
147
149
|
entity_type: "server" | "playbook" | "feedback";
|
|
148
150
|
entity_id: string;
|
|
151
|
+
include_readme?: boolean | undefined;
|
|
149
152
|
}>;
|
|
150
153
|
export type LookupEntityParams = z.infer<typeof LookupEntityParamsSchema>;
|
|
151
154
|
export declare const InstallParamsSchema: z.ZodObject<{
|
|
@@ -180,6 +183,7 @@ export declare const InstallParamsSchema: z.ZodObject<{
|
|
|
180
183
|
env?: Record<string, string> | undefined;
|
|
181
184
|
url?: string | undefined;
|
|
182
185
|
}>;
|
|
186
|
+
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
183
187
|
}, "strip", z.ZodTypeAny, {
|
|
184
188
|
server_name: string;
|
|
185
189
|
description: string;
|
|
@@ -194,6 +198,7 @@ export declare const InstallParamsSchema: z.ZodObject<{
|
|
|
194
198
|
env?: Record<string, string> | undefined;
|
|
195
199
|
url?: string | undefined;
|
|
196
200
|
};
|
|
201
|
+
timeout_ms?: number | undefined;
|
|
197
202
|
}, {
|
|
198
203
|
server_name: string;
|
|
199
204
|
description: string;
|
|
@@ -208,6 +213,7 @@ export declare const InstallParamsSchema: z.ZodObject<{
|
|
|
208
213
|
env?: Record<string, string> | undefined;
|
|
209
214
|
url?: string | undefined;
|
|
210
215
|
};
|
|
216
|
+
timeout_ms?: number | undefined;
|
|
211
217
|
}>;
|
|
212
218
|
export type InstallParams = z.infer<typeof InstallParamsSchema>;
|
|
213
219
|
export declare const ListToolsParamsSchema: z.ZodObject<{
|
|
@@ -51,6 +51,7 @@ export const SearchParamsSchema = z.object({
|
|
|
51
51
|
export const LookupEntityParamsSchema = z.object({
|
|
52
52
|
entity_type: z.enum(["server", "playbook", "feedback"]),
|
|
53
53
|
entity_id: z.string(),
|
|
54
|
+
include_readme: z.boolean().optional(),
|
|
54
55
|
});
|
|
55
56
|
// --------------------
|
|
56
57
|
// InstallParams
|
|
@@ -60,6 +61,7 @@ export const InstallParamsSchema = z.object({
|
|
|
60
61
|
server_name: z.string(),
|
|
61
62
|
description: z.string(),
|
|
62
63
|
config: ServerConfigSchema,
|
|
64
|
+
timeout_ms: z.number().int().min(10000).max(300000).optional(),
|
|
63
65
|
});
|
|
64
66
|
// --------------------
|
|
65
67
|
// ListToolsParams
|
|
@@ -7,6 +7,6 @@ export declare class StdioServerManagerClient {
|
|
|
7
7
|
private env;
|
|
8
8
|
constructor(command: string, args: string[], env?: NodeJS.ProcessEnv);
|
|
9
9
|
start(): Promise<void>;
|
|
10
|
-
sendRequest(method: string, params: any): Promise<any>;
|
|
10
|
+
sendRequest(method: string, params: any, timeoutMs?: number): Promise<any>;
|
|
11
11
|
stop(): Promise<void>;
|
|
12
12
|
}
|
|
@@ -55,8 +55,9 @@ export class StdioServerManagerClient {
|
|
|
55
55
|
this.messageBuffer = "";
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
async sendRequest(method,
|
|
58
59
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
-
|
|
60
|
+
params, timeoutMs = 60000) {
|
|
60
61
|
return new Promise((resolve, reject) => {
|
|
61
62
|
const id = Date.now();
|
|
62
63
|
if (!this.serverProcess?.stdin) {
|
|
@@ -84,7 +85,7 @@ export class StdioServerManagerClient {
|
|
|
84
85
|
this.messageHandlers.delete(id);
|
|
85
86
|
reject(new Error(`Request timed out: ${method}`));
|
|
86
87
|
}
|
|
87
|
-
},
|
|
88
|
+
}, timeoutMs);
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
async stop() {
|
|
@@ -93,7 +93,7 @@ export class ToolplexApiService {
|
|
|
93
93
|
return { success: false };
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
async lookupEntity(entityType, entityId) {
|
|
96
|
+
async lookupEntity(entityType, entityId, includeReadme) {
|
|
97
97
|
try {
|
|
98
98
|
const response = await fetch(`${this.baseUrl}/lookup-entity`, {
|
|
99
99
|
method: "POST",
|
|
@@ -101,6 +101,7 @@ export class ToolplexApiService {
|
|
|
101
101
|
body: JSON.stringify({
|
|
102
102
|
entity_type: entityType,
|
|
103
103
|
entity_id: entityId,
|
|
104
|
+
include_readme: includeReadme,
|
|
104
105
|
}),
|
|
105
106
|
});
|
|
106
107
|
return this.handleFetchResponse(response);
|
|
@@ -51,6 +51,7 @@ export const SearchParamsSchema = z.object({
|
|
|
51
51
|
export const LookupEntityParamsSchema = z.object({
|
|
52
52
|
entity_type: z.enum(["server", "playbook", "feedback"]),
|
|
53
53
|
entity_id: z.string(),
|
|
54
|
+
include_readme: z.boolean().optional(),
|
|
54
55
|
});
|
|
55
56
|
// --------------------
|
|
56
57
|
// InstallParams
|
|
@@ -60,6 +61,7 @@ export const InstallParamsSchema = z.object({
|
|
|
60
61
|
server_name: z.string(),
|
|
61
62
|
description: z.string(),
|
|
62
63
|
config: ServerConfigSchema,
|
|
64
|
+
timeout_ms: z.number().int().min(10000).max(300000).optional(),
|
|
63
65
|
});
|
|
64
66
|
// --------------------
|
|
65
67
|
// ListToolsParams
|
|
@@ -55,8 +55,9 @@ export class StdioServerManagerClient {
|
|
|
55
55
|
this.messageBuffer = "";
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
async sendRequest(method,
|
|
58
59
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
-
|
|
60
|
+
params, timeoutMs = 60000) {
|
|
60
61
|
return new Promise((resolve, reject) => {
|
|
61
62
|
const id = Date.now();
|
|
62
63
|
if (!this.serverProcess?.stdin) {
|
|
@@ -84,7 +85,7 @@ export class StdioServerManagerClient {
|
|
|
84
85
|
this.messageHandlers.delete(id);
|
|
85
86
|
reject(new Error(`Request timed out: ${method}`));
|
|
86
87
|
}
|
|
87
|
-
},
|
|
88
|
+
}, timeoutMs);
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
async stop() {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.1.
|
|
1
|
+
export declare const version = "0.1.29";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.1.
|
|
1
|
+
export const version = '0.1.29';
|