Problem
The MCP server currently has no way to upload media files. The only option is CLI (npx emdash media upload) or the admin UI. This blocks full automation of content creation workflows.
Use case
When programmatically creating blog posts (e.g., via Claude Code + MCP), we need to:
- Generate or download a cover image
- Upload it to EmDash media storage
- Reference it in
featured_image / hero_image fields
Currently step 2 requires dropping to CLI or using raw API with CSRF headers and multipart form data, breaking the MCP-based workflow.
Proposed solution
Add a media_upload MCP tool that accepts:
file — base64-encoded file data, OR
url — URL to fetch the file from
filename — desired filename
alt — alt text
contentType — MIME type
Returns the media item with id, storageKey, and url — ready to use in content_create/content_update.
Current workaround
# Upload via raw API with CSRF headers (fragile, requires active session)
curl -X POST "https://site.workers.dev/_emdash/api/media" \
-H "Cookie: astro-session=SESSION_ID" \
-H "X-EmDash-Request: 1" \
-H "Origin: https://site.workers.dev" \
-F "file=@image.png;type=image/png"
This works but is not discoverable, requires session management, and can't be done through MCP.
Environment
- EmDash 0.5.0
- MCP server enabled
- Cloudflare Workers deployment
Problem
The MCP server currently has no way to upload media files. The only option is CLI (
npx emdash media upload) or the admin UI. This blocks full automation of content creation workflows.Use case
When programmatically creating blog posts (e.g., via Claude Code + MCP), we need to:
featured_image/hero_imagefieldsCurrently step 2 requires dropping to CLI or using raw API with CSRF headers and multipart form data, breaking the MCP-based workflow.
Proposed solution
Add a
media_uploadMCP tool that accepts:file— base64-encoded file data, ORurl— URL to fetch the file fromfilename— desired filenamealt— alt textcontentType— MIME typeReturns the media item with
id,storageKey, andurl— ready to use incontent_create/content_update.Current workaround
This works but is not discoverable, requires session management, and can't be done through MCP.
Environment