Skip to content

Passing attachments (resources) to MCP servers? #155

@iafan

Description

@iafan

Is your feature request related to a problem? Please describe.
As I was reading through the documentation, and experimenting with Claude Desktop and my own MCP server implementation, I couldn't find a way to pass a binary file as an 'attachment' to MCP server. I can return a 'resource', but apparently there's no way to provide resource to the MCP tool call.

Describe the solution you'd like
I would like to support the following scenario:
When prompting an LLM, user attaches a file. An MCP tool can then take this file and preprocess it (for example, extracting some metadata, or converting it to a different format) and return the result in plain text format or as a resource of any mime type. An LLM can then either display it to the user or decide what to do with this resource next.

Describe alternatives you've considered
I tried to instruct LLM (Claude 3.5 Sonnet) to pass file as a Base64-encoded string, but if the file is large, it is suboptimal, and it does seem that Claude is confused about its ability to pass files this way, which requires some additional prompting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions