@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/README.md CHANGED
@@ -79,18 +79,24 @@ To test local modifications, use this configuration (replace `~/code/ext-apps` w
79
79
 
80
80
  ### Server (`server.ts`)
81
81
 
82
- Exposes a single `get-system-stats` tool that returns:
82
+ Exposes two tools demonstrating a polling pattern:
83
83
 
84
- - Raw per-core CPU timing data (idle/total counters)
85
- - Memory usage (used/total/percentage)
86
- - System info (hostname, platform, uptime)
84
+ 1. **`get-system-info`** (Model-visible) Returns static system configuration:
85
+ - Hostname, platform, architecture
86
+ - CPU model and core count
87
+ - Total memory
87
88
 
88
- The tool is linked to a UI resource via `_meta.ui.resourceUri`.
89
+ 2. **`poll-system-stats`** (App-only, `visibility: ["app"]`) Returns dynamic metrics:
90
+ - Per-core CPU timing data (idle/total counters)
91
+ - Memory usage (used/free/percentage)
92
+ - Uptime
93
+
94
+ The Model-visible tool is linked to a UI resource via `_meta.ui.resourceUri`.
89
95
 
90
96
  ### App (`src/mcp-app.ts`)
91
97
 
98
+ - Receives static system info via `ontoolresult` when the host sends the `get-system-info` result
99
+ - Polls `poll-system-stats` every 2 seconds for dynamic metrics
92
100
  - Uses Chart.js for the stacked area chart visualization
93
- - Polls the server tool every 2 seconds
94
101
  - Computes CPU usage percentages client-side from timing deltas
95
102
  - Maintains a 30-point history (1 minute at 2s intervals)
96
- - Updates all UI elements on each poll
package/dist/index.js CHANGED
@@ -27197,11 +27197,11 @@ var require_lib4 = __commonJS((exports, module) => {
27197
27197
  var headers = [], method = req.method && req.method.toUpperCase && req.method.toUpperCase();
27198
27198
  if (method === "OPTIONS") {
27199
27199
  headers.push(configureOrigin(options, req));
27200
- headers.push(configureCredentials(options));
27201
- headers.push(configureMethods(options));
27200
+ headers.push(configureCredentials(options, req));
27201
+ headers.push(configureMethods(options, req));
27202
27202
  headers.push(configureAllowedHeaders(options, req));
27203
- headers.push(configureMaxAge(options));
27204
- headers.push(configureExposedHeaders(options));
27203
+ headers.push(configureMaxAge(options, req));
27204
+ headers.push(configureExposedHeaders(options, req));
27205
27205
  applyHeaders(headers, res);
27206
27206
  if (options.preflightContinue) {
27207
27207
  next();
@@ -27212,8 +27212,8 @@ var require_lib4 = __commonJS((exports, module) => {
27212
27212
  }
27213
27213
  } else {
27214
27214
  headers.push(configureOrigin(options, req));
27215
- headers.push(configureCredentials(options));
27216
- headers.push(configureExposedHeaders(options));
27215
+ headers.push(configureCredentials(options, req));
27216
+ headers.push(configureExposedHeaders(options, req));
27217
27217
  applyHeaders(headers, res);
27218
27218
  next();
27219
27219
  }
@@ -28645,7 +28645,7 @@ class Doc {
28645
28645
  var version = {
28646
28646
  major: 4,
28647
28647
  minor: 3,
28648
- patch: 6
28648
+ patch: 5
28649
28649
  };
28650
28650
 
28651
28651
  // ../../node_modules/zod/v4/core/schemas.js
@@ -29685,7 +29685,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
29685
29685
  if (keyResult instanceof Promise) {
29686
29686
  throw new Error("Async schemas not supported in object keys currently");
29687
29687
  }
29688
- const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
29688
+ const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length && keyResult.issues.some((iss) => iss.code === "invalid_type" && iss.expected === "number");
29689
29689
  if (checkNumericKey) {
29690
29690
  const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
29691
29691
  if (retryResult instanceof Promise) {
@@ -30851,7 +30851,7 @@ function finalize(ctx, schema) {
30851
30851
  }
30852
30852
  }
30853
30853
  }
30854
- if (refSchema.$ref && refSeen.def) {
30854
+ if (refSchema.$ref) {
30855
30855
  for (const key in schema2) {
30856
30856
  if (key === "$ref" || key === "allOf")
30857
30857
  continue;