Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

plugin-mcp: auto-generated create tool for upload-enabled collections has no way to attach file content

Aperta
#18,286 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nodejs, typescript
Ambito
api, backend

Direzione di ricerca

Start by tracing createRequestFromPayloadRequest through mcp-handler, then inspect convertCollectionSchemaToZod and mcp/tools/resource/create.js for how upload collection schemas and create arguments are handled. Done means an upload-enabled collection's generated create tool can receive file content and complete creation, including with the storage configurations described in the issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug

Summary
For any collection with upload: true, plugin-mcp's auto-generated create<Collection> tool can never succeed — it has no parameter for file content, so every call fails with MissingFile: No files were uploaded.

Reproduction

  1. Enable the plugin on an upload collection (e.g. Payload's own Media example) with create capability on.
  2. Call the generated tool, e.g. createMedia, with the collection's writable fields (alt, etc.).
  3. Call fails: Error creating resource in collection "media": MissingFile: ...

Root cause (traced in the installed @payloadcms/[email protected] / [email protected]):

  • The MCP endpoint hands the raw request to a generic JSON-RPC handler (createRequestFromPayloadRequest → mcp-handler) — no multipart parsing anywhere in that path.
  • The tool's input schema is generated purely from the collection's field schema (convertCollectionSchemaToZod), with no special-casing for upload collections — no file parameter is ever generated.
  • The generated handler (mcp/tools/resource/create.js) forwards only the JSON fields to payload.create({ data, ... }), never setting file.
  • Payload's own generateFileData() checkpoint then finds neither req.file nor an explicit file argument and throws.

This is independent of storage backend — local disk or S3, the create operation requires an attached file before it decides where to store it. Confirmed same failure against S3-backed storage.

Suggested fix direction, and offer to contribute: for collections with upload: true, the generated tool could accept a base64-encoded file argument and pass it through as file: { data: Buffer.from(base64, 'base64'), mimetype, name, size } on the Local API create() call (supported since #708). I've verified this works end-to-end (base64 round-trip + real S3 upload) as a standalone patch — happy to open a PR if that direction is welcome, or if there's a reason upload collections were intentionally left out, that'd be useful to know too.

Versions: @payloadcms/[email protected], [email protected], Postgres adapter, @payloadcms/storage-s3.

Lingua principale
TypeScript
Stelle
45.5k
Fork
4.3k
Merge medio
1g 15h
PR unite (30g)
306

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di payloadcms/payload

Tutte le issue di payloadcms/payload

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.