Skip to content

fix(tools): support local file upload in upload_asset tool#310

Open
Aniruddha Ganesh (Aniganesh) wants to merge 1 commit into
contentful:mainfrom
Aniganesh:fix/upload-asset-local-files
Open

fix(tools): support local file upload in upload_asset tool#310
Aniruddha Ganesh (Aniganesh) wants to merge 1 commit into
contentful:mainfrom
Aniganesh:fix/upload-asset-local-files

Conversation

@Aniganesh
Copy link
Copy Markdown

Summary

Add support for uploading local files in the upload_asset tool.

Description

This PR updates the upload_asset tool to correctly handle local file uploads.

Previously, the tool simply passed the upload parameter directly to Contentful's file.upload field, which strictly requires a publicly accessible http/https URL. This caused validation errors when agents like CC attempted to upload local files.

The changes include:

  • Detection of local file paths (paths starting with file:// or non-http strings).
  • Reading the file content from the local filesystem.
  • Uploading the binary data to Contentful's intermediate /uploads API.
  • Creating the final Asset using the uploadFrom property to link to the uploaded binary, instead of the upload property.

Motivation and Context

Was trying to use this MCP with Claude code (CC) and encountered issues uploading assets, as the tool expected a file hosted on a https:// URL while I was providing a local image path. This change enables the tool to seamlesssly handle file inputs from the local filesystem.

PR Checklist

  • I have read the CONTRIBUTING.md file
  • All commits follow conventional commits
  • Documentation is updated (if necessary)
  • PR doesn't contain any sensitive information
  • There are no breaking changes

@Aniganesh Aniruddha Ganesh (Aniganesh) requested a review from a team as a code owner February 6, 2026 18:50
@wiz-inc-38d59fb8d7
Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 1 Low
Software Management Finding Software Management Findings -
Total 1 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants