The rise of AI agents (like Cursor and Claude Desktop) is incredible. But if you've ever tried to build a custom tool for them to process large files—like a 50MB audio track or a video—you already know the pain.
LLMs have strict token and payload limits. You can't just pass a local .mp3 file into a prompt.
In this post, I'll share the architectural pattern I used to build a Remote MCP (Model Context Protocol) Server that allows an AI agent to process heavy media files entirely hands-free.
When you want an AI to process a file, the naive approach is to base64 encode it and send it. This blows up the context window instantly.
Alternatively, you can build a local MCP server that reads the file directly. But what if the processing requires heavy GPU compute that your local laptop doesn't have?
To solve this, I designed an MCP server that uses an asynchronous pipeline with presigned URLs.
Here is the exact flow the AI agent follows:
get_upload_url`` submit_task``check_task_status`` get_download_url
This pattern completely decouples the AI's reasoning from the heavy lifting.
Here is what a prompt looks like in Cursor:
"Extract the vocals from ./demo.mp3 and save the result locally."
The AI handles the file system, calls the tools, waits for the GPU, and drops the finished file right back into your project folder. It feels like magic.
stdio isn't enough. Host your server and expose it via HTTP.
I built this entire architecture for Sonicaura MCP (an audio processing engine). It's completely open-source and published in the official MCP Registry if you want to dig into the code or try it out.
If you are building agents, I'd love to know: How are you handling large file processing in your MCP servers? Let me know in the comments!