tiny-http-mcp-server 0.1.66 → 0.1.67

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.66",
21
+ "version": "0.1.67",
22
22
  "license": "MIT"
23
23
  },
24
24
  {
@@ -98,7 +98,8 @@ Native provider calls capture request option handles before host work. Unauthori
98
98
  handling also owns complete discovery metadata, presented grant values, rejected
99
99
  request headers and the selected challenge error before reading persistence.
100
100
  A browser callback cannot redirect a later code exchange by changing caller
101
- metadata. Explicit authentication owns metadata when lazy discovery returns;
101
+ metadata. Metadata loaded from a host session store is copied before clock or
102
+ fetch callbacks, retaining the original refresh endpoint and persisted extensions. Explicit authentication owns metadata when lazy discovery returns;
102
103
  the selected discovery method retains its original receiver and live host state.
103
104
 
104
105
  Provider request inputs accept an optional `signal`. It reaches callback waits,
@@ -593,12 +593,13 @@ function normalizeLoadedSession(session) {
593
593
  if (session === null) {
594
594
  return null;
595
595
  }
596
+ const discovery = structuredClone(session.discovery);
596
597
  const refreshState = getOwnEntry(session, "refreshState");
597
598
  if (refreshState !== undefined && (refreshState !== "pending" || getOwnEntry(session, "tokens") !== undefined))
598
599
  throw new Error("Stored OAuth refresh state is invalid");
599
600
  const client = normalizeStoredOAuthClient(getOwnEntry(session, "client"));
600
601
  if (client === null) {
601
- return { ...session, client: { clientId: "" }, tokens: undefined };
602
+ return { ...session, discovery, client: { clientId: "" }, tokens: undefined };
602
603
  }
603
604
  const tokens = normalizeStoredTokens(getOwnEntry(session, "tokens"));
604
605
  if (tokens !== undefined) {
@@ -609,7 +610,7 @@ function normalizeLoadedSession(session) {
609
610
  throw new Error("Stored OAuth access token is not a valid HTTP header value");
610
611
  }
611
612
  }
612
- return { ...session, client, tokens };
613
+ return { ...session, discovery, client, tokens };
613
614
  }
614
615
  function normalizeImportedTokens(value, now) {
615
616
  if (!isObjectRecord(value))
@@ -101,7 +101,7 @@ const transport = new HttpTransport({
101
101
  });
102
102
  ```
103
103
 
104
- You can also call `discoverOAuthMetadata(resourceUrl, options)` directly, or instantiate `OAuthMetadataDiscovery` with a custom `fetch` implementation and shared cache. Lookup options accept `signal`; cancellation stops metadata fetches and body reads without trying another discovery candidate. It also settles while shared-cache reads, writes or eviction wait. Host cache work may finish afterward; its late rejection remains observed, and canceled discovery does not start another candidate.
104
+ You can also call `discoverOAuthMetadata(resourceUrl, options)` directly, or instantiate `OAuthMetadataDiscovery` with a custom `fetch` implementation and shared cache. An explicit `resourceMetadataUrl` requires fresh network discovery without reading either cache; validated results still populate both caches. Lookup options accept `signal`; cancellation stops metadata fetches and body reads without trying another discovery candidate. It also settles while shared-cache reads, writes or eviction wait. Host cache work may finish afterward; its late rejection remains observed, and canceled discovery does not start another candidate.
105
105
 
106
106
  OAuth provider inputs receive the originating request's `signal`, covering header authorization and unauthorized handling. Modern request cancellation stops its OAuth work while leaving other requests usable; transport disposal cancels all pending OAuth operations. The default provider propagates this signal to callback, registration and token work. Custom providers must observe it for their own operations.
107
107
 
@@ -5837,12 +5837,13 @@ function normalizeLoadedSession(session) {
5837
5837
  if (session === null) {
5838
5838
  return null;
5839
5839
  }
5840
+ const discovery = structuredClone(session.discovery);
5840
5841
  const refreshState = getOwnEntry6(session, "refreshState");
5841
5842
  if (refreshState !== void 0 && (refreshState !== "pending" || getOwnEntry6(session, "tokens") !== void 0))
5842
5843
  throw new Error("Stored OAuth refresh state is invalid");
5843
5844
  const client = normalizeStoredOAuthClient(getOwnEntry6(session, "client"));
5844
5845
  if (client === null) {
5845
- return { ...session, client: { clientId: "" }, tokens: void 0 };
5846
+ return { ...session, discovery, client: { clientId: "" }, tokens: void 0 };
5846
5847
  }
5847
5848
  const tokens = normalizeStoredTokens(getOwnEntry6(session, "tokens"));
5848
5849
  if (tokens !== void 0) {
@@ -5852,7 +5853,7 @@ function normalizeLoadedSession(session) {
5852
5853
  throw new Error("Stored OAuth access token is not a valid HTTP header value");
5853
5854
  }
5854
5855
  }
5855
- return { ...session, client, tokens };
5856
+ return { ...session, discovery, client, tokens };
5856
5857
  }
5857
5858
  function normalizeImportedTokens(value, now) {
5858
5859
  if (!isObjectRecord3(value))
@@ -6473,7 +6474,7 @@ var OAuthMetadataDiscovery = class {
6473
6474
  if (memoryCachedResult !== void 0 && resourceMetadataUrl === void 0) {
6474
6475
  return structuredClone(memoryCachedResult);
6475
6476
  }
6476
- const sharedCachedResult = await waitForCache(this.cache?.get(cacheKey), signal);
6477
+ const sharedCachedResult = resourceMetadataUrl === void 0 ? await waitForCache(this.cache?.get(cacheKey), signal) : void 0;
6477
6478
  signal?.throwIfAborted();
6478
6479
  if (sharedCachedResult !== null && sharedCachedResult !== void 0 && resourceMetadataUrl === void 0) {
6479
6480
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-http-mcp-server",
3
- "version": "0.1.66",
3
+ "version": "0.1.67",
4
4
  "description": "Minimal MCP server over HTTP built on tiny-stdio-mcp-server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",