@wundr.io/mcp-registry 1.0.3 → 1.0.12

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/README.md CHANGED
@@ -601,9 +601,9 @@ monitor.on('monitor:stopped', () => {
601
601
  });
602
602
  ```
603
603
 
604
- ## Integration with VP Daemon
604
+ ## Integration with Orchestrator Daemon
605
605
 
606
- The mcp-registry integrates with the VP (Virtual Process) daemon for centralized MCP server management in production environments.
606
+ The mcp-registry integrates with the Orchestrator (Virtual Process) daemon for centralized MCP server management in production environments.
607
607
 
608
608
  ### Daemon Integration Pattern
609
609
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wundr.io/mcp-registry",
3
- "version": "1.0.3",
3
+ "version": "1.0.12",
4
4
  "description": "MCP Server registry and discovery with Super MCP aggregator pattern for unified tool routing",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,11 +26,11 @@
26
26
  "devDependencies": {
27
27
  "@types/node": "^20.9.0",
28
28
  "@types/uuid": "^10.0.0",
29
+ "eslint": "^8.57.1",
29
30
  "jest": "^29.7.0",
31
+ "prettier": "^3.3.3",
30
32
  "ts-jest": "^29.4.1",
31
- "typescript": "^5.2.2",
32
- "eslint": "^8.57.1",
33
- "prettier": "^3.3.3"
33
+ "typescript": "^5.2.2"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@wundr.io/mcp-server": "^1.0.0"
@@ -63,7 +63,10 @@
63
63
  "engines": {
64
64
  "node": ">=18.0.0"
65
65
  },
66
- "files": ["dist", "README.md"],
66
+ "files": [
67
+ "dist",
68
+ "README.md"
69
+ ],
67
70
  "publishConfig": {
68
71
  "access": "public",
69
72
  "registry": "https://registry.npmjs.org/"
@@ -1,330 +0,0 @@
1
- /**
2
- * @wundr.io/mcp-registry - MCP Aggregator (Super MCP)
3
- *
4
- * Implements the Super MCP pattern for routing requests to appropriate
5
- * servers based on capabilities, health, and configured routing strategies.
6
- *
7
- * @packageDocumentation
8
- */
9
- import { EventEmitter } from 'eventemitter3';
10
- import type { MCPServerRegistry } from './registry';
11
- import type { ToolInvocationRequest, ToolInvocationResponse, ToolResult, AggregatorConfig, RoutingStrategy, CircuitBreakerState, CircuitBreakerStatus, MCPServerRegistration } from './types';
12
- /**
13
- * Error thrown when no server can handle a tool invocation
14
- */
15
- export declare class NoServerAvailableError extends Error {
16
- readonly toolName: string;
17
- constructor(toolName: string, message?: string);
18
- }
19
- /**
20
- * Error thrown when a tool invocation times out
21
- */
22
- export declare class ToolInvocationTimeoutError extends Error {
23
- readonly toolName: string;
24
- readonly timeoutMs: number;
25
- constructor(toolName: string, timeoutMs: number, message?: string);
26
- }
27
- /**
28
- * Error thrown when circuit breaker is open for a server
29
- */
30
- export declare class CircuitBreakerOpenError extends Error {
31
- readonly serverId: string;
32
- constructor(serverId: string, message?: string);
33
- }
34
- /**
35
- * Error thrown when all retry attempts are exhausted
36
- */
37
- export declare class RetryExhaustedError extends Error {
38
- readonly toolName: string;
39
- readonly attempts: number;
40
- readonly lastError: Error;
41
- constructor(toolName: string, attempts: number, lastError: Error, message?: string);
42
- }
43
- /**
44
- * Event map for aggregator events
45
- */
46
- export interface AggregatorEvents {
47
- 'request:started': (event: RequestEvent) => void;
48
- 'request:completed': (event: RequestEvent) => void;
49
- 'request:failed': (event: RequestEvent) => void;
50
- 'request:retried': (event: RequestEvent) => void;
51
- 'circuit:opened': (event: CircuitEvent) => void;
52
- 'circuit:closed': (event: CircuitEvent) => void;
53
- 'circuit:half-open': (event: CircuitEvent) => void;
54
- }
55
- /**
56
- * Request event data
57
- */
58
- export interface RequestEvent {
59
- readonly requestId: string;
60
- readonly toolName: string;
61
- readonly serverId?: string;
62
- readonly durationMs?: number;
63
- readonly error?: Error;
64
- readonly retryAttempt?: number;
65
- readonly timestamp: Date;
66
- }
67
- /**
68
- * Circuit breaker event data
69
- */
70
- export interface CircuitEvent {
71
- readonly serverId: string;
72
- readonly previousState: CircuitBreakerState;
73
- readonly newState: CircuitBreakerState;
74
- readonly timestamp: Date;
75
- }
76
- /**
77
- * MCP Aggregator (Super MCP Pattern)
78
- *
79
- * Routes tool invocation requests to appropriate servers based on
80
- * capabilities, health status, and configured routing strategies.
81
- * Implements circuit breaker pattern for fault tolerance.
82
- *
83
- * @example
84
- * ```typescript
85
- * const aggregator = new MCPAggregator(registry, {
86
- * defaultStrategy: 'health-aware',
87
- * enableRetries: true,
88
- * maxRetries: 3,
89
- * enableCircuitBreaker: true,
90
- * });
91
- *
92
- * // Invoke a tool
93
- * const response = await aggregator.invoke({
94
- * name: 'drift_detection',
95
- * arguments: { action: 'detect' },
96
- * });
97
- *
98
- * // Use specific routing strategy
99
- * const response = await aggregator.invokeWithStrategy(
100
- * { name: 'my-tool' },
101
- * 'least-latency',
102
- * );
103
- * ```
104
- */
105
- export declare class MCPAggregator extends EventEmitter<AggregatorEvents> {
106
- private readonly registry;
107
- /** Configuration */
108
- private readonly config;
109
- /** Discovery service */
110
- private readonly discovery;
111
- /** Circuit breaker states by server ID */
112
- private readonly circuitBreakers;
113
- /** Round-robin index by tool name */
114
- private readonly roundRobinIndex;
115
- /** Request counter for generating IDs */
116
- private requestCounter;
117
- /** Tool handler registry for direct invocation */
118
- private readonly toolHandlers;
119
- /**
120
- * Creates a new MCPAggregator
121
- *
122
- * @param registry - The server registry
123
- * @param config - Aggregator configuration
124
- */
125
- constructor(registry: MCPServerRegistry, config?: AggregatorConfig);
126
- /**
127
- * Invoke a tool using the default routing strategy
128
- *
129
- * @param request - Tool invocation request
130
- * @returns Tool invocation response
131
- * @throws {NoServerAvailableError} If no server can handle the tool
132
- * @throws {ToolInvocationTimeoutError} If the invocation times out
133
- * @throws {RetryExhaustedError} If all retries are exhausted
134
- */
135
- invoke(request: ToolInvocationRequest): Promise<ToolInvocationResponse>;
136
- /**
137
- * Invoke a tool with a specific routing strategy
138
- *
139
- * @param request - Tool invocation request
140
- * @param strategy - Routing strategy to use
141
- * @returns Tool invocation response
142
- */
143
- invokeWithStrategy(request: ToolInvocationRequest, strategy: RoutingStrategy): Promise<ToolInvocationResponse>;
144
- /**
145
- * Invoke multiple tools in parallel
146
- *
147
- * @param requests - Array of tool invocation requests
148
- * @returns Array of tool invocation responses
149
- */
150
- invokeParallel(requests: readonly ToolInvocationRequest[]): Promise<readonly ToolInvocationResponse[]>;
151
- /**
152
- * Invoke tools in sequence
153
- *
154
- * @param requests - Array of tool invocation requests
155
- * @returns Array of tool invocation responses
156
- */
157
- invokeSequential(requests: readonly ToolInvocationRequest[]): Promise<readonly ToolInvocationResponse[]>;
158
- /**
159
- * Register a direct tool handler (for local execution)
160
- *
161
- * @param toolName - Tool name
162
- * @param handler - Tool handler function
163
- */
164
- registerToolHandler(toolName: string, handler: ToolHandler): void;
165
- /**
166
- * Unregister a tool handler
167
- *
168
- * @param toolName - Tool name
169
- */
170
- unregisterToolHandler(toolName: string): void;
171
- /**
172
- * Select a server for a tool using the specified strategy
173
- *
174
- * @param toolName - Tool name
175
- * @param strategy - Routing strategy
176
- * @param preferredServer - Optional preferred server ID
177
- * @returns Selected server or undefined
178
- */
179
- selectServer(toolName: string, strategy: RoutingStrategy, preferredServer?: string): Promise<MCPServerRegistration | undefined>;
180
- /**
181
- * Select server by highest priority
182
- */
183
- private selectByPriority;
184
- /**
185
- * Select server using round-robin
186
- */
187
- private selectRoundRobin;
188
- /**
189
- * Select server with lowest latency
190
- */
191
- private selectByLeastLatency;
192
- /**
193
- * Select random server
194
- */
195
- private selectRandom;
196
- /**
197
- * Select server using health-aware strategy
198
- */
199
- private selectHealthAware;
200
- /**
201
- * Check if circuit is open for a server
202
- *
203
- * @param serverId - Server ID
204
- * @returns True if circuit is open
205
- */
206
- isCircuitOpen(serverId: string): boolean;
207
- /**
208
- * Get circuit breaker status for a server
209
- *
210
- * @param serverId - Server ID
211
- * @returns Circuit breaker status
212
- */
213
- getCircuitStatus(serverId: string): CircuitBreakerStatus;
214
- /**
215
- * Get all circuit breaker statuses
216
- *
217
- * @returns Array of circuit breaker statuses
218
- */
219
- getAllCircuitStatuses(): readonly CircuitBreakerStatus[];
220
- /**
221
- * Manually reset a circuit breaker
222
- *
223
- * @param serverId - Server ID
224
- */
225
- resetCircuit(serverId: string): void;
226
- /**
227
- * Manually open a circuit breaker
228
- *
229
- * @param serverId - Server ID
230
- */
231
- openCircuit(serverId: string): void;
232
- /**
233
- * Record a successful request
234
- */
235
- private recordSuccess;
236
- /**
237
- * Record a failed request
238
- */
239
- private recordFailure;
240
- /**
241
- * Transition circuit to a new state
242
- */
243
- private transitionCircuit;
244
- /**
245
- * Get or create circuit breaker state
246
- */
247
- private getOrCreateCircuitState;
248
- /** Track last attempted server for failure recording */
249
- private lastAttemptedServerId?;
250
- /**
251
- * Execute tool with timeout
252
- */
253
- private executeWithTimeout;
254
- /**
255
- * Execute a function with timeout
256
- */
257
- private executeWithTimeoutInternal;
258
- /**
259
- * Create a placeholder result for demonstration
260
- */
261
- private createPlaceholderResult;
262
- /**
263
- * Get the last attempted server ID
264
- */
265
- private getLastAttemptedServerId;
266
- /**
267
- * Check if a server provides a tool
268
- */
269
- private serverProvidesTool;
270
- /**
271
- * Generate a unique request ID
272
- */
273
- private generateRequestId;
274
- /**
275
- * Delay for specified milliseconds
276
- */
277
- private delay;
278
- /**
279
- * Emit a request event
280
- */
281
- private emitRequestEvent;
282
- /**
283
- * Get aggregator statistics
284
- *
285
- * @returns Aggregator statistics
286
- */
287
- getStats(): AggregatorStats;
288
- /**
289
- * Get the current configuration
290
- *
291
- * @returns Current aggregator configuration
292
- */
293
- getConfig(): Readonly<Required<AggregatorConfig>>;
294
- }
295
- /**
296
- * Tool handler function type
297
- */
298
- export type ToolHandler = (args: Record<string, unknown>) => Promise<ToolResult>;
299
- /**
300
- * Aggregator statistics
301
- */
302
- export interface AggregatorStats {
303
- /** Number of open circuit breakers */
304
- readonly openCircuits: number;
305
- /** Number of half-open circuit breakers */
306
- readonly halfOpenCircuits: number;
307
- /** Number of closed circuit breakers */
308
- readonly closedCircuits: number;
309
- /** Total requests processed */
310
- readonly totalRequests: number;
311
- /** Number of registered direct handlers */
312
- readonly registeredHandlers: number;
313
- }
314
- /**
315
- * Create a new MCPAggregator
316
- *
317
- * @param registry - The server registry
318
- * @param config - Optional aggregator configuration
319
- * @returns New aggregator instance
320
- *
321
- * @example
322
- * ```typescript
323
- * const aggregator = createMCPAggregator(registry, {
324
- * defaultStrategy: 'health-aware',
325
- * enableRetries: true,
326
- * });
327
- * ```
328
- */
329
- export declare function createMCPAggregator(registry: MCPServerRegistry, config?: AggregatorConfig): MCPAggregator;
330
- //# sourceMappingURL=aggregator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../src/aggregator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAM7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;aAE7B,QAAQ,EAAE,MAAM;gBAAhB,QAAQ,EAAE,MAAM,EAChC,OAAO,CAAC,EAAE,MAAM;CAKnB;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;aAEjC,QAAQ,EAAE,MAAM;aAChB,SAAS,EAAE,MAAM;gBADjB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjC,OAAO,CAAC,EAAE,MAAM;CAOnB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;aAE9B,QAAQ,EAAE,MAAM;gBAAhB,QAAQ,EAAE,MAAM,EAChC,OAAO,CAAC,EAAE,MAAM;CAKnB;AAED;;G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