Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ a2a_agents/python/a2ui_agent/src/a2ui/assets/**/*.json
## new agent SDK path
agent_sdks/python/src/a2ui/assets/**/*.json
## Generated files for sandbox frame.
samples/client/angular/projects/mcp_calculator/public/sandbox_iframe/
samples/client/angular/projects/mcp_calculator/public/mcp_apps_inner_iframe/
2 changes: 1 addition & 1 deletion samples/client/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build:renderer": "cd ../../../renderers && for dir in 'web_core' 'markdown/markdown-it'; do (cd \"$dir\" && npm install && npm run build); done",
"serve:agent:restaurant": "cd ../../agent/adk/restaurant_finder && uv run .",
"demo:restaurant": "npm run build:renderer && concurrently -k -n \"AGENT,WEB\" -c \"magenta,blue\" \"npm run serve:agent:restaurant\" \"npm start -- restaurant\"",
"build:sandbox": "esbuild ../shared/sandbox_iframe/sandbox.ts --bundle --outfile=projects/mcp_calculator/public/sandbox_iframe/sandbox.js --format=esm --platform=browser --alias:@modelcontextprotocol/ext-apps/app-bridge=./node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js && cp ../shared/sandbox_iframe/sandbox.html projects/mcp_calculator/public/sandbox_iframe/sandbox.html"
"build:sandbox": "esbuild ../shared/mcp_apps_inner_iframe/sandbox.ts --bundle --outfile=projects/mcp_calculator/public/mcp_apps_inner_iframe/sandbox.js --format=esm --platform=browser --alias:@modelcontextprotocol/ext-apps/app-bridge=./node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js && cp ../shared/mcp_apps_inner_iframe/sandbox.html projects/mcp_calculator/public/mcp_apps_inner_iframe/sandbox.html"
},
"prettier": {
"printWidth": 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class McpApp
const disableSecuritySelfTest = urlParams.get('disable_security_self_test') === 'true';

const currentOrigin = window.location.origin;
let sandboxUrl = `${currentOrigin}/sandbox_iframe/sandbox.html`;
let sandboxUrl = `${currentOrigin}/mcp_apps_inner_iframe/sandbox.html`;
if (disableSecuritySelfTest) {
sandboxUrl += '?disable_security_self_test=true';
}
Comment on lines +152 to 155
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To make the URL construction more robust and readable, you could use the URL and URLSearchParams APIs. This avoids manual string concatenation for query parameters and handles encoding correctly.

    const url = new URL(`${currentOrigin}/mcp_apps_inner_iframe/sandbox.html`);
    if (disableSecuritySelfTest) {
      url.searchParams.set('disable_security_self_test', 'true');
    }
    const sandboxUrl = url.toString();

Expand Down
2 changes: 1 addition & 1 deletion samples/client/lit/contact/ui/shared-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
* limitations under the License.
*/

export const SANDBOX_BASE_PATH = "shared/sandbox_iframe/";
export const SANDBOX_BASE_PATH = "shared/mcp_apps_inner_iframe/";
export const SANDBOX_ENTRY_NAME = `${SANDBOX_BASE_PATH}sandbox`;
export const SANDBOX_IFRAME_PATH = `/${SANDBOX_ENTRY_NAME}.html`;
Comment on lines +17 to 19
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While the directory has been renamed to mcp_apps_inner_iframe, these constants and the files they point to (sandbox.ts, sandbox.html) still use the SANDBOX name. This creates some inconsistency. For a more complete refactoring, consider renaming the files and these constants to align with the new directory name. For example, SANDBOX_BASE_PATH could become MCP_APPS_INNER_IFRAME_BASE_PATH. This would improve clarity and consistency across the codebase. Note that this would require updating all usages of these constants and filenames.

1 change: 1 addition & 0 deletions samples/client/lit/contact/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default async () => {
alias: {
"@a2ui/markdown-it": resolve(__dirname, "../../../../renderers/markdown/markdown-it/dist/src/markdown.js"),
"sandbox.js": resolve(__dirname, "../../" + SANDBOX_ENTRY_NAME + ".ts"),
"@modelcontextprotocol/ext-apps/app-bridge": resolve(__dirname, "../node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This hardcoded relative path to node_modules can be brittle. If dependencies are hoisted to a root node_modules directory (common in monorepos) or the project structure changes, this path will break. A more robust approach would be to use a resolution algorithm to find the package path programmatically. For example, you could use a library like resolve for this purpose.

}
},
optimizeDeps: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Shared Sandbox iframe
# Shared MCP Apps Inner iframe (Sandbox iframe)

This directory contains the unified and reusable **Sandbox iframe** implementation for **A2UI applications** (Angular, Lit) to run **untrusted third-party Model Context Protocol (MCP) applications**.

Expand Down
Loading