← All posts

Software engineer to AI engineer, Part 5: scaling tools with MCP

Model Context Protocol—a shared tool catalog for AI apps: server, client, JSON-RPC, and a PayIQ FastMCP walkthrough.

Software engineer to AI engineer, Part 5: scaling tools with MCP
Contents

In brief

Part 5 of Bjorn van der Laan’s AI engineering series: instead of every app hand-rolling tools, teams expose a reusable catalog via MCP (Model Context Protocol). A server publishes tools; a client fetches the catalog for the model; calls use JSON-RPC 2.0 over streamable HTTP or stdio.

What happened

An MCP server is a tool catalog—names, typed parameters, descriptions—maintained by a SaaS vendor or internal platform team. An MCP client in the app retrieves that catalog and hands it to the model, like the local tool list from earlier parts. The model doesn’t speak MCP; client and server do.

Transport:

  • streamable HTTP — server behind a URL for shared deployments;
  • stdio — client spawns the server as a subprocess.

In the PayIQ example, calculate_refund_cost and search_payments_knowledge_base wrap in FastMCP (langchain_mcp_adapters). After python -m app.mcp_server, curl runs initializeMcp-Session-Idtools/list. The catalog shape matches Part 3’s local tools.

A LangChain client (MultiServerMCPClient) loads tools and binds them to the model (Claude Sonnet in the sample). On a €480 refund question, the model first searches the knowledge base, then runs the fee calculator—two tool calls. The author notes you need a loop until a final answer—that’s the step toward agentic behavior.

Why it matters

Companies have git, tickets, monitoring—duplicating wrappers in every chatbot is expensive. MCP standardizes “tool APIs for models,” similar to how REST standardized HTTP services. For AI engineers it mirrors backend work: build servers and consume others’ catalogs.

In practice

  1. Define tools with clear parameter schemas—models read descriptions literally.
  2. Run the MCP server as its own process; stdio for local dev, HTTP with sessions for teams.
  3. Keep a tool_name → handler map and loop tool execution until the model stops calling tools.
  4. Don’t conflate the model catalog with authorization—who may refund or read the KB is server policy.
  5. Series code: companion repo.

Takeaway

MCP moves AI tools from per-project one-offs to shared infrastructure. After a catalog, the natural next step is a tool-call loop—a proper agent; the series teases that in the next installment.