@juspay/neurolink 9.42.0 → 9.42.1
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/CHANGELOG.md +2 -0
- package/dist/auth/anthropicOAuth.js +12 -0
- package/dist/browser/neurolink.min.js +337 -336
- package/dist/cli/commands/mcp.d.ts +6 -0
- package/dist/cli/commands/mcp.js +188 -184
- package/dist/cli/commands/proxy.js +537 -518
- package/dist/core/baseProvider.d.ts +6 -1
- package/dist/core/baseProvider.js +208 -230
- package/dist/core/factory.d.ts +3 -0
- package/dist/core/factory.js +138 -188
- package/dist/evaluation/pipeline/evaluationPipeline.js +5 -2
- package/dist/evaluation/scorers/scorerRegistry.d.ts +3 -0
- package/dist/evaluation/scorers/scorerRegistry.js +353 -282
- package/dist/lib/auth/anthropicOAuth.js +12 -0
- package/dist/lib/core/baseProvider.d.ts +6 -1
- package/dist/lib/core/baseProvider.js +208 -230
- package/dist/lib/core/factory.d.ts +3 -0
- package/dist/lib/core/factory.js +138 -188
- package/dist/lib/evaluation/pipeline/evaluationPipeline.js +5 -2
- package/dist/lib/evaluation/scorers/scorerRegistry.d.ts +3 -0
- package/dist/lib/evaluation/scorers/scorerRegistry.js +353 -282
- package/dist/lib/mcp/toolRegistry.d.ts +2 -0
- package/dist/lib/mcp/toolRegistry.js +32 -31
- package/dist/lib/neurolink.d.ts +38 -0
- package/dist/lib/neurolink.js +1858 -1689
- package/dist/lib/providers/googleAiStudio.js +0 -5
- package/dist/lib/providers/googleVertex.d.ts +10 -0
- package/dist/lib/providers/googleVertex.js +436 -444
- package/dist/lib/providers/litellm.d.ts +1 -0
- package/dist/lib/providers/litellm.js +73 -64
- package/dist/lib/providers/ollama.js +17 -4
- package/dist/lib/providers/openAI.d.ts +2 -0
- package/dist/lib/providers/openAI.js +139 -140
- package/dist/lib/proxy/claudeFormat.js +12 -4
- package/dist/lib/proxy/oauthFetch.js +298 -318
- package/dist/lib/proxy/proxyConfig.js +3 -1
- package/dist/lib/proxy/proxyFetch.js +250 -222
- package/dist/lib/proxy/requestLogger.js +132 -45
- package/dist/lib/proxy/sseInterceptor.js +36 -11
- package/dist/lib/server/routes/claudeProxyRoutes.d.ts +10 -1
- package/dist/lib/server/routes/claudeProxyRoutes.js +2726 -2272
- package/dist/lib/services/server/ai/observability/instrumentation.js +194 -218
- package/dist/lib/tasks/backends/bullmqBackend.js +24 -18
- package/dist/lib/tasks/store/redisTaskStore.js +23 -16
- package/dist/lib/tasks/taskManager.d.ts +2 -0
- package/dist/lib/tasks/taskManager.js +100 -5
- package/dist/lib/telemetry/telemetryService.js +9 -5
- package/dist/lib/types/proxyTypes.d.ts +124 -1
- package/dist/lib/utils/providerHealth.d.ts +1 -0
- package/dist/lib/utils/providerHealth.js +46 -31
- package/dist/lib/utils/providerUtils.js +11 -22
- package/dist/mcp/toolRegistry.d.ts +2 -0
- package/dist/mcp/toolRegistry.js +32 -31
- package/dist/neurolink.d.ts +38 -0
- package/dist/neurolink.js +1858 -1689
- package/dist/providers/googleAiStudio.js +0 -5
- package/dist/providers/googleVertex.d.ts +10 -0
- package/dist/providers/googleVertex.js +436 -444
- package/dist/providers/litellm.d.ts +1 -0
- package/dist/providers/litellm.js +73 -64
- package/dist/providers/ollama.js +17 -4
- package/dist/providers/openAI.d.ts +2 -0
- package/dist/providers/openAI.js +139 -140
- package/dist/proxy/claudeFormat.js +12 -4
- package/dist/proxy/oauthFetch.js +298 -318
- package/dist/proxy/proxyConfig.js +3 -1
- package/dist/proxy/proxyFetch.js +250 -222
- package/dist/proxy/requestLogger.js +132 -45
- package/dist/proxy/sseInterceptor.js +36 -11
- package/dist/server/routes/claudeProxyRoutes.d.ts +10 -1
- package/dist/server/routes/claudeProxyRoutes.js +2726 -2272
- package/dist/services/server/ai/observability/instrumentation.js +194 -218
- package/dist/tasks/backends/bullmqBackend.js +24 -18
- package/dist/tasks/store/redisTaskStore.js +23 -16
- package/dist/tasks/taskManager.d.ts +2 -0
- package/dist/tasks/taskManager.js +100 -5
- package/dist/telemetry/telemetryService.js +9 -5
- package/dist/types/proxyTypes.d.ts +124 -1
- package/dist/utils/providerHealth.d.ts +1 -0
- package/dist/utils/providerHealth.js +46 -31
- package/dist/utils/providerUtils.js +12 -22
- package/package.json +3 -2
- package/scripts/observability/check-proxy-telemetry.mjs +1 -1
- package/scripts/observability/manage-local-openobserve.sh +36 -5
|
@@ -163,4 +163,10 @@ export declare class MCPCommandFactory {
|
|
|
163
163
|
* Execute annotate command
|
|
164
164
|
*/
|
|
165
165
|
private static executeAnnotate;
|
|
166
|
+
private static getMCPStatusWithTimeout;
|
|
167
|
+
private static listToolAnnotations;
|
|
168
|
+
private static collectToolAnnotations;
|
|
169
|
+
private static findToolForAnnotation;
|
|
170
|
+
private static buildAnnotationsFromArgs;
|
|
171
|
+
private static printAnnotationUpdate;
|
|
166
172
|
}
|
package/dist/cli/commands/mcp.js
CHANGED
|
@@ -115,6 +115,7 @@ const POPULAR_MCP_SERVERS = {
|
|
|
115
115
|
description: "Bitbucket repository management and development workflows",
|
|
116
116
|
},
|
|
117
117
|
};
|
|
118
|
+
const MCP_STATUS_TIMEOUT_MS = 30_000;
|
|
118
119
|
/**
|
|
119
120
|
* MCP CLI command factory
|
|
120
121
|
*/
|
|
@@ -565,7 +566,7 @@ export class MCPCommandFactory {
|
|
|
565
566
|
? null
|
|
566
567
|
: ora("Testing MCP server connections...").start();
|
|
567
568
|
const sdk = new NeuroLink();
|
|
568
|
-
await sdk.
|
|
569
|
+
await this.getMCPStatusWithTimeout(sdk, Number(argv.timeout) || MCP_STATUS_TIMEOUT_MS);
|
|
569
570
|
let serversToTest = await sdk.listMCPServers();
|
|
570
571
|
if (targetServer) {
|
|
571
572
|
serversToTest = serversToTest.filter((s) => s.name === targetServer);
|
|
@@ -655,7 +656,7 @@ export class MCPCommandFactory {
|
|
|
655
656
|
}
|
|
656
657
|
}
|
|
657
658
|
const sdk = new NeuroLink();
|
|
658
|
-
await
|
|
659
|
+
await this.getMCPStatusWithTimeout(sdk);
|
|
659
660
|
// Check if server exists and is connected
|
|
660
661
|
const allServers = await sdk.listMCPServers();
|
|
661
662
|
const server = allServers.find((s) => s.name === serverName);
|
|
@@ -764,7 +765,7 @@ export class MCPCommandFactory {
|
|
|
764
765
|
process.exit(1);
|
|
765
766
|
}
|
|
766
767
|
const sdk = new NeuroLink();
|
|
767
|
-
await
|
|
768
|
+
await this.getMCPStatusWithTimeout(sdk);
|
|
768
769
|
const allServers = await sdk.listMCPServers();
|
|
769
770
|
const server = allServers.find((s) => s.name === serverName);
|
|
770
771
|
if (!server) {
|
|
@@ -2234,154 +2235,23 @@ ${tools.length > 0 ? tools.map((t) => `- **${t}**: TODO: Add description`).join(
|
|
|
2234
2235
|
try {
|
|
2235
2236
|
const sdk = new NeuroLink();
|
|
2236
2237
|
const servers = await sdk.listMCPServers();
|
|
2237
|
-
// List mode - show all tools with annotations
|
|
2238
2238
|
if (argv.list) {
|
|
2239
|
-
|
|
2240
|
-
? null
|
|
2241
|
-
: ora("Loading tool annotations...").start();
|
|
2242
|
-
const allTools = [];
|
|
2243
|
-
for (const server of servers) {
|
|
2244
|
-
if (server.status !== "connected") {
|
|
2245
|
-
continue;
|
|
2246
|
-
}
|
|
2247
|
-
for (const tool of server.tools || []) {
|
|
2248
|
-
const existing = tool
|
|
2249
|
-
.annotations;
|
|
2250
|
-
const annotations = existing ??
|
|
2251
|
-
inferAnnotations({
|
|
2252
|
-
name: tool.name,
|
|
2253
|
-
description: tool.description,
|
|
2254
|
-
});
|
|
2255
|
-
allTools.push({
|
|
2256
|
-
serverName: server.name,
|
|
2257
|
-
serverId: server.id,
|
|
2258
|
-
toolName: tool.name,
|
|
2259
|
-
description: tool.description,
|
|
2260
|
-
annotations,
|
|
2261
|
-
});
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
if (spinner) {
|
|
2265
|
-
spinner.succeed(`Found ${allTools.length} tools`);
|
|
2266
|
-
}
|
|
2267
|
-
if (argv.format === "json") {
|
|
2268
|
-
logger.always(JSON.stringify(allTools, null, 2));
|
|
2269
|
-
return;
|
|
2270
|
-
}
|
|
2271
|
-
logger.always(chalk.bold("\n Tool Annotations:\n"));
|
|
2272
|
-
// Group by server
|
|
2273
|
-
const byServer = allTools.reduce((acc, tool) => {
|
|
2274
|
-
if (!acc[tool.serverId]) {
|
|
2275
|
-
acc[tool.serverId] = {
|
|
2276
|
-
serverName: tool.serverName,
|
|
2277
|
-
tools: [],
|
|
2278
|
-
};
|
|
2279
|
-
}
|
|
2280
|
-
acc[tool.serverId].tools.push(tool);
|
|
2281
|
-
return acc;
|
|
2282
|
-
}, {});
|
|
2283
|
-
for (const [serverId, { serverName, tools }] of Object.entries(byServer)) {
|
|
2284
|
-
logger.always(chalk.cyan.bold(`\n${serverName} (${serverId}):`));
|
|
2285
|
-
for (const tool of tools) {
|
|
2286
|
-
const annotationStr = getAnnotationSummary(tool.annotations);
|
|
2287
|
-
logger.always(` ${chalk.yellow(tool.toolName)} ${chalk.gray(annotationStr)}`);
|
|
2288
|
-
if (argv.detailed) {
|
|
2289
|
-
logger.always(` ${chalk.gray(tool.description)}`);
|
|
2290
|
-
}
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
logger.always();
|
|
2239
|
+
await this.listToolAnnotations(servers, argv);
|
|
2294
2240
|
return;
|
|
2295
2241
|
}
|
|
2296
|
-
// Annotate specific tool
|
|
2297
2242
|
const toolName = argv.tool;
|
|
2298
2243
|
if (!toolName) {
|
|
2299
2244
|
logger.error(chalk.red("Tool name is required. Use --tool <name> or --list to see all tools."));
|
|
2300
2245
|
process.exit(1);
|
|
2301
2246
|
}
|
|
2302
|
-
// Find the tool
|
|
2303
|
-
let foundTool = null;
|
|
2304
2247
|
const serverId = argv.server;
|
|
2305
|
-
|
|
2306
|
-
if (serverId && server.id !== serverId) {
|
|
2307
|
-
continue;
|
|
2308
|
-
}
|
|
2309
|
-
for (const tool of server.tools || []) {
|
|
2310
|
-
if (tool.name === toolName) {
|
|
2311
|
-
foundTool = {
|
|
2312
|
-
name: tool.name,
|
|
2313
|
-
description: tool.description,
|
|
2314
|
-
serverId: server.id,
|
|
2315
|
-
serverName: server.name,
|
|
2316
|
-
};
|
|
2317
|
-
break;
|
|
2318
|
-
}
|
|
2319
|
-
}
|
|
2320
|
-
if (foundTool) {
|
|
2321
|
-
break;
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2248
|
+
const foundTool = this.findToolForAnnotation(servers, toolName, serverId);
|
|
2324
2249
|
if (!foundTool) {
|
|
2325
2250
|
logger.error(chalk.red(`Tool '${toolName}' not found.${serverId ? ` Server: ${serverId}` : ""}`));
|
|
2326
2251
|
logger.always(chalk.yellow("Use 'neurolink mcp annotate --list' to see available tools."));
|
|
2327
2252
|
process.exit(1);
|
|
2328
2253
|
}
|
|
2329
|
-
|
|
2330
|
-
let annotations = {};
|
|
2331
|
-
// Parse JSON annotations if provided
|
|
2332
|
-
if (argv.annotations) {
|
|
2333
|
-
try {
|
|
2334
|
-
const parsed = JSON.parse(argv.annotations);
|
|
2335
|
-
annotations = { ...annotations, ...parsed };
|
|
2336
|
-
}
|
|
2337
|
-
catch {
|
|
2338
|
-
logger.error(chalk.red("Invalid JSON in --annotations"));
|
|
2339
|
-
process.exit(1);
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
// Apply individual annotation flags
|
|
2343
|
-
if (argv["read-only"] !== undefined) {
|
|
2344
|
-
annotations.readOnlyHint = argv["read-only"];
|
|
2345
|
-
}
|
|
2346
|
-
if (argv.destructive !== undefined) {
|
|
2347
|
-
annotations.destructiveHint = argv.destructive;
|
|
2348
|
-
}
|
|
2349
|
-
if (argv.idempotent !== undefined) {
|
|
2350
|
-
annotations.idempotentHint = argv.idempotent;
|
|
2351
|
-
}
|
|
2352
|
-
if (argv["requires-confirmation"] !== undefined) {
|
|
2353
|
-
annotations.requiresConfirmation = argv["requires-confirmation"];
|
|
2354
|
-
}
|
|
2355
|
-
if (argv.tags) {
|
|
2356
|
-
annotations.tags = argv.tags;
|
|
2357
|
-
}
|
|
2358
|
-
if (argv["estimated-duration"] !== undefined) {
|
|
2359
|
-
annotations.estimatedDuration = argv["estimated-duration"];
|
|
2360
|
-
}
|
|
2361
|
-
if (argv["rate-limit"] !== undefined) {
|
|
2362
|
-
annotations.rateLimitHint = argv["rate-limit"];
|
|
2363
|
-
}
|
|
2364
|
-
if (argv.cost !== undefined) {
|
|
2365
|
-
annotations.costHint = argv.cost;
|
|
2366
|
-
}
|
|
2367
|
-
if (argv.complexity) {
|
|
2368
|
-
annotations.complexity = argv.complexity;
|
|
2369
|
-
}
|
|
2370
|
-
if (argv["security-level"]) {
|
|
2371
|
-
annotations.securityLevel = argv["security-level"];
|
|
2372
|
-
}
|
|
2373
|
-
if (argv.audit !== undefined) {
|
|
2374
|
-
annotations.auditRequired = argv.audit;
|
|
2375
|
-
}
|
|
2376
|
-
// Infer annotations if requested
|
|
2377
|
-
if (argv.infer) {
|
|
2378
|
-
const inferred = inferAnnotations({
|
|
2379
|
-
name: foundTool.name,
|
|
2380
|
-
description: foundTool.description,
|
|
2381
|
-
});
|
|
2382
|
-
annotations = mergeAnnotations(inferred, annotations);
|
|
2383
|
-
}
|
|
2384
|
-
// Validate annotations
|
|
2254
|
+
const annotations = this.buildAnnotationsFromArgs(argv, foundTool);
|
|
2385
2255
|
const errors = validateAnnotations(annotations);
|
|
2386
2256
|
if (errors.length > 0) {
|
|
2387
2257
|
logger.error(chalk.red("Annotation validation errors:"));
|
|
@@ -2396,63 +2266,197 @@ ${tools.length > 0 ? tools.map((t) => `- **${t}**: TODO: Add description`).join(
|
|
|
2396
2266
|
logger.always(JSON.stringify(annotations, null, 2));
|
|
2397
2267
|
return;
|
|
2398
2268
|
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
logger.
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2269
|
+
this.printAnnotationUpdate(foundTool, annotations);
|
|
2270
|
+
}
|
|
2271
|
+
catch (error) {
|
|
2272
|
+
logger.error(chalk.red(`Annotate command failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
2273
|
+
process.exit(1);
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
static async getMCPStatusWithTimeout(sdk, timeoutMs = MCP_STATUS_TIMEOUT_MS) {
|
|
2277
|
+
return withTimeout(sdk.getMCPStatus(), timeoutMs, ErrorFactory.toolTimeout("mcpStatus", timeoutMs));
|
|
2278
|
+
}
|
|
2279
|
+
static async listToolAnnotations(servers, argv) {
|
|
2280
|
+
const spinner = argv.quiet
|
|
2281
|
+
? null
|
|
2282
|
+
: ora("Loading tool annotations...").start();
|
|
2283
|
+
const allTools = this.collectToolAnnotations(servers);
|
|
2284
|
+
if (spinner) {
|
|
2285
|
+
spinner.succeed(`Found ${allTools.length} tools`);
|
|
2286
|
+
}
|
|
2287
|
+
if (argv.format === "json") {
|
|
2288
|
+
logger.always(JSON.stringify(allTools, null, 2));
|
|
2289
|
+
return;
|
|
2290
|
+
}
|
|
2291
|
+
logger.always(chalk.bold("\n Tool Annotations:\n"));
|
|
2292
|
+
const byServer = allTools.reduce((acc, tool) => {
|
|
2293
|
+
if (!acc[tool.serverId]) {
|
|
2294
|
+
acc[tool.serverId] = {
|
|
2295
|
+
serverName: tool.serverName,
|
|
2296
|
+
tools: [],
|
|
2297
|
+
};
|
|
2417
2298
|
}
|
|
2418
|
-
|
|
2419
|
-
|
|
2299
|
+
acc[tool.serverId].tools.push(tool);
|
|
2300
|
+
return acc;
|
|
2301
|
+
}, {});
|
|
2302
|
+
for (const [serverId, { serverName, tools }] of Object.entries(byServer)) {
|
|
2303
|
+
logger.always(chalk.cyan.bold(`\n${serverName} (${serverId}):`));
|
|
2304
|
+
for (const tool of tools) {
|
|
2305
|
+
logger.always(` ${chalk.yellow(tool.toolName)} ${chalk.gray(getAnnotationSummary(tool.annotations))}`);
|
|
2306
|
+
if (argv.detailed) {
|
|
2307
|
+
logger.always(` ${chalk.gray(tool.description)}`);
|
|
2308
|
+
}
|
|
2420
2309
|
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2310
|
+
}
|
|
2311
|
+
logger.always();
|
|
2312
|
+
}
|
|
2313
|
+
static collectToolAnnotations(servers) {
|
|
2314
|
+
const allTools = [];
|
|
2315
|
+
for (const server of servers) {
|
|
2316
|
+
if (server.status !== "connected") {
|
|
2317
|
+
continue;
|
|
2423
2318
|
}
|
|
2424
|
-
|
|
2425
|
-
|
|
2319
|
+
for (const tool of server.tools || []) {
|
|
2320
|
+
const existing = tool
|
|
2321
|
+
.annotations;
|
|
2322
|
+
allTools.push({
|
|
2323
|
+
serverName: server.name,
|
|
2324
|
+
serverId: server.id,
|
|
2325
|
+
toolName: tool.name,
|
|
2326
|
+
description: tool.description,
|
|
2327
|
+
annotations: existing ??
|
|
2328
|
+
inferAnnotations({
|
|
2329
|
+
name: tool.name,
|
|
2330
|
+
description: tool.description,
|
|
2331
|
+
}),
|
|
2332
|
+
});
|
|
2426
2333
|
}
|
|
2427
|
-
|
|
2428
|
-
|
|
2334
|
+
}
|
|
2335
|
+
return allTools;
|
|
2336
|
+
}
|
|
2337
|
+
static findToolForAnnotation(servers, toolName, serverId) {
|
|
2338
|
+
for (const server of servers) {
|
|
2339
|
+
if (serverId && server.id !== serverId) {
|
|
2340
|
+
continue;
|
|
2429
2341
|
}
|
|
2430
|
-
|
|
2431
|
-
|
|
2342
|
+
for (const tool of server.tools || []) {
|
|
2343
|
+
if (tool.name === toolName) {
|
|
2344
|
+
return {
|
|
2345
|
+
name: tool.name,
|
|
2346
|
+
description: tool.description,
|
|
2347
|
+
serverId: server.id,
|
|
2348
|
+
serverName: server.name,
|
|
2349
|
+
};
|
|
2350
|
+
}
|
|
2432
2351
|
}
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2352
|
+
}
|
|
2353
|
+
return null;
|
|
2354
|
+
}
|
|
2355
|
+
static buildAnnotationsFromArgs(argv, foundTool) {
|
|
2356
|
+
let annotations = {};
|
|
2357
|
+
if (argv.annotations) {
|
|
2358
|
+
try {
|
|
2359
|
+
annotations = {
|
|
2360
|
+
...annotations,
|
|
2361
|
+
...JSON.parse(argv.annotations),
|
|
2362
|
+
};
|
|
2440
2363
|
}
|
|
2441
|
-
|
|
2442
|
-
logger.
|
|
2364
|
+
catch {
|
|
2365
|
+
logger.error(chalk.red("Invalid JSON in --annotations"));
|
|
2366
|
+
process.exit(1);
|
|
2443
2367
|
}
|
|
2444
|
-
logger.always();
|
|
2445
|
-
logger.always(chalk.gray(" Summary: ") + getAnnotationSummary(annotations));
|
|
2446
|
-
logger.always();
|
|
2447
|
-
// Note: In a full implementation, this would persist the annotations
|
|
2448
|
-
// to a configuration file or database. For now, we just display them.
|
|
2449
|
-
logger.always(chalk.blue("Note: Annotations displayed above. To persist annotations, add them to your MCP server configuration."));
|
|
2450
|
-
logger.always(chalk.gray(`Example: Add to your server's tool definition or use environment-specific annotation overrides.`));
|
|
2451
2368
|
}
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2369
|
+
if (argv["read-only"] !== undefined) {
|
|
2370
|
+
annotations.readOnlyHint = argv["read-only"];
|
|
2371
|
+
}
|
|
2372
|
+
if (argv.destructive !== undefined) {
|
|
2373
|
+
annotations.destructiveHint = argv.destructive;
|
|
2374
|
+
}
|
|
2375
|
+
if (argv.idempotent !== undefined) {
|
|
2376
|
+
annotations.idempotentHint = argv.idempotent;
|
|
2377
|
+
}
|
|
2378
|
+
if (argv["requires-confirmation"] !== undefined) {
|
|
2379
|
+
annotations.requiresConfirmation = argv["requires-confirmation"];
|
|
2380
|
+
}
|
|
2381
|
+
if (argv.tags) {
|
|
2382
|
+
annotations.tags = argv.tags;
|
|
2383
|
+
}
|
|
2384
|
+
if (argv["estimated-duration"] !== undefined) {
|
|
2385
|
+
annotations.estimatedDuration = argv["estimated-duration"];
|
|
2386
|
+
}
|
|
2387
|
+
if (argv["rate-limit"] !== undefined) {
|
|
2388
|
+
annotations.rateLimitHint = argv["rate-limit"];
|
|
2389
|
+
}
|
|
2390
|
+
if (argv.cost !== undefined) {
|
|
2391
|
+
annotations.costHint = argv.cost;
|
|
2392
|
+
}
|
|
2393
|
+
if (argv.complexity) {
|
|
2394
|
+
annotations.complexity = argv.complexity;
|
|
2395
|
+
}
|
|
2396
|
+
if (argv["security-level"]) {
|
|
2397
|
+
annotations.securityLevel = argv["security-level"];
|
|
2398
|
+
}
|
|
2399
|
+
if (argv.audit !== undefined) {
|
|
2400
|
+
annotations.auditRequired = argv.audit;
|
|
2401
|
+
}
|
|
2402
|
+
if (argv.infer) {
|
|
2403
|
+
annotations = mergeAnnotations(inferAnnotations({
|
|
2404
|
+
name: foundTool.name,
|
|
2405
|
+
description: foundTool.description,
|
|
2406
|
+
}), annotations);
|
|
2407
|
+
}
|
|
2408
|
+
return annotations;
|
|
2409
|
+
}
|
|
2410
|
+
static printAnnotationUpdate(foundTool, annotations) {
|
|
2411
|
+
logger.always(chalk.bold("\n Tool Annotation Update:\n"));
|
|
2412
|
+
logger.always(` Server: ${chalk.cyan(foundTool.serverName)} (${foundTool.serverId})`);
|
|
2413
|
+
logger.always(` Tool: ${chalk.yellow(foundTool.name)}`);
|
|
2414
|
+
logger.always(` Description: ${chalk.gray(foundTool.description)}`);
|
|
2415
|
+
logger.always();
|
|
2416
|
+
logger.always(chalk.bold(" Annotations:"));
|
|
2417
|
+
if (annotations.readOnlyHint !== undefined) {
|
|
2418
|
+
logger.always(` readOnlyHint: ${annotations.readOnlyHint ? chalk.green("true") : chalk.red("false")}`);
|
|
2419
|
+
}
|
|
2420
|
+
if (annotations.destructiveHint !== undefined) {
|
|
2421
|
+
logger.always(` destructiveHint: ${annotations.destructiveHint ? chalk.red("true") : chalk.green("false")}`);
|
|
2422
|
+
}
|
|
2423
|
+
if (annotations.idempotentHint !== undefined) {
|
|
2424
|
+
logger.always(` idempotentHint: ${annotations.idempotentHint ? chalk.green("true") : chalk.gray("false")}`);
|
|
2425
|
+
}
|
|
2426
|
+
if (annotations.requiresConfirmation !== undefined) {
|
|
2427
|
+
logger.always(` requiresConfirmation: ${annotations.requiresConfirmation ? chalk.yellow("true") : chalk.gray("false")}`);
|
|
2428
|
+
}
|
|
2429
|
+
if (annotations.tags?.length) {
|
|
2430
|
+
logger.always(` tags: ${chalk.blue(annotations.tags.join(", "))}`);
|
|
2431
|
+
}
|
|
2432
|
+
if (annotations.estimatedDuration !== undefined) {
|
|
2433
|
+
logger.always(` estimatedDuration: ${annotations.estimatedDuration}ms`);
|
|
2434
|
+
}
|
|
2435
|
+
if (annotations.rateLimitHint !== undefined) {
|
|
2436
|
+
logger.always(` rateLimitHint: ${annotations.rateLimitHint} calls/min`);
|
|
2437
|
+
}
|
|
2438
|
+
if (annotations.costHint !== undefined) {
|
|
2439
|
+
logger.always(` costHint: ${annotations.costHint}`);
|
|
2440
|
+
}
|
|
2441
|
+
if (annotations.complexity) {
|
|
2442
|
+
logger.always(` complexity: ${chalk.cyan(annotations.complexity)}`);
|
|
2443
|
+
}
|
|
2444
|
+
if (annotations.securityLevel) {
|
|
2445
|
+
const secColor = annotations.securityLevel === "restricted"
|
|
2446
|
+
? chalk.red
|
|
2447
|
+
: annotations.securityLevel === "internal"
|
|
2448
|
+
? chalk.yellow
|
|
2449
|
+
: chalk.green;
|
|
2450
|
+
logger.always(` securityLevel: ${secColor(annotations.securityLevel)}`);
|
|
2451
|
+
}
|
|
2452
|
+
if (annotations.auditRequired !== undefined) {
|
|
2453
|
+
logger.always(` auditRequired: ${annotations.auditRequired ? chalk.yellow("true") : chalk.gray("false")}`);
|
|
2455
2454
|
}
|
|
2455
|
+
logger.always();
|
|
2456
|
+
logger.always(chalk.gray(" Summary: ") + getAnnotationSummary(annotations));
|
|
2457
|
+
logger.always();
|
|
2458
|
+
logger.always(chalk.blue("Note: Annotations displayed above. To persist annotations, add them to your MCP server configuration."));
|
|
2459
|
+
logger.always(chalk.gray("Example: Add to your server's tool definition or use environment-specific annotation overrides."));
|
|
2456
2460
|
}
|
|
2457
2461
|
}
|
|
2458
2462
|
//# sourceMappingURL=mcp.js.map
|