@kya-os/mcp-i-runtime 1.2.1 → 1.2.4

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.
@@ -21,7 +21,11 @@ import {
21
21
  ConsentOnlyModeError,
22
22
  CredentialAuthModeError,
23
23
  } from "./provider-resolver.js";
24
- import { authTypeSatisfies } from "./auth-type-satisfies.js";
24
+ import {
25
+ authTypeSatisfies,
26
+ isUnsatisfiableAuthType,
27
+ MINTABLE_AUTH_TYPES,
28
+ } from "./auth-type-satisfies.js";
25
29
 
26
30
  export interface ToolContextBuilderConfig {
27
31
  /** IDP token resolver for resolving tokens from User DID */
@@ -187,6 +191,23 @@ export class ToolContextBuilder {
187
191
  delegationAuthorizationType: delegationAuthorizationType ?? null,
188
192
  }
189
193
  );
194
+
195
+ // Distinguish "re-authenticate and this resolves" from "no mint can
196
+ // ever satisfy this, so the user is in an infinite loop". Without
197
+ // this, an unsatisfiable requirement is indistinguishable from a
198
+ // normal re-challenge in the logs and presents as an inexplicable
199
+ // auth loop. Diagnostic only — the decision above is unchanged.
200
+ if (isUnsatisfiableAuthType(requiredAuthType)) {
201
+ this.config.logger(
202
+ "[ToolContextBuilder] MISCONFIGURATION: tool requires an authorization type no delegation mint can produce - this tool will re-challenge forever",
203
+ {
204
+ toolName,
205
+ requiredAuthType,
206
+ mintableAuthTypes: [...MINTABLE_AUTH_TYPES],
207
+ hint: "Set the tool's authorization.type to one of the mintable types, or add mint support for the required type.",
208
+ }
209
+ );
210
+ }
190
211
  }
191
212
 
192
213
  // No (satisfying) delegation token - throw OAuthRequiredError to trigger auth flow