@nextclaw/mcp 0.1.65 → 0.1.67
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/index.d.ts +186 -176
- package/dist/index.js +563 -679
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,228 +1,238 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Transport } from
|
|
1
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
+
import { Config, McpServerDefinition, McpServerMetadata, McpServerScope, McpTransport } from "@nextclaw/core";
|
|
3
|
+
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
4
4
|
|
|
5
|
+
//#region src/types.d.ts
|
|
5
6
|
type McpServerRecord = {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
name: string;
|
|
8
|
+
definition: McpServerDefinition;
|
|
8
9
|
};
|
|
9
10
|
type McpToolCatalogEntry = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
qualifiedName: string;
|
|
12
|
+
serverName: string;
|
|
13
|
+
toolName: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
parameters?: Record<string, unknown>;
|
|
15
16
|
};
|
|
16
17
|
type McpServerWarmResult = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
name: string;
|
|
19
|
+
ok: boolean;
|
|
20
|
+
toolCount: number;
|
|
21
|
+
error?: string;
|
|
21
22
|
};
|
|
22
23
|
type McpDoctorReport = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
name: string;
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
transport: McpTransport["type"];
|
|
27
|
+
accessible: boolean;
|
|
28
|
+
toolCount: number;
|
|
29
|
+
error?: string;
|
|
29
30
|
};
|
|
30
31
|
type McpConfigReconcileResult = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
added: string[];
|
|
33
|
+
removed: string[];
|
|
34
|
+
enabled: string[];
|
|
35
|
+
disabled: string[];
|
|
36
|
+
restarted: string[];
|
|
37
|
+
warmed: McpServerWarmResult[];
|
|
37
38
|
};
|
|
38
39
|
type McpCatalogFilter = {
|
|
39
|
-
|
|
40
|
+
agentId?: string;
|
|
40
41
|
};
|
|
41
42
|
type McpLifecycleState = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
record: McpServerRecord;
|
|
44
|
+
tools: McpToolCatalogEntry[];
|
|
45
|
+
clientReady: boolean;
|
|
46
|
+
lastReadyAt?: string;
|
|
47
|
+
lastError?: string;
|
|
47
48
|
};
|
|
48
49
|
type McpMarketplaceTransportType = McpTransport["type"];
|
|
49
50
|
type McpMarketplaceInputField = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
id: string;
|
|
52
|
+
label: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
required?: boolean;
|
|
55
|
+
secret?: boolean;
|
|
56
|
+
defaultValue?: string;
|
|
56
57
|
};
|
|
57
58
|
type McpMarketplaceInstallTemplate = {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
kind: "template";
|
|
60
|
+
spec: string;
|
|
61
|
+
command: string;
|
|
62
|
+
defaultName: string;
|
|
63
|
+
transportTypes: McpMarketplaceTransportType[];
|
|
64
|
+
template: McpServerDefinition;
|
|
65
|
+
inputs: McpMarketplaceInputField[];
|
|
65
66
|
};
|
|
66
67
|
type McpInstalledRecord = {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
name: string;
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
transport: McpTransport["type"];
|
|
71
|
+
scope: McpServerScope;
|
|
72
|
+
source: "manual" | "marketplace";
|
|
73
|
+
catalogSlug?: string;
|
|
74
|
+
displayName?: string;
|
|
75
|
+
vendor?: string;
|
|
76
|
+
docsUrl?: string;
|
|
77
|
+
homepage?: string;
|
|
78
|
+
trustLevel?: "official" | "verified" | "community";
|
|
79
|
+
installedAt?: string;
|
|
80
|
+
toolCount?: number;
|
|
81
|
+
accessible?: boolean;
|
|
82
|
+
lastReadyAt?: string;
|
|
83
|
+
lastError?: string;
|
|
83
84
|
};
|
|
84
85
|
type McpMutationResult = {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
changed: boolean;
|
|
87
|
+
name: string;
|
|
88
|
+
message: string;
|
|
89
|
+
definition?: McpServerDefinition;
|
|
89
90
|
};
|
|
90
91
|
type McpMaterializeInstallParams = {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
template: McpMarketplaceInstallTemplate;
|
|
93
|
+
name?: string;
|
|
94
|
+
enabled?: boolean;
|
|
95
|
+
scope?: Partial<McpServerScope>;
|
|
96
|
+
inputs?: Record<string, string | undefined>;
|
|
97
|
+
metadata?: Partial<McpServerMetadata>;
|
|
97
98
|
};
|
|
98
99
|
declare function normalizeMcpServerName(name: string): string;
|
|
99
100
|
declare function readDefaultAgentId(config: Config): string;
|
|
100
101
|
declare function isServerAccessibleToAgent(params: {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
config: Config;
|
|
103
|
+
scope: McpServerScope;
|
|
104
|
+
agentId?: string;
|
|
104
105
|
}): boolean;
|
|
105
106
|
declare function buildQualifiedMcpToolName(serverName: string, toolName: string): string;
|
|
106
107
|
declare function sanitizeMcpSegment(value: string): string;
|
|
107
|
-
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/config/mcp-config-normalizer.d.ts
|
|
108
110
|
declare function listMcpServers(config: Config): McpServerRecord[];
|
|
109
111
|
declare function getMcpServer(config: Config, name: string): McpServerRecord | undefined;
|
|
110
|
-
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/client/mcp-client-factory.d.ts
|
|
111
114
|
type McpClientHandle = {
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
client: Client;
|
|
116
|
+
transport: Transport;
|
|
114
117
|
};
|
|
115
118
|
declare class McpClientFactory {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
private readonly _config?;
|
|
120
|
+
constructor(_config?: Config | undefined);
|
|
121
|
+
create(record: McpServerRecord): McpClientHandle;
|
|
119
122
|
}
|
|
120
|
-
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/lifecycle/mcp-server-lifecycle-manager.d.ts
|
|
121
125
|
declare class McpServerLifecycleManager {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
126
|
+
private readonly options;
|
|
127
|
+
private readonly pendingConnections;
|
|
128
|
+
private readonly readyConnections;
|
|
129
|
+
constructor(options: {
|
|
130
|
+
getConfig: () => Config;
|
|
131
|
+
clientFactory?: McpClientFactory;
|
|
132
|
+
now?: () => Date;
|
|
133
|
+
});
|
|
134
|
+
warmServer(record: McpServerRecord): Promise<McpLifecycleState>;
|
|
135
|
+
getCachedCatalog(serverName: string): McpToolCatalogEntry[];
|
|
136
|
+
getCachedState(serverName: string): McpLifecycleState | undefined;
|
|
137
|
+
callTool(record: McpServerRecord, toolName: string, args: Record<string, unknown>): Promise<unknown>;
|
|
138
|
+
closeAll(): Promise<void>;
|
|
139
|
+
closeServer(serverName: string): Promise<void>;
|
|
140
|
+
private ensureConnection;
|
|
141
|
+
private connect;
|
|
142
|
+
private stripConnection;
|
|
143
|
+
private normalizeToolResult;
|
|
140
144
|
}
|
|
141
|
-
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/registry/mcp-registry-service.d.ts
|
|
142
147
|
declare class McpRegistryService {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
148
|
+
private readonly options;
|
|
149
|
+
private readonly lifecycleManager;
|
|
150
|
+
constructor(options: {
|
|
151
|
+
getConfig: () => Config;
|
|
152
|
+
lifecycleManager?: McpServerLifecycleManager;
|
|
153
|
+
});
|
|
154
|
+
listServers(): McpServerRecord[];
|
|
155
|
+
getServer(name: string): McpServerRecord | undefined;
|
|
156
|
+
prewarmEnabledServers(): Promise<McpServerWarmResult[]>;
|
|
157
|
+
warmServer(name: string): Promise<McpServerWarmResult>;
|
|
158
|
+
reconcileConfig(params: {
|
|
159
|
+
prevConfig: Config;
|
|
160
|
+
nextConfig: Config;
|
|
161
|
+
}): Promise<McpConfigReconcileResult>;
|
|
162
|
+
listAccessibleTools(filter?: McpCatalogFilter): McpToolCatalogEntry[];
|
|
163
|
+
getCachedState(serverName: string): McpLifecycleState | undefined;
|
|
164
|
+
callTool(params: {
|
|
165
|
+
serverName: string;
|
|
166
|
+
toolName: string;
|
|
167
|
+
args: Record<string, unknown>;
|
|
168
|
+
}): Promise<unknown>;
|
|
169
|
+
close(): Promise<void>;
|
|
170
|
+
private warmRecord;
|
|
166
171
|
}
|
|
167
|
-
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/doctor/mcp-doctor-service.d.ts
|
|
168
174
|
declare class McpDoctorService {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
+
private readonly options;
|
|
176
|
+
constructor(options: {
|
|
177
|
+
getConfig: () => Config;
|
|
178
|
+
registryService?: McpRegistryService;
|
|
179
|
+
});
|
|
180
|
+
inspect(name?: string): Promise<McpDoctorReport[]>;
|
|
175
181
|
}
|
|
176
|
-
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/doctor/mcp-doctor-facade.d.ts
|
|
177
184
|
declare class McpDoctorFacade {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
private readonly options;
|
|
186
|
+
private readonly doctorService;
|
|
187
|
+
constructor(options: {
|
|
188
|
+
getConfig: () => Config;
|
|
189
|
+
registryService?: McpRegistryService;
|
|
190
|
+
});
|
|
191
|
+
inspect(name?: string): Promise<McpDoctorReport[]>;
|
|
192
|
+
inspectOne(name: string): Promise<McpDoctorReport | null>;
|
|
186
193
|
}
|
|
187
|
-
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/install/mcp-install-template-materializer.d.ts
|
|
188
196
|
declare class McpInstallTemplateMaterializer {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
197
|
+
materialize(params: McpMaterializeInstallParams): {
|
|
198
|
+
name: string;
|
|
199
|
+
definition: McpServerDefinition;
|
|
200
|
+
};
|
|
201
|
+
private applyInputs;
|
|
202
|
+
private mergeScope;
|
|
203
|
+
private mergeMetadata;
|
|
196
204
|
}
|
|
197
|
-
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/manage/mcp-mutation-service.d.ts
|
|
198
207
|
declare class McpMutationService {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
208
|
+
private readonly options;
|
|
209
|
+
private readonly materializer;
|
|
210
|
+
constructor(options: {
|
|
211
|
+
getConfig: () => Config;
|
|
212
|
+
saveConfig: (config: Config) => void;
|
|
213
|
+
materializer?: McpInstallTemplateMaterializer;
|
|
214
|
+
});
|
|
215
|
+
listServerNames(): string[];
|
|
216
|
+
addServer(name: string, definition: McpServerDefinition): McpMutationResult;
|
|
217
|
+
updateServer(name: string, definition: McpServerDefinition): McpMutationResult;
|
|
218
|
+
removeServer(name: string): McpMutationResult;
|
|
219
|
+
toggleEnabled(name: string, enabled: boolean): McpMutationResult;
|
|
220
|
+
installFromTemplate(params: Omit<McpMaterializeInstallParams, "template"> & {
|
|
221
|
+
template: McpMarketplaceInstallTemplate;
|
|
222
|
+
}): McpMutationResult;
|
|
223
|
+
duplicateServer(sourceName: string, targetName: string): McpMutationResult;
|
|
224
|
+
renameServer(sourceName: string, targetName: string): McpMutationResult;
|
|
216
225
|
}
|
|
217
|
-
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/view/mcp-installed-view-service.d.ts
|
|
218
228
|
declare class McpInstalledViewService {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
229
|
+
private readonly options;
|
|
230
|
+
private readonly registryService;
|
|
231
|
+
constructor(options: {
|
|
232
|
+
getConfig: () => Config;
|
|
233
|
+
registryService?: McpRegistryService;
|
|
234
|
+
});
|
|
235
|
+
listInstalled(): McpInstalledRecord[];
|
|
226
236
|
}
|
|
227
|
-
|
|
228
|
-
export {
|
|
237
|
+
//#endregion
|
|
238
|
+
export { McpCatalogFilter, McpClientFactory, McpConfigReconcileResult, McpDoctorFacade, McpDoctorReport, McpDoctorService, McpInstallTemplateMaterializer, McpInstalledRecord, McpInstalledViewService, McpLifecycleState, McpMarketplaceInputField, McpMarketplaceInstallTemplate, McpMarketplaceTransportType, McpMaterializeInstallParams, McpMutationResult, McpMutationService, McpRegistryService, McpServerLifecycleManager, McpServerRecord, McpServerWarmResult, McpToolCatalogEntry, buildQualifiedMcpToolName, getMcpServer, isServerAccessibleToAgent, listMcpServers, normalizeMcpServerName, readDefaultAgentId, sanitizeMcpSegment };
|