VS Code can now dress you: Gradio turns Python scripts into AI shopping agents
Curated by the Inblix editorial team
Shopping sucks. It’s time-consuming, and frankly, trying on clothes in a cramped dressing room under fluorescent lights is nobody’s idea of a good time. But what if your code editor could handle the grunt work? A new demo from Gradio and Hugging Face shows exactly how to build a personal AI stylist that lives inside VS Code, and it’s a lot simpler than you’d think. The trick is Gradio’s recently beefed-up MCP (Model Context Protocol) server capabilities. With a single mcp_server=True flag, Gradio automatically converts your Python functions—docstrings and all—into tools that an LLM can understand and invoke. No wrestling with tool schemas. No manual JSON wrangling. Just write a function, and Gradio does the plumbing.
This shopping assistant combines three pieces: IDM-VTON, an AI model from Hugging Face that performs virtual try-ons by editing a photo of a person to make it look like they’re wearing a different garment; Gradio itself, acting as the bridge between the model and the LLM; and VS Code’s AI chat feature, which acts as the interface. The developer creates a single vton_generation function that takes a human model image and a garment image as inputs. Under the hood, it calls a hosted version of IDM-VTON via the Gradio client, but the LLM doesn’t need to know any of that—it just sees a clean tool description.
Configuring VS Code is a matter of editing a mcp.json file. You point one server entry to your local Gradio app running on port 7860 and another to Playwright, a browser automation tool. That second piece is what unlocks the “shopping” part: the LLM can now browse actual retail sites like Uniqlo, find clothes, grab the images, and feed them straight into the virtual try-on model. “Browse the Uniqlo web…” you might type, and the assistant takes it from there.
This isn’t just a parlor trick. It’s a concrete example of how MCP servers are making AI agents genuinely useful without requiring a PhD in distributed systems. The auto-generated progress notifications and built-in file handling for URLs mean you’re not building infrastructure—you’re building features. If you’ve been waiting for the agent hype to translate into something you can actually ship, a Python script you can run on your laptop feels like a pretty good place to start.
💡 Key Takeaways
- Gradio's `mcp_server=True` flag automatically converts Python functions into LLM-callable tools using docstrings, eliminating manual schema work.
- Combining Gradio's MCP server with a browser automation tool like Playwright enables LLMs to browse real retail sites and pipe product images directly into AI models.
- The demo uses IDM-VTON, a diffusion model from Hugging Face, to perform virtual try-ons that show how a specific garment would look on a person's photo.
- This agent runs entirely through VS Code's AI chat, turning a code editor into a personal shopping interface without building a custom frontend.
Keep reading: See related articles below for more coverage on this topic.
Get smarter about AI
The sharpest AI news, curated daily. Delivered free to your inbox.