-
Notifications
You must be signed in to change notification settings - Fork 51
fix(mcp-oauth): let external OAuth clients use aggregate/virtual MCP endpoints #4263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9b132ab
2e84de8
3ff28d6
35f930d
e51ad76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ import { | |
| recordSuccess, | ||
| } from "./circuit-breaker"; | ||
| import { clientFromConnection } from "./client"; | ||
| import { isPerUserAuthorizationRequiredError } from "./outbound/errors"; | ||
| import { invalidateConnectionCaches } from "./mcp-cache-invalidation"; | ||
| import { | ||
| fetchWithCache, | ||
|
|
@@ -119,7 +120,14 @@ export function createLazyClient( | |
| // Clear cached promise so transient failures don't permanently | ||
| // break the client — next call will retry the connection. | ||
| realClientPromise = null; | ||
| recordFailure(connection.id); | ||
| // A per-user authorization prompt is an expected state for | ||
| // `auth_mode: "per_user"` connections without a token for the caller, | ||
| // NOT a downstream outage. Counting it as a failure trips the circuit | ||
| // breaker, which then 503s the connection — hiding the "Connect your | ||
| // account" UI and blocking the very OAuth the error is asking for. | ||
| if (!isPerUserAuthorizationRequiredError(err)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: The added suppression prevents per-user auth errors from tripping the circuit breaker, which is good, but it doesn't help when the circuit is already open. Because Prompt for AI agents |
||
| recordFailure(connection.id); | ||
| } | ||
| throw err; | ||
| }); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: The
isPerUserAuthorizationRequiredError(error)early return gates the circuit-breaker failure accounting and auto-disable logic. If that cross-file classifier is overly broad (e.g., message-substring or regex based), non-auth downstream failures could be misclassified as expected per-user auth states. That would suppressrecordFailure(...)andshouldDisable, hiding real outages behind repeated 401 responses and silently disabling circuit protection. Given the project convention [ID: 9aca6f72-ab03-43f2-bc16-ef06243974f8] to use exact message equality for internally-controlled errors, verify the classifier uses strict equality rather than substring/regex matching to prevent misclassification.Prompt for AI agents