Back to writing

Giving the LLM hands, part 2: MCP servers and the Relay client

In part 1 I gave the LLM a pair of hands called Relay. This one is about what those hands hold: MCP servers in front of Ledger and Compass, and how Relay finds their tools, shows them to the model and runs the ones it picks.

Part 2 of 2. Part 1, from a fixed pipeline to a tool service, explains why Relay exists.

Same note as before: Meridian, Atlas, Ledger, Compass and Relay are made-up names, and this stays high level. If you have not read part 1, the short version is that the model decides what it needs, and Relay carries out its requests.

MCP in one paragraph

The Model Context Protocol (MCP) is an open standard for connecting AI applications to tools and data. A server says “here are the tools I offer”, each with a name, a description and a schema for its inputs. A client can ask for that list and then call a tool by name. That is all we need: a shared way to list tools and call them, so Relay does not need custom code for every service.

Step one: an MCP server in front of each service

We add an MCP server to Ledger and another to Compass. Each one belongs to the team that owns the service, because they know the data and its rules best. A few choices made them useful instead of noisy:

  • Tools match tasks, not endpoints. “Find this customer’s recent orders” is a tool. A mirror of every REST route is not. The model chooses better from a short menu of clear jobs.
  • Descriptions are written for the model. What the tool does, when to use it, what each input means. This text is the model’s only manual.
  • Results are small. Return the fields that answer the question, not the whole record. Smaller results are cheaper and easier for the model to read.
  • Errors explain themselves. “No order with that number” lets the model recover. A bare failure makes it guess.
  • Read-only first. Every tool in this first version only reads. Anything that changes data comes later, with a confirmation step.

The server reuses the service’s own validation and data access, so a rule lives in one place whether the call comes from a REST client or from the model.

Step two: Relay as the MCP client

Relay is where the servers meet the model. The flow has six steps:

  • 1. Discover. Relay asks each MCP server which tools it offers, and keeps the combined list. It refreshes the list when a service ships new tools.
  • 2. Offer. For each request, Relay gives the model the tools that user is allowed to use, with their descriptions.
  • 3. Ask. The model reads the question and, if it needs something, asks for a tool with some inputs.
  • 4. Call. Relay checks the inputs and the user’s rights, finds which server owns that tool, calls it, and logs the call.
  • 5. Receive. The server answers, and Relay trims the answer if it is bigger than the model needs.
  • 6. Return. Relay passes the short result back to the model, which either asks for another tool or writes the answer.
LLM on Bedrockpicks a toolRelayMCP clientchecks, logsLedger MCPorders, accountsCompass MCPpolicies, products1 list tools4 call, 5 result2 tool list3 asks for a tool6 short result
Relay discovers the tools, offers them to the model, and runs each call on the right MCP server.

Notice what does not change when a team adds a tool. They add it to their MCP server and deploy. Relay sees it on its next discovery and offers it to the model. Nothing in Atlas or Relay needs a new release.

What gets harder

Putting a hop in the middle has costs, and a few of them surprised us:

  • Too many tools confuse the model. Every tool description takes space in the prompt, and a long menu makes choosing harder. Relay offers only the tools that fit the user and the question.
  • Tool results are untrusted input. Text that comes back from a tool, such as a product description or a note on an order, can contain instructions meant for the model. Relay treats results as data, keeps tool rights narrow and does not let the model widen them.
  • Names and descriptions are an interface. Renaming a tool or rewording its description can change how the model behaves, so we review these changes like code.
  • More hops, more latency. Model, Relay, MCP server, service and back. We keep results small, set timeouts and watch the logs for slow tools.
TakeawayLet each service describe what it can do through MCP, and let one client decide who may use it and how the answers reach the model. The services stay simple, and the rules stay in one place.

Working on something similar? Let's talk