Hi @mowens!

I would like to propose a new feature for the MCP Tools module that enables fetching remote medias (images only for now) and creating them as Drupal media entities, then attaching them to Drupal content, all via MCP.

This enables workflows like:

Create a new Image media by fetching an image from a URL, then create a new Article and attach this image as the main image.

I'd appreciate your thoughts on whether this should be a sub-module of mcp_tools or if it would be better suited elsewhere in the contrib ecosystem.

A merge request will follow.


Module Overview by Claude:

Proposing mcp_tools_remote_media as a new sub-module for MCP Tools.

The module provides a FetchRemoteImage tool that allows Claude to:

  • Download images from remote URLs (JPEG, PNG, GIF, WebP, SVG)
  • Create managed Drupal media entities automatically
  • Validate file integrity and size (10 MiB max)
  • Store files in configurable stream wrapper directories

Status: Production-ready

  • 20 unit tests (100% pass rate)
  • Drupal coding standards compliant (phpcs --standard=Drupal,DrupalPractice)
  • Secure: URL scheme, MIME type, and path traversal validation
  • Extensible architecture: ready for documents, audio, and video support

Proposed location:

/modules/mcp_tools_remote_media/ (as a sub-module of mcp_tools)

Issue fork mcp_tools-3577187

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

guillaumeg created an issue. See original summary.

mowens’s picture

@guillaumeg, thanks for this great contribution! We've merged your mcp_tools_remote_media submodule into the project and it shipped in 1.0.0-beta6.

Your architecture was solid - the AbstractRemoteFileService base class with abstract methods for MIME types, extension maps, and operation names is exactly the right design for future expansion into documents, audio, and video.

We applied additional security hardening as well. Let me know if I can help with any more improvements in the future.

guillaumeg’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

guillaumeg’s picture

Status: Fixed » Closed (fixed)