Publish a Hosted App
publish_app_versionPublish a static Hosted App immediately at /projects/{pid}/apps/{slug}/ and return its absolute URL. Publish is final: members with access see it now. A first publication requires name. Only a verified human Administrator of this Project may publish; a taken slug you cannot manage answers slug_unavailable. The first version starts Administrators-only; share it with Roles through set_app_access. Inline scripts and styles are allowed; declare every external HTTPS origin in external_hosts (HTTP only on loopback). The app is served on its own host. It calls only the Requests its current version records, plus those listed in calls_without_grant, using plain fetch of GET /api/data/v1/projects/{pid}/catalog and POST /api/data/v1/projects/{pid}/requests/{request_id}/execute on that host. Execute with Accept and Content-Type application/json and {"parameters": {...}}; never embed bearer tokens in app files. Publishing records the approved Requests the version calls: those in requests plus any Request UUID found in its files, except calls_without_grant, which are never recorded; strict_recording: true records only declared Requests. The Roles the app is shared with reach those Requests everywhere, so sharing an app is the grant. Returns requests (declared, scanned, recorded, calls_without_grant, mode) and access_changes; identical content answers unchanged: true. files[].sha256 is each file's own SHA-256; content_hash digests the whole version. Publishes the union of this publisher's staged area and inline files; inline files win on the same path, and files may be empty when files are staged. A refusal preserves the area for correction and retry. A successful publish consumes the whole area, including an unchanged publish. To republish, pass base_version_id (the current version), send only the changed paths in files and name deleted paths in remove_paths, or change a file without resending it: edits whose old_string appears exactly once, guarded by expected_sha256. Inspect staged sizes and published versions after an uncertain response before retrying: compare list_apps({}) current_version_id and list_app_versions include_files: true (files, entry, manifest); if a later publication is current, report it; never reactivate the old version, and keep the original base_version_id on a retry. Read describe_hosted_app_publishing before writing an app that calls Requests, confirms actions or stores data, or before retrying after an uncertain response, and when a refusal names it: the HTTP contract, error codes, stream_status, confirmation screens, recording, staging and edits. See request_app_upload_url for shared upload limits, chunking, expiry and staging lifecycle rules.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"slug": "<slug>"
},
"name": "publish_app_version"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Required on first publish; omitted on republish retains the current name | |
| slug | Yes | 1–64 lowercase letters, digits and internal hyphens | |
| edits | No | In-file text replacements {path, old_string, new_string, expected_sha256?} applied in order after base, staged and inline files, each old_string appearing exactly once in a text file; accepts an array or JSON string. | |
| entry | No | Entry file path; default index.html | |
| files | No | Inline files: {path, content, encoding?: utf8|base64, content_type?}; [] is allowed when files are staged. Type inferred from extension when omitted. For a recognized extension, explicit content_type must match; otherwise an explicit allowed content_type is required. Allowed types (extension: content_type): .cjs: text/javascript; .css: text/css; .csv: text/csv; .gif: image/gif; .htm: text/html; .html: text/html; .ico: image/x-icon; .jpeg: image/jpeg; .jpg: image/jpeg; .js: text/javascript; .json: application/json; .md: text/markdown; .mjs: text/javascript; .otf: font/otf; .pdf: application/pdf; .png: image/png; .svg: image/svg+xml; .ttf: font/ttf; .txt: text/plain; .wasm: application/wasm; .webp: image/webp; .woff: font/woff; .woff2: font/woff2. PDFs are served as downloads: an app fetches their bytes to process them, and they cannot be shown inline. The union permits at most 500 files, 5242880 decoded bytes each, 52428800 decoded bytes total; the smaller MCP request-body ceiling still applies. Accepts an array or JSON string. | |
| requests | No | Request UUIDs this page calls. Each must be an approved Request of this Project. UUIDs found in the files are recorded too unless strict_recording is true. List a Request the page calls but sharing must not grant in calls_without_grant instead. | |
| description | No | App description; omitted retains the current description | |
| remove_paths | No | Relative paths to drop from the base version. Each must be a path the base already holds and must not also be sent in files or staged. Accepts an array or JSON string. | |
| setup_step_id | No | Optional setup step UUID this call fulfils (Administrator only). Pass a planned entry you recorded, or the id of the step this Project already opened for the same component. Otherwise the same MCP session's oldest unbound plan of this kind matching its subject hint is used, otherwise a new entry opens. A committed creation whose journal binding fails still succeeds with a warning naming this entry; do not repeat creation. | |
| application_id | No | Optional app draft UUID in this Project, bound on first publication so its Application and Hosted App share it; omit on republish. | |
| external_hosts | No | At most 32 HTTPS origins, without paths; accepts an array or JSON string | |
| base_version_id | No | Stored version UUID to start from, so only changed paths need to be sent. Must be this app's current version; omitted publishes exactly the staged and inline files. | |
| strict_recording | No | true records only declared Requests, refusing the publish with hosted_app_request_undeclared when its files call an approved Request that is neither declared nor in calls_without_grant; omitted or false is scan mode, and requests.mode answers strict or scan. | |
| calls_without_grant | No | calls_without_grant lists Request UUIDs this page calls that sharing never grants, so only a viewer who already holds one can run it; omitted on a republish keeps the current list and [] clears it. |