@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.
Files changed (3) hide show
  1. package/dist/index.d.ts +186 -176
  2. package/dist/index.js +563 -679
  3. package/package.json +3 -4
package/dist/index.d.ts CHANGED
@@ -1,228 +1,238 @@
1
- import { McpServerDefinition, McpTransport, McpServerScope, McpServerMetadata, Config } from '@nextclaw/core';
2
- import { Client } from '@modelcontextprotocol/sdk/client/index.js';
3
- import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
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
- name: string;
7
- definition: McpServerDefinition;
7
+ name: string;
8
+ definition: McpServerDefinition;
8
9
  };
9
10
  type McpToolCatalogEntry = {
10
- qualifiedName: string;
11
- serverName: string;
12
- toolName: string;
13
- description?: string;
14
- parameters?: Record<string, unknown>;
11
+ qualifiedName: string;
12
+ serverName: string;
13
+ toolName: string;
14
+ description?: string;
15
+ parameters?: Record<string, unknown>;
15
16
  };
16
17
  type McpServerWarmResult = {
17
- name: string;
18
- ok: boolean;
19
- toolCount: number;
20
- error?: string;
18
+ name: string;
19
+ ok: boolean;
20
+ toolCount: number;
21
+ error?: string;
21
22
  };
22
23
  type McpDoctorReport = {
23
- name: string;
24
- enabled: boolean;
25
- transport: McpTransport["type"];
26
- accessible: boolean;
27
- toolCount: number;
28
- error?: string;
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
- added: string[];
32
- removed: string[];
33
- enabled: string[];
34
- disabled: string[];
35
- restarted: string[];
36
- warmed: McpServerWarmResult[];
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
- agentId?: string;
40
+ agentId?: string;
40
41
  };
41
42
  type McpLifecycleState = {
42
- record: McpServerRecord;
43
- tools: McpToolCatalogEntry[];
44
- clientReady: boolean;
45
- lastReadyAt?: string;
46
- lastError?: string;
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
- id: string;
51
- label: string;
52
- description?: string;
53
- required?: boolean;
54
- secret?: boolean;
55
- defaultValue?: string;
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
- kind: "template";
59
- spec: string;
60
- command: string;
61
- defaultName: string;
62
- transportTypes: McpMarketplaceTransportType[];
63
- template: McpServerDefinition;
64
- inputs: McpMarketplaceInputField[];
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
- name: string;
68
- enabled: boolean;
69
- transport: McpTransport["type"];
70
- scope: McpServerScope;
71
- source: "manual" | "marketplace";
72
- catalogSlug?: string;
73
- displayName?: string;
74
- vendor?: string;
75
- docsUrl?: string;
76
- homepage?: string;
77
- trustLevel?: "official" | "verified" | "community";
78
- installedAt?: string;
79
- toolCount?: number;
80
- accessible?: boolean;
81
- lastReadyAt?: string;
82
- lastError?: string;
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
- changed: boolean;
86
- name: string;
87
- message: string;
88
- definition?: McpServerDefinition;
86
+ changed: boolean;
87
+ name: string;
88
+ message: string;
89
+ definition?: McpServerDefinition;
89
90
  };
90
91
  type McpMaterializeInstallParams = {
91
- template: McpMarketplaceInstallTemplate;
92
- name?: string;
93
- enabled?: boolean;
94
- scope?: Partial<McpServerScope>;
95
- inputs?: Record<string, string | undefined>;
96
- metadata?: Partial<McpServerMetadata>;
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
- config: Config;
102
- scope: McpServerScope;
103
- agentId?: string;
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
- client: Client;
113
- transport: Transport;
115
+ client: Client;
116
+ transport: Transport;
114
117
  };
115
118
  declare class McpClientFactory {
116
- private readonly _config?;
117
- constructor(_config?: Config | undefined);
118
- create(record: McpServerRecord): McpClientHandle;
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
- private readonly options;
123
- private readonly pendingConnections;
124
- private readonly readyConnections;
125
- constructor(options: {
126
- getConfig: () => Config;
127
- clientFactory?: McpClientFactory;
128
- now?: () => Date;
129
- });
130
- warmServer(record: McpServerRecord): Promise<McpLifecycleState>;
131
- getCachedCatalog(serverName: string): McpToolCatalogEntry[];
132
- getCachedState(serverName: string): McpLifecycleState | undefined;
133
- callTool(record: McpServerRecord, toolName: string, args: Record<string, unknown>): Promise<unknown>;
134
- closeAll(): Promise<void>;
135
- closeServer(serverName: string): Promise<void>;
136
- private ensureConnection;
137
- private connect;
138
- private stripConnection;
139
- private normalizeToolResult;
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
- private readonly options;
144
- private readonly lifecycleManager;
145
- constructor(options: {
146
- getConfig: () => Config;
147
- lifecycleManager?: McpServerLifecycleManager;
148
- });
149
- listServers(): McpServerRecord[];
150
- getServer(name: string): McpServerRecord | undefined;
151
- prewarmEnabledServers(): Promise<McpServerWarmResult[]>;
152
- warmServer(name: string): Promise<McpServerWarmResult>;
153
- reconcileConfig(params: {
154
- prevConfig: Config;
155
- nextConfig: Config;
156
- }): Promise<McpConfigReconcileResult>;
157
- listAccessibleTools(filter?: McpCatalogFilter): McpToolCatalogEntry[];
158
- getCachedState(serverName: string): McpLifecycleState | undefined;
159
- callTool(params: {
160
- serverName: string;
161
- toolName: string;
162
- args: Record<string, unknown>;
163
- }): Promise<unknown>;
164
- close(): Promise<void>;
165
- private warmRecord;
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
- private readonly options;
170
- constructor(options: {
171
- getConfig: () => Config;
172
- registryService?: McpRegistryService;
173
- });
174
- inspect(name?: string): Promise<McpDoctorReport[]>;
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
- private readonly options;
179
- private readonly doctorService;
180
- constructor(options: {
181
- getConfig: () => Config;
182
- registryService?: McpRegistryService;
183
- });
184
- inspect(name?: string): Promise<McpDoctorReport[]>;
185
- inspectOne(name: string): Promise<McpDoctorReport | null>;
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
- materialize(params: McpMaterializeInstallParams): {
190
- name: string;
191
- definition: McpServerDefinition;
192
- };
193
- private applyInputs;
194
- private mergeScope;
195
- private mergeMetadata;
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
- private readonly options;
200
- private readonly materializer;
201
- constructor(options: {
202
- getConfig: () => Config;
203
- saveConfig: (config: Config) => void;
204
- materializer?: McpInstallTemplateMaterializer;
205
- });
206
- listServerNames(): string[];
207
- addServer(name: string, definition: McpServerDefinition): McpMutationResult;
208
- updateServer(name: string, definition: McpServerDefinition): McpMutationResult;
209
- removeServer(name: string): McpMutationResult;
210
- toggleEnabled(name: string, enabled: boolean): McpMutationResult;
211
- installFromTemplate(params: Omit<McpMaterializeInstallParams, "template"> & {
212
- template: McpMarketplaceInstallTemplate;
213
- }): McpMutationResult;
214
- duplicateServer(sourceName: string, targetName: string): McpMutationResult;
215
- renameServer(sourceName: string, targetName: string): McpMutationResult;
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
- private readonly options;
220
- private readonly registryService;
221
- constructor(options: {
222
- getConfig: () => Config;
223
- registryService?: McpRegistryService;
224
- });
225
- listInstalled(): McpInstalledRecord[];
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 { type McpCatalogFilter, McpClientFactory, type McpConfigReconcileResult, McpDoctorFacade, type McpDoctorReport, McpDoctorService, McpInstallTemplateMaterializer, type McpInstalledRecord, McpInstalledViewService, type McpLifecycleState, type McpMarketplaceInputField, type McpMarketplaceInstallTemplate, type McpMarketplaceTransportType, type McpMaterializeInstallParams, type McpMutationResult, McpMutationService, McpRegistryService, McpServerLifecycleManager, type McpServerRecord, type McpServerWarmResult, type McpToolCatalogEntry, buildQualifiedMcpToolName, getMcpServer, isServerAccessibleToAgent, listMcpServers, normalizeMcpServerName, readDefaultAgentId, sanitizeMcpSegment };
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 };