Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
snaggle-ai opened this issue Dec 10, 2024 · 2 comments
Labels
enhancement New feature or request server-filesystem Reference implementation for the Filesystem MCP server - src/filesystem

Comments

@snaggle-ai
Copy link
Contributor

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

@xhiroga
Copy link

xhiroga commented Apr 21, 2025

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...)

@olaservo olaservo added the server-filesystem Reference implementation for the Filesystem MCP server - src/filesystem label Apr 26, 2025
@OR13
Copy link

OR13 commented May 3, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server-filesystem Reference implementation for the Filesystem MCP server - src/filesystem
Projects
None yet
Development

No branches or pull requests

4 participants