Skip to content

Conversation

@BrokenDuck
Copy link
Contributor

@BrokenDuck BrokenDuck commented Aug 30, 2025

Resolves #1455.

Why?

Making pyodide able to persist files would allow a lot of new workflows such as image manipulation or dataframe manipulation. A large file can be uploaded to the MCP server and manipulated in python. The file can later be downloaded.

What?

Add a new CLI option, --mount:

  • --mount storage: persistent storage is mounted to /home/pyodide/storage/
  • --mount: persistent storage defaults to /home/pyodide/persistence/
  • CLI option not given, no persistent storage is mounted to avoid performance impact

New MCP tools:

  • upload_file_from_uri: URI content will be copied to a file in the persistent storage. Any URI supported by fetch is supported.
  • retrieve_file: Retrieve file from its filename. Following MCP protocol, a resource link is returned.

New MCP Resource:

  • Any file uploaded to the MCP server appears as a resource which can be retrieved. A text resource is returned for common file types, otherwise a base 64 blob is returned.

How?

We mount a NODEFS emscripten file system in a temporary directory of the local file system during the run of the MCP Server. Therefore, Deno requires access to the temporary directory.

@BrokenDuck BrokenDuck marked this pull request as ready for review September 1, 2025 14:43
@DouweM
Copy link
Collaborator

DouweM commented Sep 2, 2025

@BrokenDuck We've moved mcp-run-python to its own repo: https://github.com/pydantic/mcp-run-python. Can you please resubmit this PR there?

@DouweM DouweM closed this Sep 2, 2025
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.

How can I export file(s) from Pyodide to local when using MCP Run Python?

2 participants