Publishing and Workflow

Uploading images and files from an AI assistant

Mis à jour 229 vues

An assistant connected to your project over MCP can upload images and files and put them in the entries it writes: a screenshot in a help article, an architecture diagram in a blog post, a PDF attached to a changelog entry, or a cover image.

Before you start

Uploading needs an assistant that can run commands on your machine — Claude Code, Cursor in agent mode, Codex CLI and similar. The file goes from your computer straight to storage with curl, so the assistant has to be able to run it.

Uploading is a write, so the assistant's token needs Read and write access. A read-only token is not offered the upload tools at all.

Chat apps that cannot run commands, such as claude.ai or the Claude Desktop chat, cannot upload. They can still write and edit entries; add the images in the dashboard afterwards.

If your assistant was connected before v1.12.0, it used a shared MCP key that has stopped working: create a personal token and reconnect. Most MCP clients read the tool list once, when they connect, so restart the client after switching to a different token.

Ask for it

You never call the tools yourself. Say what you want:

Upload ./screenshots/settings.png and add it under the "Create a token" heading of the MCP help article, with a short alt text.

Write a blog post about the new importer and use ./assets/importer-hero.png as its cover image.

What happens underneath

  1. create_upload — the assistant sends the file name (with its extension), the MIME type and the exact size in bytes. Kookee reserves the file and answers with a one-time upload URL and a ready-made curl command. Nothing is stored yet.

  2. curl — the assistant runs that command with the path to your file. The bytes go directly to storage, not through Kookee, and the command prints 204 when the upload succeeded. The upload URL is valid for one hour.

  3. confirm_upload — Kookee checks that the file really arrived and is exactly the declared size, then returns its public URL and a snippet that embeds it.

  4. The assistant pastes the snippet into an entry — with create_entry, edit_entry_content or replace_entry_content — or into a comment.

A file is only usable once confirm_upload has succeeded.

Images, file chips and covers

What the snippet embeds depends on the file:

  • JPG, PNG, GIF, SVG and WEBP become an image in the body, with the alt text the assistant passed to confirm_upload.

  • Everything else — PDFs, office documents, archives, video, and image formats browsers do not display (TIFF, HEIC, BMP, EPS) — becomes a file chip that readers click to download.

To make an image the cover, the assistant passes its file id as coverImageId to create_entry or update_entry; null removes the cover. A cover must be a JPG, PNG, GIF, SVG or WEBP uploaded to this project. An image pasted into the dashboard editor before 25 September 2026 cannot be picked as a cover over MCP — have the assistant upload the file instead.

Why the snippet matters

When you read an entry back, an uploaded image appears as an HTML block such as <p><img src="…" alt="…" data-id="…"/></p>. The data-id is what tells Kookee the entry uses the file.

An upload's URL written as plain markdown — ![diagram](https://cdn.kookee.dev/…) — carries no id. The file would never be linked to the entry and would be deleted a few days later, leaving a broken image behind. Kookee refuses that write with ENTRY_UPLOAD_NOT_LINKED, and the assistant uses the snippet instead. External images, and images already used elsewhere in your project, can still be written as ordinary markdown.

Good to know

  • Uploads are public. Anyone with a file's URL can open it from the moment it is uploaded, even while the entry using it is still a draft. Do not upload anything you would not publish.

  • Unused files are removed. A file not used in any entry or comment within 3 days is deleted permanently, so upload and insert in the same session.

  • Same file types as the dashboard. Images (JPG, PNG, GIF, SVG, WEBP, TIFF, HEIC, BMP, EPS), documents (PDF, Word, Excel, PowerPoint, Keynote, ODP, CSV, JSON, TXT, MSG), video (MP4, MOV, AVI, MPEG) and ZIP or RAR archives.

  • Same storage limits. Uploads count against the project owner's plan — the size of each file, the number of files and total storage (on Free: 25 MB per file, 1,000 files and 1 GB). See Rate limits, plans and error handling.

  • Paths with quotes. If the path to your file contains ', " or \, the assistant copies the file to a plain temporary path first, such as /tmp/upload.png, and uploads the copy.

  • Rate limit. A project can start up to 60 uploads a minute.

If something goes wrong

Code

What it means

What to do

FILE_TYPE_NOT_ALLOWED

The file type is not accepted, or a cover is not a JPG, PNG, GIF, SVG or WEBP

Use a supported format

VALIDATION_ERROR

The file name contains a slash, a backslash or a control character

Rename the file

FILE_SIZE_TOO_BIG, FILE_NOT_ENOUGH_SPACE, FILE_MAX_COUNT_REACHED

A plan limit was reached

Upgrade, or free up storage in the dashboard

PROJECT_STORAGE_FULL

The project owner's storage is full, and you are not the owner

Ask the project owner to free up space or upgrade

FILE_NOT_UPLOADED

confirm_upload found nothing in storage

Run the curl command again, then confirm

curl prints 400

The file is not exactly the size declared to create_upload

Start over with create_upload and the exact size

ENTRY_UPLOAD_NOT_LINKED

The body points at a new upload by URL, without its id

Paste the snippet instead

RATE_LIMIT_EXCEEDED

Too many requests in the last minute

Wait a minute and retry

To connect an assistant in the first place, see Managing your content from an AI assistant (MCP).

Cet article vous a-t-il aidé ?