@modelcontextprotocol/server-system-monitor 1.0.0 → 1.1.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/dist/server.js CHANGED
@@ -30495,7 +30495,7 @@ class Doc {
30495
30495
  var version = {
30496
30496
  major: 4,
30497
30497
  minor: 3,
30498
- patch: 6
30498
+ patch: 5
30499
30499
  };
30500
30500
 
30501
30501
  // ../../node_modules/zod/v4/core/schemas.js
@@ -31781,7 +31781,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
31781
31781
  if (keyResult instanceof Promise) {
31782
31782
  throw new Error("Async schemas not supported in object keys currently");
31783
31783
  }
31784
- const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
31784
+ const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length && keyResult.issues.some((iss) => iss.code === "invalid_type" && iss.expected === "number");
31785
31785
  if (checkNumericKey) {
31786
31786
  const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
31787
31787
  if (retryResult instanceof Promise) {
@@ -39152,7 +39152,7 @@ function finalize(ctx, schema) {
39152
39152
  }
39153
39153
  }
39154
39154
  }
39155
- if (refSchema.$ref && refSeen.def) {
39155
+ if (refSchema.$ref) {
39156
39156
  for (const key in schema2) {
39157
39157
  if (key === "$ref" || key === "allOf")
39158
39158
  continue;
@@ -45164,7 +45164,7 @@ function mergeCapabilities(base, additional) {
45164
45164
  return result2;
45165
45165
  }
45166
45166
 
45167
- // ../../dist/src/server/index.js
45167
+ // ../../node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js
45168
45168
  var QI = Object.defineProperty;
45169
45169
  var s = (r, i) => {
45170
45170
  for (var o in i)
@@ -53958,37 +53958,52 @@ var import_systeminformation = __toESM(require_lib(), 1);
53958
53958
  import fs from "node:fs/promises";
53959
53959
  import os from "node:os";
53960
53960
  import path from "node:path";
53961
- var CpuCoreSchema = exports_external.object({
53962
- idle: exports_external.number(),
53963
- total: exports_external.number()
53964
- });
53965
- var CpuStatsSchema = exports_external.object({
53966
- cores: exports_external.array(CpuCoreSchema),
53967
- model: exports_external.string(),
53968
- count: exports_external.number()
53969
- });
53970
- var MemoryStatsSchema = exports_external.object({
53971
- usedBytes: exports_external.number(),
53972
- totalBytes: exports_external.number(),
53973
- usedPercent: exports_external.number(),
53974
- freeBytes: exports_external.number(),
53975
- usedFormatted: exports_external.string(),
53976
- totalFormatted: exports_external.string()
53977
- });
53961
+ var DIST_DIR = import.meta.filename.endsWith(".ts") ? path.join(import.meta.dirname, "dist") : import.meta.dirname;
53978
53962
  var SystemInfoSchema = exports_external.object({
53979
53963
  hostname: exports_external.string(),
53980
53964
  platform: exports_external.string(),
53981
53965
  arch: exports_external.string(),
53982
- uptime: exports_external.number(),
53983
- uptimeFormatted: exports_external.string()
53966
+ cpu: exports_external.object({
53967
+ model: exports_external.string(),
53968
+ count: exports_external.number()
53969
+ }),
53970
+ memory: exports_external.object({
53971
+ totalBytes: exports_external.number()
53972
+ })
53984
53973
  });
53985
- var SystemStatsSchema = exports_external.object({
53986
- cpu: CpuStatsSchema,
53987
- memory: MemoryStatsSchema,
53988
- system: SystemInfoSchema,
53974
+ var CpuCoreSchema = exports_external.object({
53975
+ idle: exports_external.number(),
53976
+ total: exports_external.number()
53977
+ });
53978
+ var PollStatsSchema = exports_external.object({
53979
+ cpu: exports_external.object({
53980
+ cores: exports_external.array(CpuCoreSchema)
53981
+ }),
53982
+ memory: exports_external.object({
53983
+ usedBytes: exports_external.number(),
53984
+ usedPercent: exports_external.number(),
53985
+ freeBytes: exports_external.number()
53986
+ }),
53987
+ uptime: exports_external.object({
53988
+ seconds: exports_external.number()
53989
+ }),
53989
53990
  timestamp: exports_external.string()
53990
53991
  });
53991
- var DIST_DIR = import.meta.filename.endsWith(".ts") ? path.join(import.meta.dirname, "dist") : import.meta.dirname;
53992
+ function getSystemInfo() {
53993
+ const cpuInfo = os.cpus()[0];
53994
+ return {
53995
+ hostname: os.hostname(),
53996
+ platform: `${os.platform()} ${os.arch()}`,
53997
+ arch: os.arch(),
53998
+ cpu: {
53999
+ model: cpuInfo?.model ?? "Unknown",
54000
+ count: os.cpus().length
54001
+ },
54002
+ memory: {
54003
+ totalBytes: os.totalmem()
54004
+ }
54005
+ };
54006
+ }
53992
54007
  function getCpuSnapshots() {
53993
54008
  return os.cpus().map((cpu) => {
53994
54009
  const times = cpu.times;
@@ -53997,58 +54012,20 @@ function getCpuSnapshots() {
53997
54012
  return { idle, total };
53998
54013
  });
53999
54014
  }
54000
- function formatUptime(seconds) {
54001
- const days = Math.floor(seconds / 86400);
54002
- const hours = Math.floor(seconds % 86400 / 3600);
54003
- const minutes = Math.floor(seconds % 3600 / 60);
54004
- const parts = [];
54005
- if (days > 0)
54006
- parts.push(`${days}d`);
54007
- if (hours > 0)
54008
- parts.push(`${hours}h`);
54009
- if (minutes > 0)
54010
- parts.push(`${minutes}m`);
54011
- return parts.length > 0 ? parts.join(" ") : "< 1m";
54012
- }
54013
- function formatBytes(bytes) {
54014
- const units = ["B", "KB", "MB", "GB", "TB"];
54015
- let value = bytes;
54016
- let unitIndex = 0;
54017
- while (value >= 1024 && unitIndex < units.length - 1) {
54018
- value /= 1024;
54019
- unitIndex++;
54020
- }
54021
- return `${value.toFixed(1)} ${units[unitIndex]}`;
54022
- }
54023
- async function getMemoryStats() {
54015
+ async function getPollStats() {
54024
54016
  const mem = await import_systeminformation.default.mem();
54025
- return {
54026
- usedBytes: mem.active,
54027
- totalBytes: mem.total,
54028
- usedPercent: Math.round(mem.active / mem.total * 100),
54029
- freeBytes: mem.available,
54030
- usedFormatted: formatBytes(mem.active),
54031
- totalFormatted: formatBytes(mem.total)
54032
- };
54033
- }
54034
- async function getStats() {
54035
- const cpuSnapshots = getCpuSnapshots();
54036
- const cpuInfo = os.cpus()[0];
54037
- const memory = await getMemoryStats();
54038
54017
  const uptimeSeconds = os.uptime();
54039
54018
  return {
54040
54019
  cpu: {
54041
- cores: cpuSnapshots,
54042
- model: cpuInfo?.model ?? "Unknown",
54043
- count: os.cpus().length
54020
+ cores: getCpuSnapshots()
54044
54021
  },
54045
- memory,
54046
- system: {
54047
- hostname: os.hostname(),
54048
- platform: `${os.platform()} ${os.arch()}`,
54049
- arch: os.arch(),
54050
- uptime: uptimeSeconds,
54051
- uptimeFormatted: formatUptime(uptimeSeconds)
54022
+ memory: {
54023
+ usedBytes: mem.active,
54024
+ usedPercent: Math.round(mem.active / mem.total * 100),
54025
+ freeBytes: mem.available
54026
+ },
54027
+ uptime: {
54028
+ seconds: uptimeSeconds
54052
54029
  },
54053
54030
  timestamp: new Date().toISOString()
54054
54031
  };
@@ -54059,27 +54036,27 @@ function createServer() {
54059
54036
  version: "1.0.0"
54060
54037
  });
54061
54038
  const resourceUri = "ui://system-monitor/mcp-app.html";
54062
- hk(server, "get-system-stats", {
54063
- title: "Get System Stats",
54064
- description: "Returns current system statistics including per-core CPU usage, memory, and system info.",
54039
+ hk(server, "get-system-info", {
54040
+ title: "Get System Info",
54041
+ description: "Returns system information, including hostname, platform, CPU info, and memory.",
54065
54042
  inputSchema: {},
54066
- outputSchema: SystemStatsSchema.shape,
54043
+ outputSchema: SystemInfoSchema.shape,
54067
54044
  _meta: { ui: { resourceUri } }
54068
- }, async () => {
54069
- const stats = await getStats();
54045
+ }, () => {
54046
+ const info = getSystemInfo();
54070
54047
  return {
54071
- content: [{ type: "text", text: JSON.stringify(stats) }],
54072
- structuredContent: stats
54048
+ content: [{ type: "text", text: JSON.stringify(info) }],
54049
+ structuredContent: info
54073
54050
  };
54074
54051
  });
54075
- hk(server, "refresh-stats", {
54076
- title: "Refresh Stats",
54077
- description: "Refresh system statistics (app-only, for polling)",
54052
+ hk(server, "poll-system-stats", {
54053
+ title: "Poll System Stats",
54054
+ description: "Returns dynamic system metrics for polling: per-core CPU timing, memory usage, and uptime. App-only.",
54078
54055
  inputSchema: {},
54079
- outputSchema: SystemStatsSchema.shape,
54056
+ outputSchema: PollStatsSchema.shape,
54080
54057
  _meta: { ui: { visibility: ["app"] } }
54081
54058
  }, async () => {
54082
- const stats = await getStats();
54059
+ const stats = await getPollStats();
54083
54060
  return {
54084
54061
  content: [{ type: "text", text: JSON.stringify(stats) }],
54085
54062
  structuredContent: stats
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/server-system-monitor",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "System monitor MCP App Server with real-time stats",
6
6
  "repository": {
@@ -21,12 +21,12 @@
21
21
  "start": "npm run start:http",
22
22
  "start:http": "cross-env NODE_ENV=development npm run build && npm run serve:http",
23
23
  "start:stdio": "cross-env NODE_ENV=development npm run build && npm run serve:stdio",
24
- "dev": "cross-env NODE_ENV=development concurrently 'npm run watch' 'npm run serve:http'",
24
+ "dev": "cross-env NODE_ENV=development concurrently \"npm run watch\" \"npm run serve:http\"",
25
25
  "prepublishOnly": "npm run build",
26
26
  "serve": "bun --watch main.ts"
27
27
  },
28
28
  "dependencies": {
29
- "@modelcontextprotocol/ext-apps": "../..",
29
+ "@modelcontextprotocol/ext-apps": "^1.0.0",
30
30
  "@modelcontextprotocol/sdk": "^1.24.0",
31
31
  "chart.js": "^4.4.0",
32
32
  "cors": "^2.8.5",