Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

htmx essays 13 min read Case study mediumAdept

Hypermedia Friendly Model Context Protocol App Architecture

An MCP App for scheduling smartwatch workouts uses hypermedia instead of React by wiring the Fixi library to the MCP App Bridge, so any `fx-action` beginning with `tool:` calls `app.callServerTool` and swaps the returned HTML fragment into the iframe. The backend is a Django ASGI plus FastMCP monolith that shares the ORM and templates, using Django 6 template partials to render both the initial UI and dynamic fragments from a single file. This keeps the LLM out of the loop for form interactions like picking events and occurrences, which reduces friction and token use. The approach builds on a small workout DSL with a recursive descent parser that LLMs translate natural-language workouts into, outputting formats for Apple and Garmin watches.

Assumes: Model Context Protocol basicsDjango templateshtmx-style hypermedia

Related posts

  • MCP UI: Breaking the text wall with interactive components

    Shopify Engineering easyNovice

    MCP UI extends the Model Context Protocol so servers can return interactive UI components, such as product selectors, galleries and cart flows, as embedded ui:// resources alongside JSON data. Components can be delivered three ways: inline HTML via srcDoc in a sandboxed iframe, remote resources loaded in a sandboxed iframe, or Remote DOM for direct client-side rendering. Components never modify state directly. They emit intents like view_details, checkout, notify and ui-size-change, which the agent interprets, so the agent stays in control. Hosts can pass CSS through render data to match their branding, and Shopify argues this beats having agents generate commerce UI with variants, bundles, subscriptions and live inventory.

  • Implementing MCP Servers in Python: An AI Shopping Assistant with Gradio

    Hugging Face mediumAdept

    Gradio's MCP integration turns Python functions into LLM tools: launching an app with mcp_server=True exposes each endpoint as an MCP tool, with names, descriptions and input schemas generated from function docstrings, plus progress streaming and file upload handling. The walkthrough builds a virtual try-on shopping assistant by wrapping the IDM-VTON diffusion Space, called through the Gradio API client, in a Gradio Interface. That server is registered alongside the Playwright MCP server in VS Code's mcp.json, so the AI chat can browse a clothing store and render the user wearing selected garments.

  • Tiny Agents: an MCP-powered agent in 50 lines of code

    Hugging Face mediumAdept

    An LLM agent built on the Model Context Protocol reduces to a simple while loop around an MCP-aware inference client: connect to MCP servers, convert their tools into OpenAI-style function definitions, pass them to the chat-completion call, execute returned tool calls via the MCP SDK, and feed results back. The TypeScript implementation in huggingface.js extends InferenceClient into an McpClient that holds one session per server and maps tool names to sessions. An Agent class adds a system prompt plus two control-flow tools (task_complete, ask_question). The loop alternates tool calls and results until an exit tool is called, the model answers twice without tools, or a turn limit is reached. The default setup uses Qwen2.5-72B on Nebius, and the model, provider and MCP servers can be swapped.

  • Tiny Agents in Python: a MCP-powered agent in ~70 lines of code

    Hugging Face mediumAdept

    Hugging Face's huggingface_hub Python SDK now includes an MCP client and a minimal Agent class, letting an LLM pull tools from MCP servers (stdio, SSE or streamable HTTP) and call them during inference. Install it with `pip install "huggingface_hub[mcp]"`, then run agents from the `tiny-agents` CLI, configured by an agent.json that sets model, inference provider and MCP servers, plus an optional PROMPT.md. The MCPClient connects to servers, converts their tool schemas into OpenAI-style function definitions, and streams chat completions while rebuilding tool calls. It then routes each call to the right MCP session. The Agent is essentially a while loop on top of the client, with special exit-loop tools to end a turn.

  • What’s MCP all about? Comparing MCP with LLM function calling

    Neon mediumAdept

    The Model Context Protocol (MCP) builds on LLM function calling by moving tool definitions and execution out of individual LLM applications into standalone servers that any MCP-compatible client can discover and invoke. A Home Assistant light-control function is implemented both ways. The first version uses OpenAI tool definitions in JSON, with the app parsing tool_calls and executing them itself. The second is an MCP server built with the TypeScript SDK, a Zod schema and stdio transport, registered in Cursor. The takeaway is that function calling leaves discovery and execution to each app, while MCP standardizes them so tools can be reused across agents like Cursor, Windsurf and Claude Desktop.

The quest for software engineering knowledge.

Look:
Layout: