·12 min read
The Interesting Part of MCP Is the Client
Writing an MCP server is a weekend. Writing one that behaves well in a client you do not control is the actual job, and the protocol's most interesting half runs in the other direction.
MCP / Agents / AI / LLM / Protocols / Architecture
Writing an MCP server is a weekend. You declare some tools, each with a JSON Schema, wire them to functions you already had, and a compatible client can call them. The tutorials stop there, which is why almost everything written about the Model Context Protocol (published by Anthropic in November 2024, and the reason half the industry now ships a server) reads like a description of a plugin format.
Then you run it inside a client you do not own, and the interesting questions all turn out to be on the other side of the wire. Which primitive does this client implement? Will it call you back? Will it tell you who the user is, and where it is willing to let you look? What is the token it just handed you, and what is that token allowed to do? None of that is in your server. All of it decides whether your server is any good.
I wrote about A2A a few weeks ago and drew the distinction quickly: MCP is vertical, the wiring between a model and the capabilities you hand it. That is true, and everyone repeats it. This is the rest of it.
Three primitives, and the difference is who is in control
A server can expose three kinds of thing, and engineers usually read the list as three kinds of data. It is not a taxonomy of content. It is a taxonomy of who pulls the trigger.
- Tools are model-controlled. The model decides to call one, mid-turn, without a person necessarily being asked first.
- Resources are application-controlled. The client decides what to read and when to put it into context. Nothing is invoked; something is included.
- Prompts are user-controlled. A person picks one deliberately, which is why clients tend to surface them as slash commands or menu entries.
Put a code-intelligence server against that split and the same capability lands in three different places depending on who should be deciding. Searching for a symbol across a repository is a tool: the model should be able to reach for it when a question needs it. The parsed outline of the file the user currently has open is a resource: the application knows it is relevant, and attaching it does not need a model to have an idea first. “Review this diff for breaking API changes” is a prompt: a workflow a person chooses, with the arguments they choose.
Choosing the wrong primitive moves a decision to the wrong party, usually from a person to a model, which is the direction that costs you.
When everything is a tool
In practice most servers expose tools and nothing else, and with good reason: tools are the interoperability floor. Every client implements them, and resources and prompts have patchier support, so shipping everything as a tool is the option that works everywhere today.
It also has three costs that show up later.
The model has to guess at what the app already knows. If the open file is only reachable through a read_file tool, every session begins with the model spending a turn discovering something the client could have attached for free.
Approval fatigue is a security control being worn down. Clients ask the user to confirm tool calls. A server that turns routine context-gathering into eight tool calls per turn trains that user to approve without reading, and the one call that mattered goes through the same reflex as the seven that did not.
You have taken a choice away from the client. A good client can put a resource in context cheaply, cache it, show it to the user, and let them remove it. None of that is available for a tool call.
The workable posture is to ship tools for the capabilities that require a decision at generation time, and also expose the material a client could sensibly pre-load as resources, and the multi-step workflows as prompts. Clients that implement only tools still work. Clients that implement more can do better, and you did not have to pick one.
The channel that runs backwards
The half of MCP that changes how you design a server is the set of features where the server asks the client for something. This inverts the dependency people assume from the name “server”, and it is where the protocol stops being a plugin format.
Roots. The client tells the server which directories or URIs are in scope for this session, and that list is the boundary you are being handed. An indexer that walks outside the declared roots because it found an interesting relative path has done what the mechanism exists to prevent. Treat roots the way you would treat a tenant predicate: the scope is an input to every operation, not a suggestion.
Sampling. The server can ask the client to run a model completion on its behalf. Its significance is what it removes: a server that needs a model does not need an API key, a provider account, or a spend budget. It borrows the client's, under the client's policy, with the client able to show the user what is being asked and refuse. A server that carries its own key has made itself a second place where model spend and model access have to be governed.
Elicitation. Added in the 2025-06-18 revision: the server can ask the client to ask the user a structured question mid-operation, and continue with the answer. If that sounds familiar, it is the same pattern as A2A's input-required state: a callee allowed to stop halfway and ask a question. The same engineering conclusion applies: an operation is not “arguments in, result out”, and a server that can only succeed or throw will fail every case that needed one clarification.
The design consequence of all three is the same. Your server is not a library the model imports. It is a participant in a session that has a user, a policy and a model budget belonging to someone else, and the capabilities you are offered are the sanctioned way to reach them.
Capabilities you cannot assume
All of this is negotiated in the initialize handshake, both directions, and today most clients implement tools well and the rest unevenly. So the negotiation result is a branch in your server, not bookkeeping.
// what the client told us it can do, at initialize
const canElicit = Boolean(clientCapabilities.elicitation);
const canSample = Boolean(clientCapabilities.sampling);
async function resolveTarget(args: SearchArgs, matches: Symbol[]) {
if (matches.length === 1) return matches[0];
// best: let the user disambiguate, in their own UI
if (canElicit) {
const answer = await server.elicit({
message: "Several symbols match. Which one did you mean?",
requestedSchema: {
type: "object",
properties: {
symbol: { type: "string", enum: matches.map((m) => m.id) },
},
required: ["symbol"],
},
});
if (answer.action === "accept") return byId(answer.content.symbol);
}
// otherwise: do not invent a winner, hand the ambiguity back as a
// result the model can act on next turn
return {
ok: false,
error: "ambiguous: " + matches.map((m) => m.id).join(", "),
};
}
Two choices in that code matter. A server that hard-requires elicitation does not work in most clients today, so every reverse-channel feature needs a path for its absence. And the fallback returns a typed result the model can read and respond to rather than throwing, which is the same argument as returning validation errors to the loop, arriving here through a different door.
The same applies to change notifications. If your tool list can change mid-session (a repository finished indexing, a feature flag flipped), say so, send listChanged, and accept that a client which ignores it will hold a stale list until the session ends. Design the stale case to be harmless rather than assuming the notification landed.
The token is not yours to forward
For servers on an HTTP transport, the authorisation story firmed up considerably across the 2025 revisions, and the design is worth knowing because it is the opposite of what most integrations do by reflex. An MCP server is an OAuth 2.1 resource server. It publishes protected resource metadata so a client can discover which authorisation server to talk to, and the client requests a token whose audience is your server, using resource indicators (RFC 8707) to say so.
The consequence is a rule the spec is explicit about and which is easy to violate without noticing: do not accept a token that was not issued for you, and do not forward the token you were given to something downstream.
// wrong: the token arrived, so pass it along
const issues = await github.listIssues(req.headers.authorization);
// right: verify this token was minted for THIS server, then obtain
// a separate, narrower credential for the downstream call
const claims = await verifyAccessToken(req, { audience: MY_RESOURCE_URI });
const ghToken = await tokenForUser(claims.sub, "github:issues:read");
const issues = await github.listIssues(ghToken);
The failure the first line produces is a confused deputy, and nothing flags it. A token with a broad scope reaches a downstream API through your server; the downstream sees a valid credential and has no way to know the request originated in a model that had just read an untrusted file. This is the injection argument with a new place to go wrong: the protocol has given you a token, and treating “I have a credential” as “this action is authorised” is the mistake.
Two smaller things in the same area, both cheap and both skipped:
- Validate
Originon HTTP transports, and bind local servers to loopback. A local server listening on all interfaces with no origin check is reachable from a web page the user happens to have open, which is a browser-driven path into a process holding their filesystem. - Scope per user, not per server. If your server holds one service credential and serves whoever connects, every user of that server has the union of everyone's permissions, and the tenant boundary you were careful about in the database does not exist here.
Your descriptions live in someone else's context window
Every tool you expose is a block of text loaded into a context window you do not own, paid for with tokens you do not buy, competing with the user's question for the model's attention. A server with forty verbose tools might look thorough, but it is expensive and it degrades the client it is plugged into. This is the strongest argument for a small, sharply-named surface, and it is an argument about the client, not about your API.
The discipline for writing each one is the discipline for designing an API for an unreliable caller: few tools that could not be confused with each other, descriptions that state when not to use them, narrow schemas, and errors that give the caller a next step. What MCP adds is that the caller is in an application you have never seen, next to other servers you did not choose, so “search” as a tool name is worse than under-specified: it is already colliding.
Two client-side realities to design around. Tool annotations (read-only, destructive, idempotent) are hints, and a careful client treats hints from an untrusted server as claims rather than facts; do not assume marking a tool read-only earns it an auto-approval. And a tool description can change between sessions, which means a client that approved a tool once may be approving different text later. A client that pins what it approved is doing the right thing; a server that rewrites tool semantics under a stable name is the reason it has to.
When you do not need a server at all
The A2A post made this argument for agent-to-agent protocols and it applies here with a different boundary.
- Your agent, your tools, one deployment. Call the function. You keep your types, your stack trace and your test suite, and you skip a process boundary and a serialisation format. An in-house agent that talks to an in-house MCP server it was shipped with has bought a protocol to speak to itself.
- One consumer, and you own it. Protocols amortise across clients. With exactly one client, a direct integration is less work and more testable; adopt MCP when the second client appears, or when you want to be reachable by clients you have not met.
- The caller is code, not a model. If the request is fully specified by fields, that is an HTTP API, and it does not need a natural-language interface or a model deciding what you meant.
- A tight latency budget. Tool discovery, approval round trips and an extra hop do not fit under a hard interactive deadline.
- You cannot scope the capability to a user. If the only version of your server that works holds one broad credential for everybody, fix the scoping first. Shipping it means every client that connects gets that authority.
The short version
MCP is usually taught as a way to publish tools, and the tools take a weekend. The decisions that matter sit on the client side of the handshake. Pick the primitive by who should be in control (model, application or person) rather than by what the data looks like, and do not turn every piece of context into a tool call the user has to approve. Design for the reverse channel: treat roots as the boundary they are, borrow the client's model through sampling rather than carrying your own key, and use elicitation for the questions a run cannot answer alone. Branch on negotiated capabilities, because most clients do not implement all of this, and make the fallback a typed result rather than an exception. Verify that the token you were handed was minted for you, never forward it downstream, and scope authority to the user rather than the server. Keep the tool surface small, because it is rented space in a context window someone else is paying for. And if the agent, the tools and the deployment are all yours, write the function call. The protocol is worth its overhead at a boundary, and you do not have one.