Provide implementations of advanced data structures
中文简介正在准备中。当前显示原文说明。
Comprehensive Content Security Policy audit for MCP Apps in sandboxed iframes. Discovers all network origins, traces them to source, and generates CSP configuration for registerAppResource.
中文简介正在准备中。当前显示原文说明。
安装前可以查看交给 AI 代理的指令内容。
Perform exhaustive Content Security Policy audits for MCP Apps running in sandboxed iframes where all network requests fail SILENTLY without proper CSP declarations.
MCP Apps run in sandboxed iframes with no same-origin server. This means:
contents[] return from the registerAppResource read callbackThis skill provides a systematic methodology for discovering every network origin an app uses, tracing each to its source, and generating the correct CSP configuration.
script-src, style-src, img-src, font-src)connect-src)frame-src)registerAppResource read callback# Build to produce final output files
npm run build
# Identify all output files
find dist/ -type f \( -name "*.html" -o -name "*.js" -o -name "*.css" \)
# Search for URL patterns in build output
grep -rEoh 'https?://[a-zA-Z0-9._-]+[a-zA-Z0-9._/-]*' dist/ | sort -u
# Search for protocol-relative URLs
grep -rEoh '//[a-zA-Z0-9._-]+\.[a-zA-Z]{2,}' dist/ | sort -u
# Search for fetch/XHR patterns in source
grep -rn 'fetch\|XMLHttpRequest\|axios\|\.get\(\|\.post\(' src/
# Search for WebSocket connections
grep -rn 'new WebSocket\|wss://\|ws://' src/
# Search for dynamic imports and lazy loading
grep -rn 'import(\|require(\|loadScript' src/
For each discovered origin, determine:
| Origin | Source Type | Environment | Category |
|---|---|---|---|
https://cdn.example.com | Hardcoded constant | Universal | resourceDomains |
https://api.example.com | Environment variable (API_URL) | Conditional | connectDomains |
https://fonts.googleapis.com | Third-party library | Universal | resourceDomains |
wss://realtime.example.com | Conditional (feature flag) | Prod-only | connectDomains |
# Check node_modules for hidden network requests
grep -rn 'fetch\|XMLHttpRequest\|beacon\|sendBeacon' node_modules/<lib>/dist/ 2>/dev/null
# Common hidden request sources:
# - Analytics (Google Analytics, Segment, Mixpanel)
# - Error tracking (Sentry, Bugsnag, Datadog)
# - Font loading (Google Fonts, Adobe Fonts)
# - CDN fallbacks (jQuery CDN, unpkg)
# - Map tiles (Mapbox, Google Maps, Leaflet)
The CSP object goes in the contents[] return from registerAppResource:
import { registerAppResource, RESOURCE_MIME_TYPE } from '@modelcontextprotocol/ext-apps';
registerAppResource(server, {
uri: 'app:///my-app',
name: 'My App',
mimeType: RESOURCE_MIME_TYPE,
async read() {
return {
contents: [{
uri: 'app:///my-app',
mimeType: RESOURCE_MIME_TYPE,
text: bundledHtml,
// CSP configuration goes HERE, in contents[]
resourceDomains: [
'https://cdn.example.com',
'https://fonts.googleapis.com',
'https://fonts.gstatic.com',
],
connectDomains: [
'https://api.example.com',
...(process.env.NODE_ENV === 'development'
? ['http://localhost:3000']
: []),
],
frameDomains: [],
}],
};
},
});
For every origin that depends on configuration or environment:
// WRONG: Runtime URL uses config but CSP doesn't include it
const apiUrl = process.env.API_URL || 'https://api.example.com';
fetch(apiUrl); // Works for default, fails for custom API_URL
// RIGHT: Same config controls both runtime URL and CSP entry
const apiUrl = process.env.API_URL || 'https://api.example.com';
// In registerAppResource:
connectDomains: [apiUrl], // CSP matches runtime URL
contents[] from registerAppResource read callback, NOT in _meta on the tool.http://localhost:3000 needs CSP in dev mode.API_URL can be customized, the CSP must include whatever value it resolves to.resourceDomains, connectDomains, frameDomains), NOT snake_case.contents[] of registerAppResource read callbackconst mcpCspInvestigationTask = defineTask({
name: 'mcp-csp-investigation',
description: 'Perform CSP audit for MCP App in sandboxed iframe',
inputs: {
projectDir: { type: 'string', required: true },
buildCommand: { type: 'string', default: 'npm run build' },
outputDir: { type: 'string', default: 'dist' }
},
outputs: {
resourceDomains: { type: 'array' },
connectDomains: { type: 'array' },
frameDomains: { type: 'array' },
conditionalOrigins: { type: 'array' },
artifacts: { type: 'array' }
},
async run(inputs, taskCtx) {
return {
kind: 'skill',
title: `CSP investigation for ${inputs.projectDir}`,
skill: {
name: 'mcp-csp-investigation',
context: {
projectDir: inputs.projectDir,
buildCommand: inputs.buildCommand,
outputDir: inputs.outputDir,
instructions: [
'Build the application',
'Search all output for network origins',
'Trace each origin to source',
'Check third-party libraries for hidden requests',
'Categorize domains (resource, connect, frame)',
'Generate CSP configuration for registerAppResource',
'Verify conditional origins have matching CSP entries'
]
}
},
io: {
inputJsonPath: `tasks/${taskCtx.effectId}/input.json`,
outputJsonPath: `tasks/${taskCtx.effectId}/result.json`
}
};
}
});
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Provide implementations of advanced data structures
中文简介正在准备中。当前显示原文说明。
Fresh adversarial code review with binary PASS/FAIL verdicts, evidence citations, and anchoring bias prevention via fresh reviewer spawning.
中文简介正在准备中。当前显示原文说明。
WASM-based instant code transforms for simple tasks, achieving 352x speedup over LLM inference with zero cost.
中文简介正在准备中。当前显示原文说明。
Coordinate Crew (persistent) and Polecat (transient) agents using Gas Town's hook-based work distribution and GUPP principle.
中文简介正在准备中。当前显示原文说明。
Generate visual representations of algorithm execution
中文简介正在准备中。当前显示原文说明。
Hierarchical coordination and drift detection with frequent checkpoints, shared memory coherence validation, role specialization enforcement, and short task cycles.
中文简介正在准备中。当前显示原文说明。