@evantahler/mcpx 0.18.3 → 0.18.5
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/package.json +63 -63
- package/src/cli.ts +46 -54
- package/src/client/browser.ts +15 -15
- package/src/client/debug-fetch.ts +53 -56
- package/src/client/elicitation.ts +279 -291
- package/src/client/http.ts +1 -1
- package/src/client/manager.ts +481 -514
- package/src/client/oauth.ts +272 -282
- package/src/client/sse.ts +1 -1
- package/src/client/stdio.ts +7 -7
- package/src/client/trace.ts +146 -152
- package/src/client/transport-options.ts +20 -20
- package/src/commands/add.ts +160 -165
- package/src/commands/allow.ts +141 -142
- package/src/commands/auth.ts +86 -90
- package/src/commands/check-update.ts +49 -53
- package/src/commands/deny.ts +114 -117
- package/src/commands/exec.ts +218 -222
- package/src/commands/index.ts +41 -41
- package/src/commands/info.ts +48 -50
- package/src/commands/list.ts +49 -49
- package/src/commands/ping.ts +47 -50
- package/src/commands/prompt.ts +40 -50
- package/src/commands/remove.ts +54 -56
- package/src/commands/resource.ts +31 -36
- package/src/commands/search.ts +35 -39
- package/src/commands/servers.ts +44 -48
- package/src/commands/skill.ts +89 -95
- package/src/commands/task.ts +50 -60
- package/src/commands/upgrade.ts +191 -208
- package/src/commands/with-command.ts +27 -29
- package/src/config/env.ts +26 -28
- package/src/config/loader.ts +99 -102
- package/src/config/schemas.ts +78 -87
- package/src/constants.ts +17 -17
- package/src/context.ts +51 -51
- package/src/lib/client-settings.ts +127 -140
- package/src/lib/input.ts +23 -26
- package/src/output/format-output.ts +12 -16
- package/src/output/format-table.ts +39 -42
- package/src/output/formatter.ts +790 -814
- package/src/output/logger.ts +140 -152
- package/src/sdk.ts +283 -291
- package/src/search/index.ts +50 -54
- package/src/search/indexer.ts +65 -65
- package/src/search/keyword.ts +54 -54
- package/src/search/semantic.ts +39 -39
- package/src/search/staleness.ts +3 -3
- package/src/search/types.ts +4 -4
- package/src/update/background.ts +51 -51
- package/src/update/cache.ts +21 -21
- package/src/update/checker.ts +81 -86
- package/src/validation/schema.ts +52 -58
package/src/sdk.ts
CHANGED
|
@@ -1,310 +1,302 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
CallToolResult,
|
|
3
|
+
CancelTaskResult,
|
|
4
|
+
GetTaskResult,
|
|
5
|
+
ListTasksResult,
|
|
6
6
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
-
import { ServerManager } from "./client/manager.ts";
|
|
8
7
|
import type {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
PromptWithServer,
|
|
9
|
+
ResourceWithServer,
|
|
10
|
+
ServerError,
|
|
11
|
+
ServerInfo,
|
|
12
|
+
ServerManagerOptions,
|
|
13
|
+
ToolWithServer,
|
|
15
14
|
} from "./client/manager.ts";
|
|
15
|
+
import { ServerManager } from "./client/manager.ts";
|
|
16
16
|
import { loadConfig } from "./config/loader.ts";
|
|
17
17
|
import type {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
AuthEntry,
|
|
19
|
+
AuthFile,
|
|
20
|
+
Config,
|
|
21
|
+
HttpServerConfig,
|
|
22
|
+
Prompt,
|
|
23
|
+
Resource,
|
|
24
|
+
SearchIndex,
|
|
25
|
+
ServerConfig,
|
|
26
|
+
ServersFile,
|
|
27
|
+
StdioServerConfig,
|
|
28
|
+
Tool,
|
|
29
29
|
} from "./config/schemas.ts";
|
|
30
|
+
import type { SearchOptions, SearchResult } from "./search/index.ts";
|
|
30
31
|
import { search } from "./search/index.ts";
|
|
31
|
-
import type {
|
|
32
|
+
import type { ValidationError, ValidationResult } from "./validation/schema.ts";
|
|
32
33
|
import { validateToolInput } from "./validation/schema.ts";
|
|
33
|
-
import type { ValidationResult, ValidationError } from "./validation/schema.ts";
|
|
34
34
|
|
|
35
35
|
// Re-export types for SDK consumers
|
|
36
36
|
export type {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
37
|
+
AuthEntry,
|
|
38
|
+
AuthFile,
|
|
39
|
+
// MCP SDK types
|
|
40
|
+
CallToolResult,
|
|
41
|
+
CancelTaskResult,
|
|
42
|
+
Config,
|
|
43
|
+
GetTaskResult,
|
|
44
|
+
HttpServerConfig,
|
|
45
|
+
ListTasksResult,
|
|
46
|
+
Prompt,
|
|
47
|
+
PromptWithServer,
|
|
48
|
+
Resource,
|
|
49
|
+
ResourceWithServer,
|
|
50
|
+
SearchIndex,
|
|
51
|
+
SearchOptions,
|
|
52
|
+
// Search types
|
|
53
|
+
SearchResult,
|
|
54
|
+
ServerConfig,
|
|
55
|
+
ServerError,
|
|
56
|
+
ServerInfo,
|
|
57
|
+
ServersFile,
|
|
58
|
+
StdioServerConfig,
|
|
59
|
+
// Config types
|
|
60
|
+
Tool,
|
|
61
|
+
// Manager types
|
|
62
|
+
ToolWithServer,
|
|
63
|
+
ValidationError,
|
|
64
|
+
// Validation types
|
|
65
|
+
ValidationResult,
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
export interface McpxClientOptions {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
69
|
+
/** Path to config directory. Defaults to ~/.mcpx or MCP_CONFIG_PATH env var. */
|
|
70
|
+
configDir?: string;
|
|
71
|
+
/** Inline server config — bypasses file loading when provided. */
|
|
72
|
+
servers?: ServersFile;
|
|
73
|
+
/** Inline auth config — bypasses file loading when provided. */
|
|
74
|
+
auth?: AuthFile;
|
|
75
|
+
/** Inline search index — bypasses file loading when provided. */
|
|
76
|
+
searchIndex?: SearchIndex;
|
|
77
|
+
/** Max concurrent server connections. Default: 5 */
|
|
78
|
+
concurrency?: number;
|
|
79
|
+
/** Request timeout in ms. Default: 1_800_000 (30 min) */
|
|
80
|
+
timeout?: number;
|
|
81
|
+
/** Max retries per operation. Default: 3 */
|
|
82
|
+
maxRetries?: number;
|
|
83
|
+
/** Enable verbose/trace logging. Default: false */
|
|
84
|
+
verbose?: boolean;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
export class McpxClient {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
/** Disconnect all servers and clean up. */
|
|
303
|
-
async close(): Promise<void> {
|
|
304
|
-
if (this.manager) {
|
|
305
|
-
await this.manager.close();
|
|
306
|
-
this.manager = undefined;
|
|
307
|
-
this.connectPromise = undefined;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
88
|
+
private options: McpxClientOptions;
|
|
89
|
+
private manager: ServerManager | undefined;
|
|
90
|
+
private searchIndex: SearchIndex | undefined;
|
|
91
|
+
private connectPromise: Promise<void> | undefined;
|
|
92
|
+
|
|
93
|
+
constructor(options: McpxClientOptions = {}) {
|
|
94
|
+
this.options = options;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Ensure config is loaded and ServerManager is ready. Idempotent. */
|
|
98
|
+
private async ensureConnected(): Promise<ServerManager> {
|
|
99
|
+
if (this.manager) return this.manager;
|
|
100
|
+
|
|
101
|
+
if (!this.connectPromise) {
|
|
102
|
+
this.connectPromise = this.init();
|
|
103
|
+
}
|
|
104
|
+
await this.connectPromise;
|
|
105
|
+
return this.manager!;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private async init(): Promise<void> {
|
|
109
|
+
let servers: ServersFile;
|
|
110
|
+
let auth: AuthFile;
|
|
111
|
+
let configDir: string;
|
|
112
|
+
let searchIndex: SearchIndex;
|
|
113
|
+
|
|
114
|
+
if (this.options.servers) {
|
|
115
|
+
// Inline config — no file loading
|
|
116
|
+
servers = this.options.servers;
|
|
117
|
+
auth = this.options.auth ?? {};
|
|
118
|
+
configDir = this.options.configDir ?? "/tmp";
|
|
119
|
+
searchIndex = this.options.searchIndex ?? {
|
|
120
|
+
version: 1,
|
|
121
|
+
indexed_at: "",
|
|
122
|
+
embedding_model: "",
|
|
123
|
+
tools: [],
|
|
124
|
+
};
|
|
125
|
+
} else {
|
|
126
|
+
// Load from disk
|
|
127
|
+
const config = await loadConfig({ configFlag: this.options.configDir });
|
|
128
|
+
servers = config.servers;
|
|
129
|
+
auth = config.auth;
|
|
130
|
+
configDir = config.configDir;
|
|
131
|
+
searchIndex = config.searchIndex;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
this.searchIndex = searchIndex;
|
|
135
|
+
|
|
136
|
+
const managerOpts: ServerManagerOptions = {
|
|
137
|
+
servers,
|
|
138
|
+
configDir,
|
|
139
|
+
auth,
|
|
140
|
+
concurrency: this.options.concurrency,
|
|
141
|
+
verbose: this.options.verbose,
|
|
142
|
+
timeout: this.options.timeout,
|
|
143
|
+
maxRetries: this.options.maxRetries,
|
|
144
|
+
logLevel: "emergency", // suppress server log messages from writing to stderr
|
|
145
|
+
noInteractive: true, // agents can't fill elicitation forms
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
this.manager = new ServerManager(managerOpts);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
// Core workflow: search → info → exec
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
|
|
155
|
+
/** Search for tools by keyword and/or semantic similarity. Requires a pre-built index (run `mcpx index` via CLI). */
|
|
156
|
+
async search(query: string, options?: SearchOptions): Promise<SearchResult[]> {
|
|
157
|
+
await this.ensureConnected();
|
|
158
|
+
if (!this.searchIndex || this.searchIndex.tools.length === 0) {
|
|
159
|
+
throw new Error("No search index found. Build one with: mcpx index");
|
|
160
|
+
}
|
|
161
|
+
return search(query, this.searchIndex, options);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Get a tool's schema (name, description, inputSchema). */
|
|
165
|
+
async info(server: string, tool: string): Promise<Tool | undefined> {
|
|
166
|
+
const manager = await this.ensureConnected();
|
|
167
|
+
return manager.getToolSchema(server, tool);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Execute a tool and return the result. */
|
|
171
|
+
async exec(server: string, tool: string, args?: Record<string, unknown>): Promise<CallToolResult> {
|
|
172
|
+
const manager = await this.ensureConnected();
|
|
173
|
+
return manager.callTool(server, tool, args ?? {}) as Promise<CallToolResult>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
// Tools
|
|
178
|
+
// ---------------------------------------------------------------------------
|
|
179
|
+
|
|
180
|
+
/** List tools, optionally filtered to a single server. */
|
|
181
|
+
async listTools(server?: string): Promise<ToolWithServer[]> {
|
|
182
|
+
const manager = await this.ensureConnected();
|
|
183
|
+
if (server) {
|
|
184
|
+
const tools = await manager.listTools(server);
|
|
185
|
+
return tools.map((tool) => ({ server, tool }));
|
|
186
|
+
}
|
|
187
|
+
const { tools } = await manager.getAllTools();
|
|
188
|
+
return tools;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// ---------------------------------------------------------------------------
|
|
192
|
+
// Validation
|
|
193
|
+
// ---------------------------------------------------------------------------
|
|
194
|
+
|
|
195
|
+
/** Validate arguments against a tool's inputSchema. */
|
|
196
|
+
async validateToolInput(server: string, toolName: string, args: Record<string, unknown>): Promise<ValidationResult> {
|
|
197
|
+
const tool = await this.info(server, toolName);
|
|
198
|
+
if (!tool) {
|
|
199
|
+
return { valid: false, errors: [{ path: "(root)", message: `Tool not found: ${toolName}` }] };
|
|
200
|
+
}
|
|
201
|
+
return validateToolInput(server, tool, args);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ---------------------------------------------------------------------------
|
|
205
|
+
// Resources
|
|
206
|
+
// ---------------------------------------------------------------------------
|
|
207
|
+
|
|
208
|
+
/** List resources, optionally filtered to a single server. */
|
|
209
|
+
async listResources(server?: string): Promise<ResourceWithServer[]> {
|
|
210
|
+
const manager = await this.ensureConnected();
|
|
211
|
+
if (server) {
|
|
212
|
+
const resources = await manager.listResources(server);
|
|
213
|
+
return resources.map((resource) => ({ server, resource }));
|
|
214
|
+
}
|
|
215
|
+
const { resources } = await manager.getAllResources();
|
|
216
|
+
return resources;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Read a specific resource by URI. */
|
|
220
|
+
async readResource(server: string, uri: string): Promise<unknown> {
|
|
221
|
+
const manager = await this.ensureConnected();
|
|
222
|
+
return manager.readResource(server, uri);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
// Prompts
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
|
|
229
|
+
/** List prompts, optionally filtered to a single server. */
|
|
230
|
+
async listPrompts(server?: string): Promise<PromptWithServer[]> {
|
|
231
|
+
const manager = await this.ensureConnected();
|
|
232
|
+
if (server) {
|
|
233
|
+
const prompts = await manager.listPrompts(server);
|
|
234
|
+
return prompts.map((prompt) => ({ server, prompt }));
|
|
235
|
+
}
|
|
236
|
+
const { prompts } = await manager.getAllPrompts();
|
|
237
|
+
return prompts;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** Get a specific prompt by name, optionally with arguments. */
|
|
241
|
+
async getPrompt(server: string, name: string, args?: Record<string, string>): Promise<unknown> {
|
|
242
|
+
const manager = await this.ensureConnected();
|
|
243
|
+
return manager.getPrompt(server, name, args);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// ---------------------------------------------------------------------------
|
|
247
|
+
// Tasks
|
|
248
|
+
// ---------------------------------------------------------------------------
|
|
249
|
+
|
|
250
|
+
/** List tasks on a server. */
|
|
251
|
+
async listTasks(server: string, cursor?: string): Promise<ListTasksResult> {
|
|
252
|
+
const manager = await this.ensureConnected();
|
|
253
|
+
return manager.listTasks(server, cursor);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Get the status of a task. */
|
|
257
|
+
async getTask(server: string, taskId: string): Promise<GetTaskResult> {
|
|
258
|
+
const manager = await this.ensureConnected();
|
|
259
|
+
return manager.getTask(server, taskId);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** Retrieve the result of a completed task. */
|
|
263
|
+
async getTaskResult(server: string, taskId: string): Promise<CallToolResult> {
|
|
264
|
+
const manager = await this.ensureConnected();
|
|
265
|
+
return manager.getTaskResult(server, taskId);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** Cancel a running task. */
|
|
269
|
+
async cancelTask(server: string, taskId: string): Promise<CancelTaskResult> {
|
|
270
|
+
const manager = await this.ensureConnected();
|
|
271
|
+
return manager.cancelTask(server, taskId);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// ---------------------------------------------------------------------------
|
|
275
|
+
// Server info
|
|
276
|
+
// ---------------------------------------------------------------------------
|
|
277
|
+
|
|
278
|
+
/** Get server info (version, capabilities, instructions). */
|
|
279
|
+
async getServerInfo(server: string): Promise<ServerInfo> {
|
|
280
|
+
const manager = await this.ensureConnected();
|
|
281
|
+
return manager.getServerInfo(server);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** Get all configured server names. */
|
|
285
|
+
async getServerNames(): Promise<string[]> {
|
|
286
|
+
const manager = await this.ensureConnected();
|
|
287
|
+
return manager.getServerNames();
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ---------------------------------------------------------------------------
|
|
291
|
+
// Lifecycle
|
|
292
|
+
// ---------------------------------------------------------------------------
|
|
293
|
+
|
|
294
|
+
/** Disconnect all servers and clean up. */
|
|
295
|
+
async close(): Promise<void> {
|
|
296
|
+
if (this.manager) {
|
|
297
|
+
await this.manager.close();
|
|
298
|
+
this.manager = undefined;
|
|
299
|
+
this.connectPromise = undefined;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
310
302
|
}
|