@kya-os/mcp-i-core 1.3.26 → 1.3.27
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.
|
@@ -685,18 +685,31 @@ function authorizationMatches(delegationAuth, toolAuth) {
|
|
|
685
685
|
// No tool auth requirement - allow any delegation
|
|
686
686
|
if (!toolAuth)
|
|
687
687
|
return true;
|
|
688
|
-
//
|
|
688
|
+
// ✅ CROSS-TYPE COMPATIBILITY: credential providers can satisfy oauth requirements
|
|
689
|
+
// When a credential provider (like email/password) is used:
|
|
690
|
+
// - Delegation is created with: { type: 'credential', credentialType: 'credentials' }
|
|
691
|
+
// - Tool protection may specify: { type: 'oauth', provider: 'credentials' }
|
|
692
|
+
// These should be considered equivalent since they represent the same auth method.
|
|
693
|
+
const isCredentialToOAuthCompatible = delegationAuth.type === "credential" &&
|
|
694
|
+
toolAuth.type === "oauth" &&
|
|
695
|
+
delegationAuth.credentialType &&
|
|
696
|
+
toolAuth.provider &&
|
|
697
|
+
delegationAuth.credentialType === toolAuth.provider;
|
|
698
|
+
if (isCredentialToOAuthCompatible) {
|
|
699
|
+
return true;
|
|
700
|
+
}
|
|
701
|
+
// Compare type (strict match for other cases)
|
|
689
702
|
if (delegationAuth.type !== toolAuth.type)
|
|
690
703
|
return false;
|
|
691
704
|
// For OAuth, compare provider (undefined in toolAuth means "any provider is acceptable")
|
|
692
|
-
if (delegationAuth.type ===
|
|
705
|
+
if (delegationAuth.type === "oauth") {
|
|
693
706
|
// If tool doesn't specify a provider, any provider is acceptable
|
|
694
707
|
if (!toolAuth.provider)
|
|
695
708
|
return true;
|
|
696
709
|
return delegationAuth.provider === toolAuth.provider;
|
|
697
710
|
}
|
|
698
711
|
// For credential, compare credentialType (undefined in toolAuth means "any type is acceptable")
|
|
699
|
-
if (delegationAuth.type ===
|
|
712
|
+
if (delegationAuth.type === "credential") {
|
|
700
713
|
// If tool doesn't specify a credential type, any type is acceptable
|
|
701
714
|
if (!toolAuth.credentialType)
|
|
702
715
|
return true;
|