@mgsoftwarebv/mg-dashboard-mcp 3.1.1 → 3.1.2

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/dist/index.js CHANGED
@@ -1016,39 +1016,7 @@ var RateLimiter = class {
1016
1016
  var authRateLimiter = new RateLimiter(5, 15 * 60 * 1e3);
1017
1017
  setInterval(() => {
1018
1018
  authRateLimiter.cleanup();
1019
- toolRateLimiter.cleanup();
1020
1019
  }, 5 * 60 * 1e3).unref();
1021
- var TOOL_RATE_CATEGORIES = {
1022
- "ssh-execute": "ssh",
1023
- "sftp-write": "sftp_write",
1024
- "sftp-delete": "sftp_write",
1025
- "sftp-list": "sftp_read",
1026
- "sftp-read": "sftp_read",
1027
- "db-query": "db",
1028
- "db-discover": "db",
1029
- "db-tables": "db",
1030
- "db-describe": "db"
1031
- };
1032
- var TOOL_RATE_LIMITS = {
1033
- ssh: { max: 120, windowMs: 60 * 60 * 1e3 },
1034
- sftp_write: { max: 60, windowMs: 60 * 60 * 1e3 },
1035
- sftp_read: { max: 200, windowMs: 60 * 60 * 1e3 },
1036
- db: { max: 200, windowMs: 60 * 60 * 1e3 },
1037
- default: { max: 300, windowMs: 60 * 60 * 1e3 }
1038
- };
1039
- var toolRateLimiter = new RateLimiter(300, 60 * 60 * 1e3);
1040
- var toolRateBuckets = /* @__PURE__ */ new Map();
1041
- function checkToolRateLimit(toolName) {
1042
- const category = TOOL_RATE_CATEGORIES[toolName] || "default";
1043
- const limits = TOOL_RATE_LIMITS[category] ?? TOOL_RATE_LIMITS.default;
1044
- let limiter = toolRateBuckets.get(category);
1045
- if (!limiter) {
1046
- limiter = new RateLimiter(limits.max, limits.windowMs);
1047
- toolRateBuckets.set(category, limiter);
1048
- }
1049
- const result = limiter.check(authContext?.apiKeyId || "unknown");
1050
- return { allowed: result.allowed, category, retryAfterMs: result.retryAfterMs };
1051
- }
1052
1020
  var SENSITIVE_KEYS = /* @__PURE__ */ new Set(["password", "private_key", "passphrase", "secret", "token", "key", "api_key", "credentials"]);
1053
1021
  function redactSensitiveArgs(args2) {
1054
1022
  const redacted = {};
@@ -1126,11 +1094,6 @@ async function sendTelegramMessage(token, chatId, text, replyMarkup) {
1126
1094
  return { ok: false };
1127
1095
  }
1128
1096
  }
1129
- async function sendTelegramAlert(text) {
1130
- const config = await getTelegramBotConfig();
1131
- if (!config) return;
1132
- await sendTelegramMessage(config.botToken, config.chatId, text);
1133
- }
1134
1097
  async function checkIpAllowlist(ipAddress) {
1135
1098
  if (!authContext || !authContext.requireIpApproval) {
1136
1099
  console.error(`[IP Check] Skipped (requireIpApproval=${authContext?.requireIpApproval})`);
@@ -2476,7 +2439,7 @@ var TOOLS = [
2476
2439
  // ----- Agent Reporting -----
2477
2440
  ...AGENT_TOOLS
2478
2441
  ];
2479
- var MCP_VERSION = "3.0.6";
2442
+ var MCP_VERSION = "3.1.1";
2480
2443
  async function handleListTools() {
2481
2444
  if (!authContext) return { tools: TOOLS };
2482
2445
  const accessible = TOOLS.filter((tool) => {
@@ -2501,23 +2464,6 @@ async function handleCallTool(request) {
2501
2464
  }]
2502
2465
  };
2503
2466
  }
2504
- const rateResult = checkToolRateLimit(name);
2505
- if (!rateResult.allowed) {
2506
- const retryMin = Math.ceil(rateResult.retryAfterMs / 6e4);
2507
- void sendTelegramAlert(
2508
- `<b>MCP Rate Limit</b>
2509
-
2510
- Tool category <code>${escapeHtmlTg(rateResult.category)}</code> rate limited.
2511
- Key: ${escapeHtmlTg(authContext.apiKeyName)}
2512
- Retry in ${retryMin} min.`
2513
- );
2514
- return {
2515
- content: [{
2516
- type: "text",
2517
- text: `Rate limited: too many ${rateResult.category} calls. Retry in ${retryMin} minute(s).`
2518
- }]
2519
- };
2520
- }
2521
2467
  const startTime = Date.now();
2522
2468
  const serverId = a.serverId || a.server_id;
2523
2469
  const result = await executeToolCall(name, a);