Skip to content

Improvment: Use resources and resource urls with the filesystem MCP server #297

Closed

Description

@snaggle-ai

Is your feature request related to a problem? Please describe.
The filesystem MCP server method for reading non-text files is to call the read_file tool and return a base64 encoded string of the contents of the file. This is of limited usefulness and on files of moderate size it maxes out the response size and crashes claude.

This pretty much prevents using the filesystem MCP to interact with image files on local storage as any modern image is too large to load as a base64 string (and pass all the text through the LLM consuming tons of tokens).

The modelcontextprotocol spec describes how binary resources can be used for images and documents: https://modelcontextprotocol.io/docs/concepts/resources#binary-resources

Describe the solution you'd like
As a reference implementation the filesystem MCP should return resource urls rather than raw contents for non-text files, or for files over a certain size.

Describe alternatives you've considered
Allow Claude to directly load images into its context based on a path to a file without needing to use MCP

Activity

  1. xhiroga commented on Apr 21, 2025

    @xhiroga

    I too am interested in this issue.
    Having said that, I think its uniqueness would be an issue if it returns a URI, since I thought MCP was probably designed to run both on a local machine and on a web app.

    Is there a solution to this problem, such as http://resource-name.mcp, where the mcp server is supposed to act as an HTTP server and pay out a local-machine-only domain?
    (Sorry if I am wrong in my assumptions, etc. I would like to hear other people's opinions...)

  2. added
    server-filesystemReference implementation for the Filesystem MCP server - src/filesystem
    on Apr 26, 2025
  3. OR13 commented on May 3, 2025

    @OR13

    For small files, ideally we would have read_file_as_data_uri.

    For larger files, the file needs to be a resource that is available to the mcp server that needs to process it.
    This could be implemented many different ways... but ideally, a local MCP server would upload the file and create a short URI and then a remote MCP server could access that URI assuming it had correct permissions.

    I suppose you could also serve local files via a dev tunnel to a remote MCP server... security issues with all of these options.

  4. X1pheR commented on Oct 13, 2026

    @X1pheR

    A downstream filesystem implementation already provides a bounded file-transport bridge; I am reconciling it with this existing issue rather than opening a duplicate resource-link request.

    The transport contract is deliberately separate from ordinary inspection:

    • Explicit export/attach/transfer/download intent and confirmation before issuing a resource link or making any downloadable copy.
    • A regular-file allowlist check against the current MCP Roots, size limit, streaming SHA-256, expiring opaque export tickets, and integrity/identity revalidation on resources/read.
    • Optional externally served static staging with atomic publication and TTL cleanup; no embedded generic binary payload in normal tool JSON.
    • Complementary bounded ingress from an authorized file reference into a server-configured directory, validating trusted download origins and redirect targets, preserving exact bytes, optionally verifying an expected hash, and refusing overwrite by default.
    • Preview remains native image/audio; generic binary materialization is an explicit transport action.

    Client-specific native file-parameter metadata and deployment-specific download origins need not be part of the reference server. A generic opt-in extension could expose a narrow file-reference contract while leaving those adapters to consumers.

    The current 1.0.0 release provides the per-instance server factory and Roots barrier needed to keep such extensions confined. Our release-adoption candidate retains bridge regression coverage and adds per-session/Roots-revocation checks. This is not a claim that existing read_media_file embedded resources satisfy the complete transport contract.

    Under the repository's maintainer-only PR policy, would maintainers prefer an opt-in reference-server capability or a documented factory/extension hook for a separate adapter? I can provide a deployment-neutral prototype and regression prompts if this direction fits the reference implementation. No duplicate PR is being opened.

  5. cliffhall commented on Oct 19, 2026

    @cliffhall
    Member

    Triage: Priority Low (total 5)

    • Severity 3: The filesystem server still returns binary content inline and registers no resources; exposing files as resources or resource links would demonstrate an MCP feature and is in scope for a reference server.
    • Urgency 2: wanted eventually
    • Bonuses: none

    Board: Servers V2 (#43), Status Incoming, awaiting maintainer review (no milestone yet). Part of the backlog triage in #4875.

  6. added this to the v2.3.0 milestone on Oct 25, 2026
  7. self-assigned this
    on Oct 28, 2026
  8. cliffhall commented on Oct 29, 2026

    @cliffhall
    Member

    Shipped in #5368, merged into v2/main; it releases with milestone v2.3.0. Tested together with the rest of the #5269 work in the rollup #5405.

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestserver-filesystemReference implementation for the Filesystem MCP server - src/filesystemv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions