mikromcp 1.0.5 → 1.0.7
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 +1 -1
- package/dist/main.js +44 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
[](https://github.com/AliKarami/MikroMCP/actions/workflows/ci.yml)
|
|
14
14
|
[](https://github.com/AliKarami/MikroMCP/actions/workflows/release.yml)
|
|
15
|
-
[](package.json)
|
|
16
16
|
[](LICENSE)
|
|
17
17
|
[](package.json)
|
|
18
18
|
[](https://help.mikrotik.com/docs/display/ROS/REST+API)
|
package/dist/main.js
CHANGED
|
@@ -8614,7 +8614,7 @@ function createServerFactory(config, identityRegistry) {
|
|
|
8614
8614
|
const makeServer = () => {
|
|
8615
8615
|
const server = new McpServer({
|
|
8616
8616
|
name: "mikromcp",
|
|
8617
|
-
version: "1.0.
|
|
8617
|
+
version: "1.0.7"
|
|
8618
8618
|
});
|
|
8619
8619
|
registerAllTools(server, registry, pool, circuitBreakers, config, identityRegistry);
|
|
8620
8620
|
return server;
|
|
@@ -8937,7 +8937,7 @@ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
|
|
|
8937
8937
|
import { homedir as homedir3 } from "os";
|
|
8938
8938
|
import * as net from "net";
|
|
8939
8939
|
import chalk from "chalk";
|
|
8940
|
-
var localVersion = "1.0.
|
|
8940
|
+
var localVersion = "1.0.7";
|
|
8941
8941
|
var results = [];
|
|
8942
8942
|
function ok(msg) {
|
|
8943
8943
|
console.log(chalk.green("\u2705 ") + msg);
|
|
@@ -9218,7 +9218,7 @@ import {
|
|
|
9218
9218
|
} from "fs";
|
|
9219
9219
|
import { homedir as homedir4 } from "os";
|
|
9220
9220
|
import { join as join4 } from "path";
|
|
9221
|
-
import {
|
|
9221
|
+
import { parse as yamlParse, Document, visit } from "yaml";
|
|
9222
9222
|
import bcrypt2 from "bcryptjs";
|
|
9223
9223
|
import chalk2 from "chalk";
|
|
9224
9224
|
function mikromcpDir2() {
|
|
@@ -9227,6 +9227,20 @@ function mikromcpDir2() {
|
|
|
9227
9227
|
function defaultAuditLogPath() {
|
|
9228
9228
|
return join4(mikromcpDir2(), "audit.ndjson");
|
|
9229
9229
|
}
|
|
9230
|
+
function toYaml(obj) {
|
|
9231
|
+
const doc = new Document(obj);
|
|
9232
|
+
visit(doc, {
|
|
9233
|
+
Scalar(key, node) {
|
|
9234
|
+
if (key !== "key" && typeof node.value === "string") {
|
|
9235
|
+
node.type = "QUOTE_DOUBLE";
|
|
9236
|
+
}
|
|
9237
|
+
},
|
|
9238
|
+
Seq(_, node) {
|
|
9239
|
+
node.flow = true;
|
|
9240
|
+
}
|
|
9241
|
+
});
|
|
9242
|
+
return doc.toString();
|
|
9243
|
+
}
|
|
9230
9244
|
function suggestEnvPrefix(routerId) {
|
|
9231
9245
|
return "ROUTER_" + routerId.toUpperCase().replace(/-/g, "_");
|
|
9232
9246
|
}
|
|
@@ -9256,7 +9270,7 @@ async function collectRouterInfo() {
|
|
|
9256
9270
|
});
|
|
9257
9271
|
const portStr = await input({
|
|
9258
9272
|
message: "Port:",
|
|
9259
|
-
default: "
|
|
9273
|
+
default: "80",
|
|
9260
9274
|
validate: (v) => {
|
|
9261
9275
|
const n = Number(v);
|
|
9262
9276
|
return Number.isInteger(n) && n >= 1 && n <= 65535 ? true : "Port must be 1\u201365535";
|
|
@@ -9264,11 +9278,11 @@ async function collectRouterInfo() {
|
|
|
9264
9278
|
});
|
|
9265
9279
|
const port = Number(portStr);
|
|
9266
9280
|
const tlsEnabled = await confirm({ message: "Enable TLS?", default: false });
|
|
9267
|
-
let rejectUnauthorized =
|
|
9281
|
+
let rejectUnauthorized = false;
|
|
9268
9282
|
if (tlsEnabled) {
|
|
9269
9283
|
rejectUnauthorized = await confirm({
|
|
9270
9284
|
message: "Reject unauthorized TLS certificates (rejectUnauthorized)?",
|
|
9271
|
-
default:
|
|
9285
|
+
default: false
|
|
9272
9286
|
});
|
|
9273
9287
|
if (!rejectUnauthorized) {
|
|
9274
9288
|
console.log(
|
|
@@ -9411,7 +9425,7 @@ function writeRoutersYaml(data) {
|
|
|
9411
9425
|
}
|
|
9412
9426
|
parsed.routers[data.routerId] = newEntry;
|
|
9413
9427
|
mkdirSync3(data.configDir, { recursive: true });
|
|
9414
|
-
writeFileSync2(filePath,
|
|
9428
|
+
writeFileSync2(filePath, toYaml(parsed));
|
|
9415
9429
|
return true;
|
|
9416
9430
|
}
|
|
9417
9431
|
function writeIdentitiesYaml(data) {
|
|
@@ -9430,7 +9444,7 @@ function writeIdentitiesYaml(data) {
|
|
|
9430
9444
|
}
|
|
9431
9445
|
parsed.identities[data.identityId] = newEntry;
|
|
9432
9446
|
mkdirSync3(data.configDir, { recursive: true });
|
|
9433
|
-
writeFileSync2(filePath,
|
|
9447
|
+
writeFileSync2(filePath, toYaml(parsed));
|
|
9434
9448
|
return true;
|
|
9435
9449
|
}
|
|
9436
9450
|
function writeDotEnv(data) {
|
|
@@ -9464,14 +9478,8 @@ function writeDotEnv(data) {
|
|
|
9464
9478
|
"# \u2500\u2500 RBAC (optional, for stdio with identity enforcement) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
|
|
9465
9479
|
"# MIKROMCP_STDIO_IDENTITY="
|
|
9466
9480
|
];
|
|
9467
|
-
const content = lines.join("\n") + "\n";
|
|
9468
9481
|
mkdirSync3(data.configDir, { recursive: true });
|
|
9469
|
-
|
|
9470
|
-
const existing = readFileSync7(data.envPath, "utf-8");
|
|
9471
|
-
writeFileSync2(data.envPath, existing.endsWith("\n") ? existing + "\n" + content : existing + "\n\n" + content);
|
|
9472
|
-
} else {
|
|
9473
|
-
writeFileSync2(data.envPath, content);
|
|
9474
|
-
}
|
|
9482
|
+
writeFileSync2(data.envPath, lines.join("\n") + "\n");
|
|
9475
9483
|
}
|
|
9476
9484
|
function registerClaudeDesktop() {
|
|
9477
9485
|
const configPath = findClaudeDesktopConfig();
|
|
@@ -9505,21 +9513,28 @@ function registerClaudeDesktop() {
|
|
|
9505
9513
|
}
|
|
9506
9514
|
async function runInit() {
|
|
9507
9515
|
console.log(chalk2.bold.cyan("\n\u{1F527} MikroMCP \u2014 Interactive Setup Wizard\n"));
|
|
9508
|
-
const routerInfo = await collectRouterInfo();
|
|
9509
|
-
const identityInfo = await collectIdentityInfo();
|
|
9510
9516
|
const configDir = mikromcpDir2();
|
|
9511
9517
|
const envPath = join4(configDir, ".env");
|
|
9512
|
-
const
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
console.log(chalk2.
|
|
9518
|
-
|
|
9519
|
-
|
|
9518
|
+
const existingFiles = [".env", "routers.yaml", "identities.yaml"].filter(
|
|
9519
|
+
(f) => existsSync4(join4(configDir, f))
|
|
9520
|
+
);
|
|
9521
|
+
if (existingFiles.length > 0) {
|
|
9522
|
+
console.log(chalk2.yellow(` \u26A0 Found existing files in ${configDir}:`));
|
|
9523
|
+
for (const f of existingFiles) console.log(chalk2.yellow(` ${f}`));
|
|
9524
|
+
console.log();
|
|
9525
|
+
const proceed = await confirm({
|
|
9526
|
+
message: "Continue? (existing files will be overwritten or merged)",
|
|
9520
9527
|
default: true
|
|
9521
9528
|
});
|
|
9529
|
+
if (!proceed) {
|
|
9530
|
+
console.log(chalk2.dim(" Aborted."));
|
|
9531
|
+
return;
|
|
9532
|
+
}
|
|
9522
9533
|
}
|
|
9534
|
+
const routerInfo = await collectRouterInfo();
|
|
9535
|
+
const identityInfo = await collectIdentityInfo();
|
|
9536
|
+
const transport2 = await collectTransport();
|
|
9537
|
+
const writeEnv = await collectEnvPreference();
|
|
9523
9538
|
const registerDesktop = await collectClaudeDesktopPreference();
|
|
9524
9539
|
const data = {
|
|
9525
9540
|
...routerInfo,
|
|
@@ -9528,7 +9543,7 @@ async function runInit() {
|
|
|
9528
9543
|
envPath,
|
|
9529
9544
|
configDir,
|
|
9530
9545
|
writeEnv,
|
|
9531
|
-
writeRoutersYaml:
|
|
9546
|
+
writeRoutersYaml: true,
|
|
9532
9547
|
writeIdentitiesYaml: identityInfo.createIdentity,
|
|
9533
9548
|
registerClaudeDesktop: registerDesktop
|
|
9534
9549
|
};
|
|
@@ -9568,14 +9583,13 @@ async function runInit() {
|
|
|
9568
9583
|
);
|
|
9569
9584
|
}
|
|
9570
9585
|
console.log(chalk2.bold("\nNext steps:"));
|
|
9571
|
-
console.log(chalk2.dim(
|
|
9572
|
-
console.log(chalk2.dim(" 2.
|
|
9573
|
-
console.log(chalk2.dim(" 3. Restart Claude Desktop to load the MCP server"));
|
|
9586
|
+
console.log(chalk2.dim(" 1. Run: mikromcp doctor"));
|
|
9587
|
+
console.log(chalk2.dim(" 2. Restart Claude Desktop to load the MCP server"));
|
|
9574
9588
|
console.log();
|
|
9575
9589
|
}
|
|
9576
9590
|
|
|
9577
9591
|
// src/cli/index.ts
|
|
9578
|
-
var program = new Command().name("mikromcp").description("MikroTik RouterOS MCP server").version("1.0.
|
|
9592
|
+
var program = new Command().name("mikromcp").description("MikroTik RouterOS MCP server").version("1.0.7");
|
|
9579
9593
|
program.command("serve", { isDefault: true }).description("Start the MCP server (default)").action(runServe);
|
|
9580
9594
|
program.command("doctor").description("Check config, connectivity, and permissions").action(runDoctor);
|
|
9581
9595
|
program.command("init").description("Interactive setup wizard").action(runInit);
|