tiny-http-mcp-server 0.1.48 → 0.1.49

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.
@@ -18,7 +18,7 @@
18
18
  },
19
19
  {
20
20
  "name": "tiny-http-mcp-server",
21
- "version": "0.1.48",
21
+ "version": "0.1.49",
22
22
  "license": "MIT"
23
23
  },
24
24
  {
@@ -24,6 +24,11 @@ await client.close();
24
24
 
25
25
  `Tool` includes MCP `outputSchema` when a server advertises typed tool output. `CallToolResult` includes `structuredContent?: Record<string, unknown>` for typed results; legacy/content-block tools still use `content[]`.
26
26
 
27
+ Set `requestTimeoutMs` on `McpClient` or `timeoutMs` on individual requests.
28
+ Numeric deadlines must be finite, nonnegative and no greater than
29
+ 2,147,483,647 ms; oversized values fail before a request is sent. Individual
30
+ JSON-RPC requests also accept `timeoutMs: null` to disable their timer.
31
+
27
32
  ## Transports
28
33
 
29
34
  | Transport | Description |
@@ -7618,6 +7618,7 @@ var HttpTransport = class {
7618
7618
  });
7619
7619
  }
7620
7620
  async completeInitialization(options) {
7621
+ validateRequestTimer(options.timeoutMs, "timeoutMs");
7621
7622
  const deadline = options.timeoutMs > 0 ? AbortSignal.timeout(Math.ceil(options.timeoutMs)) : void 0;
7622
7623
  const signals = [options.signal, deadline].filter((signal2) => signal2 !== void 0);
7623
7624
  const signal = signals.length === 0 ? new AbortController().signal : AbortSignal.any(signals);
@@ -8395,12 +8396,14 @@ var SseParser = class {
8395
8396
  throw new Error(`SSE event exceeds ${this.maxEventBytes} bytes`);
8396
8397
  }
8397
8398
  };
8399
+ function validateRequestTimer(value, name) {
8400
+ if (!Number.isFinite(value) || value < 0 || value > 2147483647)
8401
+ throw new Error(`${name} must be a non-negative finite number no greater than 2147483647`);
8402
+ }
8398
8403
  var JsonRpcMessageLayer = class {
8399
8404
  constructor(input, output, requestTimeoutMs = 3e4, inputClosedReason, maxConcurrentRequests = 128) {
8400
8405
  this.maxConcurrentRequests = maxConcurrentRequests;
8401
- if (!Number.isFinite(requestTimeoutMs) || requestTimeoutMs < 0) {
8402
- throw new Error("requestTimeoutMs must be a non-negative finite number");
8403
- }
8406
+ validateRequestTimer(requestTimeoutMs, "requestTimeoutMs");
8404
8407
  if (!Number.isSafeInteger(maxConcurrentRequests) || maxConcurrentRequests < 1)
8405
8408
  throw new Error("maxConcurrentRequests must be a positive safe integer");
8406
8409
  this.input = input;
@@ -8459,9 +8462,7 @@ var JsonRpcMessageLayer = class {
8459
8462
  sendRequest(method, params, options = {}) {
8460
8463
  if (this.disposedError !== void 0) throw this.disposedError;
8461
8464
  const timeoutMs = options.timeoutMs === null ? null : options.timeoutMs ?? this.requestTimeoutMs;
8462
- if (timeoutMs !== null && (!Number.isFinite(timeoutMs) || timeoutMs < 0)) {
8463
- throw new Error("timeoutMs must be a non-negative finite number");
8464
- }
8465
+ if (timeoutMs !== null) validateRequestTimer(timeoutMs, "timeoutMs");
8465
8466
  if (this.exchangeControllers.size >= this.maxConcurrentRequests)
8466
8467
  throw new Error("JSON-RPC request capacity exceeded");
8467
8468
  if (params !== void 0 && !isJsonValue(params)) {
@@ -8575,9 +8576,7 @@ var JsonRpcMessageLayer = class {
8575
8576
  const id = this.nextRequestId;
8576
8577
  this.nextRequestId += 1;
8577
8578
  const timeoutMs = options.timeoutMs === null ? null : options.timeoutMs ?? this.requestTimeoutMs;
8578
- if (timeoutMs !== null && (!Number.isFinite(timeoutMs) || timeoutMs < 0)) {
8579
- throw new Error("timeoutMs must be a non-negative finite number");
8580
- }
8579
+ if (timeoutMs !== null) validateRequestTimer(timeoutMs, "timeoutMs");
8581
8580
  if (options.onRequestId !== void 0) {
8582
8581
  options.onRequestId(id);
8583
8582
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-http-mcp-server",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "description": "Minimal MCP server over HTTP built on tiny-stdio-mcp-server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",