@@ -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