Skip to content

Commit f08e8ec

Browse files
committed
fix(oauth): drop duplicate RFC 8707 resource param
rmcp 1.5 already appends resource to the authorize and token requests, so the gateway's add_resource_parameter wrapper produced ?resource=...&resource=... Supabase's authorize endpoint rejects the repeated key with "resource: Expected string, received array". Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent af600c8 commit f08e8ec

1 file changed

Lines changed: 0 additions & 35 deletions

File tree

crates/mcpmux-gateway/src/pool/oauth.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -255,36 +255,6 @@ impl OutboundOAuthManager {
255255
scopes.iter().map(|s| s.as_str()).collect()
256256
}
257257

258-
/// Add RFC 8707 'resource' parameter to authorization URL.
259-
///
260-
/// The resource parameter tells the Authorization Server which protected resource
261-
/// (MCP server) the client is requesting access to. This enables the AS to:
262-
/// - Issue tokens scoped to the specific resource
263-
/// - Apply resource-specific policies
264-
/// - Prevent token replay at other resources
265-
///
266-
/// Some servers (like Miro) require this parameter.
267-
fn add_resource_parameter(auth_url: &str, server_url: &str) -> String {
268-
use url::Url;
269-
270-
match Url::parse(auth_url) {
271-
Ok(mut url) => {
272-
// Add the resource parameter with the MCP server URL
273-
url.query_pairs_mut().append_pair("resource", server_url);
274-
info!("[OAuth] Added RFC 8707 resource parameter: {}", server_url);
275-
url.to_string()
276-
}
277-
Err(e) => {
278-
warn!(
279-
"[OAuth] Failed to parse auth URL to add resource parameter: {}",
280-
e
281-
);
282-
// Return original URL if parsing fails
283-
auth_url.to_string()
284-
}
285-
}
286-
}
287-
288258
/// Subscribe to OAuth completion events
289259
pub fn subscribe(&self) -> tokio::sync::broadcast::Receiver<OAuthCompleteEvent> {
290260
self.completion_tx.subscribe()
@@ -1252,11 +1222,6 @@ impl OutboundOAuthManager {
12521222
}
12531223
};
12541224

1255-
// Add RFC 8707 'resource' parameter to the authorization URL.
1256-
// This tells the Authorization Server which protected resource (MCP server)
1257-
// the token is being requested for. Some servers (like Miro) require this.
1258-
let auth_url = Self::add_resource_parameter(&auth_url, server_url);
1259-
12601225
// Extract state parameter from auth_url
12611226
let state = match Self::extract_state_from_url(&auth_url) {
12621227
Some(s) => s,

0 commit comments

Comments
 (0)