tiny-http-mcp-server 0.1.61 → 0.1.62

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.61",
21
+ "version": "0.1.62",
22
22
  "license": "MIT"
23
23
  },
24
24
  {
@@ -157,9 +157,13 @@ used only for its resource.
157
157
  Discovery binds an expired or explicitly rejected grant before silent refresh,
158
158
  using the original configured client. Persisted sessions take precedence,
159
159
  including sessions whose tokens have been cleared; an import cannot revive them.
160
- Input tokens are copied and invalid expiry values fail before authorization.
160
+ Input tokens are copied before any host clock anchors a relative lifetime;
161
+ clock mutation cannot replace the selected access/refresh/scope values. Invalid
162
+ expiry values fail before authorization.
161
163
  For a raw OAuth response, `parseOAuthTokenGrant(response, { issuedAt, expiresAt })`
162
- returns normalized `StoredOAuthTokens`. It accepts `access_token`, `refresh_token`,
164
+ returns normalized `StoredOAuthTokens`. Timing options are captured before the
165
+ host clock runs, so it cannot bypass their earlier validation. The parser accepts
166
+ `access_token`, `refresh_token`,
163
167
  `token_type`, `scope`, `expires_in` (seconds), `expires_at` (epoch seconds), and
164
168
  `expiresAt` (epoch milliseconds). Numeric absolute expiry wins over relative
165
169
  lifetime; the options timestamp wins over response timestamps. The optional
@@ -603,6 +603,7 @@ function normalizeImportedTokens(value, now) {
603
603
  const absolute = getOwnEntry(value, "expiresAt");
604
604
  const lifetime = getOwnEntry(value, "expiresIn");
605
605
  const issuedAt = getOwnEntry(value, "issuedAt");
606
+ const snapshot = { ...value };
606
607
  if (lifetime !== undefined && (typeof lifetime !== "number" || !Number.isSafeInteger(lifetime) || lifetime < 0))
607
608
  throw new Error("OAuth initial grant has invalid relative expiry");
608
609
  if (issuedAt !== undefined && (typeof issuedAt !== "number" || !Number.isSafeInteger(issuedAt) ||
@@ -610,7 +611,7 @@ function normalizeImportedTokens(value, now) {
610
611
  throw new Error("OAuth initial grant has invalid issuance time");
611
612
  const expiresAt = absolute !== undefined && absolute !== null ? absolute :
612
613
  lifetime === undefined ? null : (issuedAt === undefined ? now() : issuedAt) + lifetime * 1000;
613
- return normalizeStoredTokens({ ...value, expiresAt });
614
+ return normalizeStoredTokens({ ...snapshot, expiresAt });
614
615
  }
615
616
  function normalizeStoredTokens(value) {
616
617
  if (value === undefined || !isObjectRecord(value)) {
@@ -2,6 +2,7 @@ import { copyBoundedOAuthJson } from "./bounded-json.js";
2
2
  import { normalizeOAuthScope } from "./scope.js";
3
3
  /** Validate a raw RFC token response and anchor its lifetime once for persistence. */
4
4
  export function parseOAuthTokenGrant(value, options = {}) {
5
+ options = { ...options };
5
6
  const invalid = () => new Error("Invalid OAuth token grant");
6
7
  const result = copyBoundedOAuthJson(value, "Invalid OAuth token grant");
7
8
  if (typeof result !== "object" || result === null || Array.isArray(result))
@@ -5834,12 +5834,13 @@ function normalizeImportedTokens(value, now) {
5834
5834
  const absolute = getOwnEntry6(value, "expiresAt");
5835
5835
  const lifetime = getOwnEntry6(value, "expiresIn");
5836
5836
  const issuedAt = getOwnEntry6(value, "issuedAt");
5837
+ const snapshot = { ...value };
5837
5838
  if (lifetime !== void 0 && (typeof lifetime !== "number" || !Number.isSafeInteger(lifetime) || lifetime < 0))
5838
5839
  throw new Error("OAuth initial grant has invalid relative expiry");
5839
5840
  if (issuedAt !== void 0 && (typeof issuedAt !== "number" || !Number.isSafeInteger(issuedAt) || Math.abs(issuedAt) > MAX_JS_DATE_MS3))
5840
5841
  throw new Error("OAuth initial grant has invalid issuance time");
5841
5842
  const expiresAt = absolute !== void 0 && absolute !== null ? absolute : lifetime === void 0 ? null : (issuedAt === void 0 ? now() : issuedAt) + lifetime * 1e3;
5842
- return normalizeStoredTokens({ ...value, expiresAt });
5843
+ return normalizeStoredTokens({ ...snapshot, expiresAt });
5843
5844
  }
5844
5845
  function normalizeStoredTokens(value) {
5845
5846
  if (value === void 0 || !isObjectRecord3(value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-http-mcp-server",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
4
4
  "description": "Minimal MCP server over HTTP built on tiny-stdio-mcp-server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",