Skip to content

Commit ffc26e0

Browse files
Apps: Set all CSP settings for ChatGPT to fix bug where it doesn't merge them with the MCP Apps settings (#647)
1 parent 7ee3bdf commit ffc26e0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crates/apollo-mcp-server/src/apps/resource.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,14 @@ pub(crate) async fn get_app_resource(
9494
}),
9595
);
9696

97-
// Openai has a specific property so we'll set that separately
97+
// Openai has a weird bug where it won't merge these settings with the MCP ones... so we just have to set both.
9898
if matches!(app_target, AppTarget::AppsSDK) {
9999
meta.get_or_insert_with(Meta::new).insert(
100100
"openai/widgetCSP".into(),
101101
json!({
102+
"connect_domains": csp.connect_domains,
103+
"resource_domains": csp.resource_domains,
104+
"frame_domains": csp.frame_domains,
102105
"redirect_domains": csp.redirect_domains
103106
}),
104107
);
@@ -236,8 +239,10 @@ mod tests {
236239
assert_eq!(mime_type, Some("text/html;profile=mcp-app".to_string()));
237240

238241
let meta = meta.unwrap();
239-
// OpenAI-specific CSP with redirect_domains should be at root
240242
let csp = meta.get("openai/widgetCSP").unwrap();
243+
assert!(csp.get("connect_domains").is_some());
244+
assert!(csp.get("resource_domains").is_some());
245+
assert!(csp.get("frame_domains").is_some());
241246
assert!(csp.get("redirect_domains").is_some());
242247
// OpenAI-specific description should be at root
243248
assert!(meta.get("openai/widgetDescription").is_some());

0 commit comments

Comments
 (0)