
Tiny Agents: an MCP-powered agent in 50 lines of code — announced via Hugging Face on April 25, 2025. It is fairly simple to extend an Inference Client – at HF, we have two official client SDKs: @huggingface/inference in JS, and huggingface_hub in Python – to also act as a MCP client and hook the available tools from MCP servers into the LLM inference. Once you have an MCP Client, an Agent is literally just a while loop on top of it. You'll see your simple Agent connect to two distinct MCP servers (running locally), loading their tools, then prompting you for a conversation.
New! (May 23, '25) If you prefer Python, check out the companion post Tiny Agents in Python .
Over the past few weeks, I've been diving into MCP ( Model Context Protocol ) to understand what the hype around it was all about.
My TL;DR is that it's fairly simple, but still quite powerful: MCP is a standard API to expose sets of Tools that can be hooked to LLMs.
A tool is defined by its name, a description, and a JSONSchema representation of its parameters. In some sense, it is an opaque representation of any function's interface, as seen from the outside (meaning, the LLM does not care how the function is actually implemented).
tool_choice: "auto" is the parameter you pass for the LLM to generate zero, one, or multiple tool calls.
For each MCP server we connect to, we slightly re-format its list of tools and add them to this.availableTools .
It is fairly simple to extend an Inference Client – at HF, we have two official client SDKs: @huggingface/inference in JS, and huggingface_hub in Python – to also act as a MCP client and hook the available tools from MCP servers into the LLM inference.
Once you have an MCP Client, an Agent is literally just a while loop on top of it.
In this short article, I will walk you through how I implemented it in Typescript (JS), how you can adopt MCP too and how it's going to make Agentic AI way simpler going forward.
Tiny Agents: an MCP-powered agent in 50 lines of code — announced via Hugging Face on April 25, 2025 Reported by Hugging Face on April 25, 2025.