Compile and preview CharmIQ Applications from your existing tools — VS Code, Claude Code, or any MCP client.
|
|
srcdoc.https://api.charmiq.ai/mcp/applicationbuild_from_content | |
build_from_uri |
type ApplicationBuildArtifact = { contentType: string; content: string; cacheMaxAge?: number; trust?: unknown; manifest?: Record<string, unknown>; consumedFilePaths?: string[]; consumedVersions?: Record<string, number>; };
content is the rendered artifact. Write it to disk for local preview, or assign it to an iframe srcdoc inside an Application.build_from_content{ "manifest": { "id": "counter", "name": "Counter", "bundle": { "entry": { "html": "/index.html", "script": "/src/main.tsx" }, "format": "esm" } }, "files": [ { "path": "/index.html", "content": "<div id=\"root\"></div>" }, { "path": "/src/main.tsx", "content": "document.getElementById('root').textContent = 'Hello';" } ] }
bundle.mounts is not read from server disk; flatten mounted files into the submitted file set.build_from_content. The server never reads the caller's filesystem.const result = await mcp.callTool('application', 'build_from_content', { manifest, files: [ { path: '/index.html', content: await readText('index.html') }, { path: '/main.tsx', content: await readText('main.tsx') }, { path: '/App.tsx', content: await readText('App.tsx') }, { path: '/styles.scss', content: await readText('styles.scss') }, { path: '/_variables.scss', content: await readText('_variables.scss') }, ], }); await writeText('build/preview.html', result.structuredContent.content);
consumedFilePaths list is the fastest way to confirm the server built the files you expected.build_from_urimanifest.json, or at an Application document.{ "uri": "charmiq://folder/abc123" }
charmiq:// URIs.build_from_uri.build_from_content for local preview. The caller reads source files, sends their contents and writes content to disk.build_from_uri for CharmIQ-hosted source. Permissions, cache, trust, and staleness follow the normal Application pipeline.structuredContent. The text response mirrors content, but scripts should read the structured artifact.build_from_uri consumes.