@usex/mikrotik-mcp 5.19.0 → 5.21.0
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 +180 -8
- package/dist/cli.js +3452 -729
- package/dist/index.js +148 -27
- package/dist/shared/{library-ppnv0f07.js → library-588vnctn.js} +1 -1
- package/dist/shared/{library-7wcv2ckk.js → library-6tvh3gq1.js} +2837 -545
- package/dist/shared/{library-tqrvrykj.js → library-g8far2nz.js} +1 -1
- package/dist/shared/{library-f3be6g03.js → library-k6m2bxjr.js} +1 -1
- package/dist/shared/{library-z7qsdq88.js → library-wj2xfx8h.js} +1 -1
- package/dist/ui/aaa.html +8 -8
- package/dist/ui/connected-devices.html +8 -8
- package/dist/ui/dashboard.html +16 -16
- package/dist/ui/fabric.html +11 -11
- package/dist/ui/firewall-audit.html +8 -8
- package/dist/ui/firewall.html +9 -9
- package/dist/ui/interfaces.html +8 -8
- package/dist/ui/investigations.html +11 -11
- package/dist/ui/observability.html +66 -62
- package/dist/ui/operations.html +11 -11
- package/dist/ui/records.html +12 -12
- package/dist/ui/reports.html +11 -11
- package/dist/ui/round-trip.html +11 -11
- package/dist/ui/service-health.html +11 -11
- package/package.json +24 -23
- package/prompts/audit-routeros-containers.md +27 -0
- package/prompts/audit-vlan-segmentation.md +31 -0
- package/prompts/setup-guest-wifi.md +23 -24
- package/prompts/setup-routeros-container.md +36 -0
- package/prompts/setup-v2ray-container-proxy.md +68 -194
- package/prompts/setup-vlan-network.md +27 -33
- package/schemas/README.md +1 -1
- package/schemas/devtools-manifest.json +327 -16
- package/schemas/tool-catalog.json +898 -109
- package/schemas/tools/add_container.json +42 -30
- package/schemas/tools/add_container_env.json +3 -4
- package/schemas/tools/add_container_mount.json +10 -4
- package/schemas/tools/apply_service_routing.json +23 -0
- package/schemas/tools/arm_service_routing.json +23 -0
- package/schemas/tools/configure_flight_recorder.json +30 -0
- package/schemas/tools/create_service_routing.json +91 -0
- package/schemas/tools/design_network_segment.json +22 -6
- package/schemas/tools/destroy_recovery_lab.json +18 -0
- package/schemas/tools/disconnect_ovpn_session.json +20 -0
- package/schemas/tools/export_network_incident.json +14 -0
- package/schemas/tools/freeze_network_incident.json +14 -0
- package/schemas/tools/get_container.json +11 -4
- package/schemas/tools/get_flight_recorder.json +7 -0
- package/schemas/tools/get_recovery_lab.json +7 -0
- package/schemas/tools/get_routeros_container_guide.json +22 -0
- package/schemas/tools/get_vlan_segmentation_guide.json +14 -0
- package/schemas/tools/list_container_envs.json +1 -1
- package/schemas/tools/list_container_mounts.json +7 -2
- package/schemas/tools/list_containers.json +2 -4
- package/schemas/tools/list_ovpn_sessions.json +7 -0
- package/schemas/tools/list_service_routing.json +7 -0
- package/schemas/tools/poll_recovery_lab.json +14 -0
- package/schemas/tools/prepare_recovery_lab.json +23 -0
- package/schemas/tools/preview_service_routing.json +23 -0
- package/schemas/tools/probe_service_routing.json +14 -0
- package/schemas/tools/recovery_lab_inventory.json +7 -0
- package/schemas/tools/remove_container.json +11 -4
- package/schemas/tools/remove_container_env.json +7 -3
- package/schemas/tools/remove_container_mount.json +18 -2
- package/schemas/tools/service_routing_address_page.json +19 -0
- package/schemas/tools/service_routing_inventory.json +7 -0
- package/schemas/tools/service_routing_traffic.json +14 -0
- package/schemas/tools/set_container_config.json +4 -6
- package/schemas/tools/start_container.json +11 -4
- package/schemas/tools/start_recovery_lab.json +18 -0
- package/schemas/tools/stop_container.json +11 -4
- package/schemas/tools/update_container.json +46 -6
- /package/dist/shared/{cli-j07tbrke.js → cli-h065ap70.js} +0 -0
- /package/dist/shared/{cli-s0rxncz4.js → cli-se3tgt7t.js} +0 -0
- /package/dist/shared/{cli-y00nwzxx.js → cli-t311px0m.js} +0 -0
- /package/dist/shared/{cli-gtq5bw8q.js → cli-wf9a7qjm.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -52,6 +52,14 @@ import {
|
|
|
52
52
|
registerTools2,
|
|
53
53
|
PROMPTS_DIR,
|
|
54
54
|
registerUiResources,
|
|
55
|
+
VLAN_GUIDE_URI,
|
|
56
|
+
getVlanSegmentationGuide,
|
|
57
|
+
VLAN_INSTRUCTIONS,
|
|
58
|
+
vlanPromptGuidance,
|
|
59
|
+
CONTAINER_GUIDE_URI,
|
|
60
|
+
getRouterosContainerGuide,
|
|
61
|
+
CONTAINER_INSTRUCTIONS,
|
|
62
|
+
containerPromptGuidance,
|
|
55
63
|
VERSION2,
|
|
56
64
|
WEBSITE_URL,
|
|
57
65
|
LOGO_URL,
|
|
@@ -62,7 +70,7 @@ import {
|
|
|
62
70
|
updateSummaryLine,
|
|
63
71
|
allToolModules2,
|
|
64
72
|
selectToolModules2
|
|
65
|
-
} from "./shared/library-
|
|
73
|
+
} from "./shared/library-6tvh3gq1.js";
|
|
66
74
|
|
|
67
75
|
// node_modules/ajv/dist/compile/codegen/code.js
|
|
68
76
|
var require_code = __commonJS(function(exports) {
|
|
@@ -12838,6 +12846,9 @@ class Protocol {
|
|
|
12838
12846
|
this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
|
|
12839
12847
|
const handleTaskResult = async () => {
|
|
12840
12848
|
const taskId = request.params.taskId;
|
|
12849
|
+
if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
|
|
12850
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
12851
|
+
}
|
|
12841
12852
|
if (this._taskMessageQueue) {
|
|
12842
12853
|
let queuedMessage;
|
|
12843
12854
|
while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
|
|
@@ -12868,12 +12879,12 @@ class Protocol {
|
|
|
12868
12879
|
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
12869
12880
|
}
|
|
12870
12881
|
if (!isTerminal(task.status)) {
|
|
12871
|
-
await this._waitForTaskUpdate(taskId, extra.signal);
|
|
12882
|
+
await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
|
|
12872
12883
|
return await handleTaskResult();
|
|
12873
12884
|
}
|
|
12874
12885
|
if (isTerminal(task.status)) {
|
|
12875
12886
|
const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
|
|
12876
|
-
this._clearTaskQueue(taskId);
|
|
12887
|
+
this._clearTaskQueue(taskId, extra.sessionId);
|
|
12877
12888
|
return {
|
|
12878
12889
|
...result,
|
|
12879
12890
|
_meta: {
|
|
@@ -12910,7 +12921,7 @@ class Protocol {
|
|
|
12910
12921
|
throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
|
|
12911
12922
|
}
|
|
12912
12923
|
await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
|
|
12913
|
-
this._clearTaskQueue(request.params.taskId);
|
|
12924
|
+
this._clearTaskQueue(request.params.taskId, extra.sessionId);
|
|
12914
12925
|
const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
|
12915
12926
|
if (!cancelledTask) {
|
|
12916
12927
|
throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
|
|
@@ -13033,6 +13044,19 @@ class Protocol {
|
|
|
13033
13044
|
const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
|
|
13034
13045
|
const capturedTransport = this._transport;
|
|
13035
13046
|
const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
|
|
13047
|
+
const sessionId = capturedTransport?.sessionId;
|
|
13048
|
+
const store = this._taskStore;
|
|
13049
|
+
let relatedTaskFound = true;
|
|
13050
|
+
let relatedTaskLookup;
|
|
13051
|
+
if (relatedTaskId && store && this._taskMessageQueue && sessionId !== undefined) {
|
|
13052
|
+
relatedTaskFound = false;
|
|
13053
|
+
relatedTaskLookup = (async () => {
|
|
13054
|
+
if (!await store.getTask(relatedTaskId, sessionId)) {
|
|
13055
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
|
|
13056
|
+
}
|
|
13057
|
+
relatedTaskFound = true;
|
|
13058
|
+
})();
|
|
13059
|
+
}
|
|
13036
13060
|
if (handler === undefined) {
|
|
13037
13061
|
const errorResponse = {
|
|
13038
13062
|
jsonrpc: "2.0",
|
|
@@ -13042,7 +13066,10 @@ class Protocol {
|
|
|
13042
13066
|
message: "Method not found"
|
|
13043
13067
|
}
|
|
13044
13068
|
};
|
|
13045
|
-
if (relatedTaskId &&
|
|
13069
|
+
if (relatedTaskId && relatedTaskLookup) {
|
|
13070
|
+
const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
|
|
13071
|
+
relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error) => this._onerror(new Error(`Failed to send an error response: ${error}`)));
|
|
13072
|
+
} else if (relatedTaskId && this._taskMessageQueue) {
|
|
13046
13073
|
this._enqueueTaskMessage(relatedTaskId, {
|
|
13047
13074
|
type: "error",
|
|
13048
13075
|
message: errorResponse,
|
|
@@ -13093,7 +13120,10 @@ class Protocol {
|
|
|
13093
13120
|
closeSSEStream: extra?.closeSSEStream,
|
|
13094
13121
|
closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
|
|
13095
13122
|
};
|
|
13096
|
-
Promise.resolve().then(() => {
|
|
13123
|
+
(relatedTaskLookup ?? Promise.resolve()).then(() => {
|
|
13124
|
+
if (relatedTaskLookup && abortController.signal.aborted) {
|
|
13125
|
+
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
13126
|
+
}
|
|
13097
13127
|
if (taskCreationParams) {
|
|
13098
13128
|
this.assertTaskHandlerCapability(request.method);
|
|
13099
13129
|
}
|
|
@@ -13128,7 +13158,7 @@ class Protocol {
|
|
|
13128
13158
|
...error["data"] !== undefined && { data: error["data"] }
|
|
13129
13159
|
}
|
|
13130
13160
|
};
|
|
13131
|
-
if (relatedTaskId && this._taskMessageQueue) {
|
|
13161
|
+
if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
|
|
13132
13162
|
await this._enqueueTaskMessage(relatedTaskId, {
|
|
13133
13163
|
type: "error",
|
|
13134
13164
|
message: errorResponse,
|
|
@@ -13516,7 +13546,7 @@ class Protocol {
|
|
|
13516
13546
|
throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
13517
13547
|
}
|
|
13518
13548
|
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
13519
|
-
await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
|
|
13549
|
+
await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
|
|
13520
13550
|
}
|
|
13521
13551
|
async _clearTaskQueue(taskId, sessionId) {
|
|
13522
13552
|
if (this._taskMessageQueue) {
|
|
@@ -13535,10 +13565,10 @@ class Protocol {
|
|
|
13535
13565
|
}
|
|
13536
13566
|
}
|
|
13537
13567
|
}
|
|
13538
|
-
async _waitForTaskUpdate(taskId, signal) {
|
|
13568
|
+
async _waitForTaskUpdate(taskId, signal, sessionId) {
|
|
13539
13569
|
let interval = this._options?.defaultTaskPollInterval ?? 1000;
|
|
13540
13570
|
try {
|
|
13541
|
-
const task = await this._taskStore?.getTask(taskId);
|
|
13571
|
+
const task = await this._taskStore?.getTask(taskId, sessionId);
|
|
13542
13572
|
if (task?.pollInterval) {
|
|
13543
13573
|
interval = task.pollInterval;
|
|
13544
13574
|
}
|
|
@@ -14206,6 +14236,43 @@ class ExperimentalMcpServerTasks {
|
|
|
14206
14236
|
}
|
|
14207
14237
|
|
|
14208
14238
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
14239
|
+
function toolInputElementCount(value, max) {
|
|
14240
|
+
let count = 0;
|
|
14241
|
+
const stack = [value];
|
|
14242
|
+
while (stack.length > 0) {
|
|
14243
|
+
const node = stack.pop();
|
|
14244
|
+
if (node === null || typeof node !== "object")
|
|
14245
|
+
continue;
|
|
14246
|
+
if (Array.isArray(node)) {
|
|
14247
|
+
for (const child of node) {
|
|
14248
|
+
if (++count > max)
|
|
14249
|
+
return count;
|
|
14250
|
+
if (child !== null && typeof child === "object")
|
|
14251
|
+
stack.push(child);
|
|
14252
|
+
}
|
|
14253
|
+
} else {
|
|
14254
|
+
for (const key in node) {
|
|
14255
|
+
if (!Object.prototype.hasOwnProperty.call(node, key))
|
|
14256
|
+
continue;
|
|
14257
|
+
if (++count > max)
|
|
14258
|
+
return count;
|
|
14259
|
+
const child = node[key];
|
|
14260
|
+
if (child !== null && typeof child === "object")
|
|
14261
|
+
stack.push(child);
|
|
14262
|
+
}
|
|
14263
|
+
}
|
|
14264
|
+
}
|
|
14265
|
+
return count;
|
|
14266
|
+
}
|
|
14267
|
+
function resolveMaxToolInputElements(value) {
|
|
14268
|
+
if (value === undefined || value === Infinity)
|
|
14269
|
+
return;
|
|
14270
|
+
if (typeof value !== "number" || Number.isNaN(value) || value < 1) {
|
|
14271
|
+
throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
|
|
14272
|
+
}
|
|
14273
|
+
return value;
|
|
14274
|
+
}
|
|
14275
|
+
|
|
14209
14276
|
class McpServer {
|
|
14210
14277
|
constructor(serverInfo, options) {
|
|
14211
14278
|
this._registeredResources = {};
|
|
@@ -14217,6 +14284,7 @@ class McpServer {
|
|
|
14217
14284
|
this._resourceHandlersInitialized = false;
|
|
14218
14285
|
this._promptHandlersInitialized = false;
|
|
14219
14286
|
this.server = new Server(serverInfo, options);
|
|
14287
|
+
this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
|
|
14220
14288
|
}
|
|
14221
14289
|
get experimental() {
|
|
14222
14290
|
if (!this._experimental) {
|
|
@@ -14323,12 +14391,15 @@ class McpServer {
|
|
|
14323
14391
|
};
|
|
14324
14392
|
}
|
|
14325
14393
|
async validateToolInput(tool, args, toolName) {
|
|
14394
|
+
if (this._maxToolInputElements !== undefined && toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) {
|
|
14395
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
|
|
14396
|
+
}
|
|
14326
14397
|
if (!tool.inputSchema) {
|
|
14327
14398
|
return;
|
|
14328
14399
|
}
|
|
14329
14400
|
const inputObj = normalizeObjectSchema(tool.inputSchema);
|
|
14330
14401
|
const schemaToParse = inputObj ?? tool.inputSchema;
|
|
14331
|
-
const parseResult = await safeParseAsync2(schemaToParse, args);
|
|
14402
|
+
const parseResult = await safeParseAsync2(schemaToParse, args ?? {});
|
|
14332
14403
|
if (!parseResult.success) {
|
|
14333
14404
|
const error = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
14334
14405
|
const errorMessage = getParseErrorMessage(error);
|
|
@@ -14553,7 +14624,7 @@ class McpServer {
|
|
|
14553
14624
|
}
|
|
14554
14625
|
if (prompt.argsSchema) {
|
|
14555
14626
|
const argsObj = normalizeObjectSchema(prompt.argsSchema);
|
|
14556
|
-
const parseResult = await safeParseAsync2(argsObj, request.params.arguments);
|
|
14627
|
+
const parseResult = await safeParseAsync2(argsObj, request.params.arguments ?? {});
|
|
14557
14628
|
if (!parseResult.success) {
|
|
14558
14629
|
const error = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
14559
14630
|
const errorMessage = getParseErrorMessage(error);
|
|
@@ -14931,6 +15002,28 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
14931
15002
|
}
|
|
14932
15003
|
};
|
|
14933
15004
|
|
|
15005
|
+
// src/core/vlan-resource.ts
|
|
15006
|
+
function registerVlanKnowledgeResource(server) {
|
|
15007
|
+
server.registerResource("vlan-segmentation-guide", VLAN_GUIDE_URI, {
|
|
15008
|
+
title: "RouterOS VLAN segmentation guide",
|
|
15009
|
+
description: "Read-only VLAN design, dual-stack isolation, management safety and validation guidance. No live device data.",
|
|
15010
|
+
mimeType: "text/markdown"
|
|
15011
|
+
}, (uri) => ({
|
|
15012
|
+
contents: [{ uri: uri.href, mimeType: "text/markdown", text: getVlanSegmentationGuide() }]
|
|
15013
|
+
}));
|
|
15014
|
+
}
|
|
15015
|
+
|
|
15016
|
+
// src/core/container-resource.ts
|
|
15017
|
+
function registerContainerKnowledgeResource(server) {
|
|
15018
|
+
server.registerResource("routeros-container-guide", CONTAINER_GUIDE_URI, {
|
|
15019
|
+
title: "RouterOS container operations guide",
|
|
15020
|
+
description: "Version-aware container discovery, deployment, isolation and lifecycle safety. Reference only, no live device data.",
|
|
15021
|
+
mimeType: "text/markdown"
|
|
15022
|
+
}, (uri) => ({
|
|
15023
|
+
contents: [{ uri: uri.href, mimeType: "text/markdown", text: getRouterosContainerGuide() }]
|
|
15024
|
+
}));
|
|
15025
|
+
}
|
|
15026
|
+
|
|
14934
15027
|
// src/prompts/index.ts
|
|
14935
15028
|
import { readFileSync, readdirSync } from "fs";
|
|
14936
15029
|
import { join } from "path";
|
|
@@ -15060,7 +15153,7 @@ function parseFrontmatter(raw) {
|
|
|
15060
15153
|
title: meta.title ?? meta.name,
|
|
15061
15154
|
description: meta.description ?? "",
|
|
15062
15155
|
arguments: args,
|
|
15063
|
-
body: transactionPromptGuidance(meta.name, body.trim())
|
|
15156
|
+
body: containerPromptGuidance(meta.name, vlanPromptGuidance(meta.name, transactionPromptGuidance(meta.name, body.trim())))
|
|
15064
15157
|
};
|
|
15065
15158
|
}
|
|
15066
15159
|
function deviceArgDescription(directory) {
|
|
@@ -15104,17 +15197,27 @@ function registerPrompts(server, opts = {}) {
|
|
|
15104
15197
|
if (multiDevice && !hasOwnDevice) {
|
|
15105
15198
|
argsSchema.device = _enum(selectorNames).optional().describe(deviceArgDescription(opts.deviceDirectory));
|
|
15106
15199
|
}
|
|
15107
|
-
server.registerPrompt(parsed.name, { title: parsed.title, description: parsed.description, argsSchema }, (args) =>
|
|
15108
|
-
|
|
15109
|
-
|
|
15110
|
-
|
|
15111
|
-
|
|
15112
|
-
type: "text",
|
|
15113
|
-
text: substitutePrompt(parsed.body, args)
|
|
15114
|
-
}
|
|
15200
|
+
server.registerPrompt(parsed.name, { title: parsed.title, description: parsed.description, argsSchema }, (args) => {
|
|
15201
|
+
const values = { ...args };
|
|
15202
|
+
for (const arg of parsed.arguments) {
|
|
15203
|
+
if (!arg.required && (typeof values[arg.name] !== "string" || !String(values[arg.name]).trim())) {
|
|
15204
|
+
values[arg.name] = "(not specified; ask if needed)";
|
|
15115
15205
|
}
|
|
15116
|
-
|
|
15117
|
-
|
|
15206
|
+
}
|
|
15207
|
+
return {
|
|
15208
|
+
messages: [
|
|
15209
|
+
{
|
|
15210
|
+
role: "user",
|
|
15211
|
+
content: {
|
|
15212
|
+
type: "text",
|
|
15213
|
+
text: (multiDevice && !hasOwnDevice && typeof args.device === "string" ? `Target device (configured MCP key or label): ${JSON.stringify(args.device)}. Resolve this exact device; do not substitute the default.
|
|
15214
|
+
|
|
15215
|
+
` : "") + substitutePrompt(parsed.body, values)
|
|
15216
|
+
}
|
|
15217
|
+
}
|
|
15218
|
+
]
|
|
15219
|
+
};
|
|
15220
|
+
});
|
|
15118
15221
|
count++;
|
|
15119
15222
|
}
|
|
15120
15223
|
return count;
|
|
@@ -15144,10 +15247,12 @@ Tool discovery \u2014 MANDATORY workflow:
|
|
|
15144
15247
|
Safety model \u2014 tools are annotated by risk:
|
|
15145
15248
|
\u2022 readOnlyHint \u2192 inspection only, no changes
|
|
15146
15249
|
\u2022 destructiveHint \u2192 removes or replaces configuration
|
|
15147
|
-
Before a single-device batch of risky changes,
|
|
15148
|
-
|
|
15149
|
-
|
|
15150
|
-
|
|
15250
|
+
Before a single-device batch of risky changes, assess enable_safe_mode and an
|
|
15251
|
+
independent management recovery path. RouterOS can roll back eligible uncommitted
|
|
15252
|
+
changes after session loss, but Safe Mode has limits and is NOT a backup or a
|
|
15253
|
+
universal rollback guarantee. Use only your own session; inspect uncertain writes
|
|
15254
|
+
instead of replaying them. Commit only an approved, verified plan; otherwise use
|
|
15255
|
+
the agreed rollback/recovery path. Prefer filtered list_* reads to keep output small.
|
|
15151
15256
|
|
|
15152
15257
|
Change workflow \u2014 ALWAYS take a restore point before a plan. Before calling
|
|
15153
15258
|
plan_changes or apply_plan (or any batch of write/destructive tools), first call
|
|
@@ -15241,6 +15346,20 @@ function createServer(opts = {}) {
|
|
|
15241
15346
|
const toolModules = selectToolModules2(getConfig2().tools);
|
|
15242
15347
|
const availableTools = new Set(toolModules.flatMap((mod) => mod.map((tool) => tool.name)));
|
|
15243
15348
|
let instructions = names.length > 1 ? INSTRUCTIONS + MULTI_DEVICE_INSTRUCTIONS.replace("{{names}}", names.join(", ")).replace("{{default}}", defaultDevice) : INSTRUCTIONS;
|
|
15349
|
+
instructions += `
|
|
15350
|
+
|
|
15351
|
+
${VLAN_INSTRUCTIONS}`;
|
|
15352
|
+
instructions += `
|
|
15353
|
+
|
|
15354
|
+
${CONTAINER_INSTRUCTIONS}`;
|
|
15355
|
+
if (availableTools.has("get_routeros_container_guide")) {
|
|
15356
|
+
instructions += `
|
|
15357
|
+
Container tool-only clients: discover get_routeros_container_guide with find_tools; this reference does not contact a router.`;
|
|
15358
|
+
}
|
|
15359
|
+
if (availableTools.has("get_vlan_segmentation_guide")) {
|
|
15360
|
+
instructions += `
|
|
15361
|
+
Tool-only clients: discover get_vlan_segmentation_guide with find_tools; topic=all returns the full guide without router I/O.`;
|
|
15362
|
+
}
|
|
15244
15363
|
const sshParticipants = names.filter((name) => !getConfig2().devices[name]?.mac);
|
|
15245
15364
|
if (!readOnly && sshParticipants.length > 1 && TRANSACTION_TOOL_NAMES.every((name) => availableTools.has(name))) {
|
|
15246
15365
|
instructions += `
|
|
@@ -15312,6 +15431,8 @@ ${note}`;
|
|
|
15312
15431
|
deviceDirectory: deviceDirectory()
|
|
15313
15432
|
});
|
|
15314
15433
|
const uiViewCount = registerUiResources(server);
|
|
15434
|
+
registerVlanKnowledgeResource(server);
|
|
15435
|
+
registerContainerKnowledgeResource(server);
|
|
15315
15436
|
installToolPagination(server, getConfig2().mcp.toolPageSize);
|
|
15316
15437
|
return { server, toolCount, promptCount, uiViewCount, readOnly };
|
|
15317
15438
|
}
|