Get a Hosted App file upload URL
request_app_upload_urlThe PUT must be sent from the caller's own environment, over outbound HTTPS to this server's host. That works from Claude Code or a terminal. Hosted code sandboxes, such as ChatGPT's, have no outbound network, so a URL minted there cannot be used. Such a caller hands the file over with import_app_file when its client can attach or reference the file, and otherwise sends it with stage_app_file in base64 parts. Request a single-use URL for uploading a local binary asset directly with curl -X PUT --data-binary, without emitting its bytes as tool arguments. Returns an absolute url, expires_at and curl example in structuredContent. Treat the URL as a secret. The upload returns accumulated size_bytes and sha256 for verification before publishing. A lost URL response uploads nothing by itself: if no PUT was dispatched, request a fresh URL and let the unused one expire. After an uncertain PUT, call list_staged_app_files with the same slug and publisher and compare path, content_type, accumulated size_bytes and sha256 against the intended prefix. Never replay a consumed URL or blindly repeat an append with a fresh URL. Absence can mean expiry, consumption by publication, or an in-flight PUT; it is not permission to retry. The PUT's own response is the only settlement evidence for that attempt, and a listing never says which PUT wrote the bytes it shows. When that response is lost, do not append another part: replace the complete file — a fresh URL with append: false for its first part and fresh URLs appending the rest — then verify the staged sha256 before publishing and the published file's sha256 after publishing. A published digest that differs from the intended file is an unresolved duplicate or lost write: stop and hand it to a person with the digests you read. After publishing, call list_staged_app_files for the slug: a publish consumes the whole area, so any file still staged is an earlier attempt that landed after the publish; discard it with discard_staged_app_files and report it to a person before any later publish. For binary assets on disk, call request_app_upload_url and run its curl command so bytes do not pass through the model. Each URL is single-use, expires after 15 minutes, and binds the project, publisher, slug, path, content type and append flag. Upload parts of at most 1 MiB using a fresh URL for each part, with append: true after the first. An accepted attempt consumes its URL even if reading or staging fails; inspect staged sizes and sha256 before retrying. Each MCP call is limited to 1048576 bytes for the entire request body, including the JSON envelope and encoded files. Base64 leaves less than 768 KiB of decoded content after overhead. Use stage_app_file to send a file larger than one call in ordered parts with append: true after its first part; encode each base64 part independently. Each staged file expires 6 hours after its last write; expired files are hidden from listings, deleted on area mutations, and swept hourly in bounded batches across all areas. The area belongs to this project, publisher and slug. A taken slug you cannot manage is refused with slug_unavailable by staging, listing, discarding, publication and signed-upload redemption; this reveals only that the slug is taken, and nothing is staged or created.
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>",
"path": "<path>"
},
"name": "request_app_upload_url"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Relative file path | |
| slug | Yes | 1–64 lowercase letters, digits and internal hyphens; an app need not exist yet | |
| append | No | Default false replaces the path; true appends an ordered part with the same content type | |
| content_type | No | 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. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| curl | Yes | ||
| expires_at | Yes |