Skip to content
← All writing
2026-06-11 · 19 min read mcpllmagentarchitecture

Why MCP Exists: From Hardwired Tools to a Standard Protocol

Skip the definitions. Starting from "let AI run my WordPress", we derive what MCP actually solves, what it doesn't, and how it really relates to LLMs and Claude Code.

What you'll get out of this post

MCP (Model Context Protocol) is everywhere right now, but most introductions open with a definition and an architecture diagram, and you finish them still not knowing why it exists in the first place. This post works the other way around:

💡

This is part one (the theory)

By the end of this post, you'll understand MCP. Part two, Hand-Writing a WordPress MCP, walks you through building the server and client from scratch until "publish a post with one sentence" actually works -- by the end of that one, you'll be able to do it. The two posts share one real, runnable experiment; full code is on GitHub: github.com/stanleyyylau/wp-mcp.


The setup: I want AI to manage my WordPress

Let's nail down the scenario first -- everything that follows builds on it.

I have a WordPress site. I want to tell an AI "write a post about autumn, add a cover image, and publish it" and have it actually create the post, upload the image, and hit publish. Not hand me a wall of text to copy-paste, but actually operate my site.

The core tension here fits in one sentence:

⚠️

The fundamental limitation of LLMs

A language model only generates text. It can't reach the network, read your database, call your APIs, or touch your WordPress. Everything it emits is just a string of characters.

So if you want AI to "operate" anything, there's really only one way: we write the code that does the real work (functions) outside the model, then find a way for the model to "decide" when to call which function with what arguments. The model supplies the plan; our code supplies the hands.

That mechanism is

Key Concept

Function Calling / Tool Use

a capability every modern LLM supports: you attach a "tool menu" to your request (each tool has a name, a description, and a parameter schema); instead of answering directly, the model returns "I want to call create_post with arguments {...}"; your code executes it, feeds the result back to the model, and the model decides what to do next. The model never touches any tool itself -- it only emits a structured statement of intent about which tool it wants called.


Version one: weld the tools straight into the agent

The simplest approach -- and one that works perfectly well -- is a single script that defines both the tool's description (for the model) and the tool's implementation (the code that actually calls the WordPress REST API).

// Tool menu: the "catalog" the model gets to see
const tools = [{
  name: "create_post",
  description: "Create and publish a post on WordPress",
  parameters: {
    type: "object",
    properties: {
      title: { type: "string" },
      content: { type: "string" },
    },
    required: ["title", "content"],
  },
}];

// Tool implementation: the code that does the real work
async function createPost(args) {
  return fetch("http://my-wp.com/wp-json/wp/v2/posts", {
    method: "POST",
    headers: { Authorization: BASIC_AUTH, "Content-Type": "application/json" },
    body: JSON.stringify({ ...args, status: "publish" }),
  }).then((r) => r.json());
}

// Agent loop: model decides -> I execute -> feed back -> repeat
while (true) {
  const reply = await llm.chat(messages, tools);
  if (!reply.tool_calls) break;            // model is done calling tools
  for (const call of reply.tool_calls) {
    const result = await createPost(call.args);  // do the work
    messages.push({ role: "tool", content: JSON.stringify(result) });
  }
}

That's a working AI agent. You say "publish a post", the model writes the title and body, decides to call create_post, and your code really publishes it. It genuinely works.

✅

Hold on to this conclusion

If it's just you, one application, and three to five tools -- stop here. You don't need MCP at all. Welding the tools straight into the agent is the simplest, most efficient approach. We'll come back to this point in detail later.

So where does it break down? It breaks down because the world isn't "one application x a handful of tools".


Version two: when both sides start multiplying

Zoom out. In practice, two things grow at the same time:

The tool side grows. You don't just want WordPress. You also want AI to query your database, read your GitHub, send Slack messages, drive Notion, hit internal company APIs... and each one needs its own "tool description + tool implementation" pair.

The application side grows too. You're not using this in just one script. You want it in Claude Desktop, in Cursor, in Claude Code, in your own support bot, in your coworker's Python project...

Now put them side by side:

The real cost of hardwiring: M x N

Claude Desktop
→
Cursor
→
Your bot
→
...M apps

Every app writes its own integration code for every single tool below

↓

WordPress
→
Database
→
GitHub
→
...N tools

M x N copies of duplicated glue code

M applications, each integrating N tools, means M x N sets of integration code. And every one of them re-solves the same problems: how to describe a tool, how to translate the model's intent into a real call, how to handle auth, how to feed results back.

Three things make it even worse:

  1. Tools get locked inside applications. The WordPress integration you wrote for your support bot is useless to Cursor -- it lives in another process, in another language.
  2. Whoever writes a tool has to understand AI. If the WordPress team wants their product to be "operable by AI", they'd have to study every AI application's tool format and submit code to each one separately. That simply doesn't scale.
  3. There are no boundaries. Tool descriptions, implementations, and the API format of one specific model are all tangled together -- switch models or switch apps and you rewrite everything.

At this point, anyone who's done real engineering instinctively asks the key question --

💡

By now, the answer is practically writing itself

Can we decouple the "tool provider" side from the "tool consumer" side? Let providers expose their capabilities through one shared standard, and let applications integrate through that same standard -- so neither side needs to know anything about the other's internals?

This is a pattern computer engineering has validated over and over: when M x N gets too expensive, insert a standard protocol in the middle and turn it into M + N. Two classic examples make it concrete:

MCP is the same playbook applied to "AI applications x tools/data sources".

By the way, this trick is older and runs deeper than either example -- the same move is behind TCP/IP, LLVM, JDBC, even shipping containers. I've pulled the principle apart in its own post, The M x N Problem: One Pattern Behind USB, LSP, and MCP. Internalize it once, and MCP stops being "a new thing to learn" -- it's basic engineering fundamentals wearing this year's costume.


What MCP is: turning M x N into M + N

Key Concept

MCP (Model Context Protocol)

An open protocol that defines how to talk between "the party that wants to give AI capabilities" and "the AI application that wants to use them". The provider wraps itself as an MCP Server that exposes tools and data per the standard; the AI application embeds an MCP Client that connects, discovers, and calls per the same standard. Both sides speak only the protocol -- never each other's implementation.

Insert that layer, and the diagram above changes:

With MCP: M + N

Claude Desktop
→
Cursor
→
Your bot

M apps, each implementing 'speaks MCP' exactly once

↓

MCP protocol (one shared standard)

↓

WordPress MCP
→
Database MCP
→
GitHub MCP

N tools, each implementing an MCP Server exactly once

The key shift: the WordPress MCP Server is written once, and every application that speaks MCP can use it. Conversely, as long as your bot speaks MCP, it can connect to every MCP Server in the world without writing per-tool glue. M x N becomes M + N.

That widely quoted analogy -- "MCP is USB-C for AI" -- should now click for a real reason, not just because it sounds good: before USB-C, every device shipped its own charging port and cable (M x N); after USB-C, devices just expose a Type-C port, hosts just provide a Type-C port, and one cable in the middle handles everything (M + N). MCP is that "standardized connector shape" for the AI world.

⚡ Iron Rule #1

MCP is fundamentally decoupling, not new capability

MCP gives AI no ability it couldn't already have -- Function Calling could invoke tools long before MCP existed. What MCP solves is an engineering problem: decoupling tool providers from tool consumers, so a capability can be written once and reused everywhere. When deciding whether to use MCP, always start by asking "do I actually have an M x N reuse problem here?"


The four roles: who's who, once and for all

This is where most people get tangled up, so let's pin down all four roles using the WordPress example.

The four roles in one 'have AI publish a post' run

HeaderMeaningExample
HostThe application you interact with directly; orchestrates everything and owns the conversationClaude Desktop / Claude Code / Cursor / the CLI we hand-write in part two
MCP ClientA piece of code inside the Host -- one per connected Server -- that speaks the MCP protocolThe part of the Host that talks to the WordPress Server
LLM (the brain)The model that decides which tool to call with what arguments; it can't touch any tool itselfClaude / DeepSeek / GPT
MCP ServerThe party that does the real work, wrapping a system's capabilities as tools/resourcesWordPress MCP Server (calls the WP REST API underneath)

Here's how they chain together:

The complete data flow of one 'publish a post' run

1. You
'Publish a post about autumn'

↓

2. Host
Sends your words + the tool menu to the LLM

↓

3. LLM
'I want to call create_post with {...}'

↓

4. MCP Client
Translates that intent into an MCP request

↓

5. MCP Server
Receives the request, actually calls the WP REST API

↓

6. Result flows back
Fed to the LLM -> LLM decides the next step or wraps up

Once you can read this chain, you can answer the question that trips everyone up:

✅

So is Claude Code or Codex an LLM?

No. They're Hosts (with MCP Clients inside), not LLMs.

Claude Code CLI, Codex CLI, Claude Desktop, Cursor -- they're all fundamentally MCP Hosts: they manage the conversation, call out to an LLM, and embed MCP Clients to connect to MCP Servers. They use LLMs (Claude Code uses Claude, Codex uses GPT), but they are not models themselves.

Keeping them separate from the LLM buys you something concrete: the same MCP Server works no matter which brain is behind it. The WordPress Server we hand-write in part two can be driven by our DeepSeek-powered CLI, or dropped as-is into Claude Desktop and driven by Claude -- because they all speak the same protocol. The Server couldn't care less which model is on the other side.

There's one more point that's easy to miss but matters a lot: the LLM doesn't understand MCP, and the Server doesn't understand the LLM. The LLM only knows the "tool menu" in its own API format; the MCP Server only knows the MCP protocol. The thing that bridges them -- doing the "format translation" -- is precisely the client code inside the Host. Note that the LLM side of this translation is provider-specific: Anthropic, OpenAI, and Gemini each have their own function-calling dialect, so a multi-provider Host needs a translator per dialect (part two shows why that's far less painful than it sounds). Which is exactly why part two is hand-written end to end: it's the only way to see, on a specific line of code, where that translation happens.


Three primitives: MCP is more than "remote function calls"

If MCP could only expose "tools", it really would just be remote Function Calling. But the protocol defines three kinds of capability (called "primitives"), each solving a different class of problem. Covering only the first one sells MCP short.

MCP's three primitives (in WordPress terms)

HeaderMeaningExample
ToolsLet the LLM 'take actions' -- usually with side effects, invoked at the model's discretionCreate a post, upload an image, build a menu, delete a post
ResourcesLet the Host 'read context' -- read-only data, identified by a URIwp://posts/123 = a post's body; wp://site/info = site config
PromptsReusable workflow templates baked into the Server, triggered by the user in one click/weekly_digest = roll recent posts into a weekly digest draft

The split between them comes down to who initiates, and whether there are side effects:

💡

Why the distinction matters

Because each primitive has a different locus of control inside the Host: Tools are invoked when the model decides; Resources enter the context when the application/user decides; Prompts fire when the user triggers them. Separating "reading data" from "taking actions" is also a security design -- you can comfortably expose a pile of Resources for the model to read, while gating side-effecting Tools behind an extra confirmation.

In part two we implement all three primitives against WordPress and run them for real -- it'll feel much more tangible.


Honestly: what MCP doesn't solve

There's no shortage of articles hyping MCP. But to make a real technical decision, you need to know where its boundaries are.

🚨

MCP is not a silver bullet

MCP is a protocol/plumbing layer. It makes capabilities reusable, but it doesn't make either end any smarter, and it takes no responsibility for security. None of the problems below are solved by MCP.


So: when do you use MCP, and when do you just open up tools?

Condensing everything above into one actionable decision table:

Decision table

HeaderMeaningExample
Only one application uses itNo M, so there's no M x N to speak of-> Weld the tools into the agent; skip MCP
Three to five highly specific toolsLow reuse value; the wrapping cost isn't worth it-> Just write the tools directly
Multiple apps need to reuse the same capabilitiesClassic M x N scenario-> Use MCP; write the Server once, plug in everywhere
You want others (incl. Claude/Cursor) to integrate your capabilitiesYou're building the 'integrated-into' side-> Use MCP; this is exactly its home turf
Capabilities must be reused across languages/processesA hardwired setup can't do this-> Use MCP; process isolation + language-agnostic
Extremely latency-sensitive, trivially simple logicAn extra protocol layer is pure overhead-> Write the tools directly, or inline the functions

⚡ Iron Rule #2

Ask 'is there reuse?' before deciding on MCP

MCP's payoff comes from reuse (M+N < M x N) and standardization (being integrable by any Host). Without either of those needs, plain Function Calling is simpler and faster. Don't wrap a single-app, three-tool project in a protocol layer just because MCP is trendy. Conversely, the moment you're designing a capability to be integrated by many AI applications, MCP is essentially the only right answer.


Wrapping up: you should get it now

Pulling the chain of reasoning together:

  1. LLMs only generate text; to act on the real world, you need external tools + Function Calling.
  2. With one application and few tools, welding the tools straight into the agent is all you need.
  3. Once both apps and tools multiply, hardwiring becomes M x N copies of duplicated glue, with tools locked inside applications.
  4. The standard engineering fix is to insert a protocol layer and turn it into M + N -- that's MCP.
  5. Four roles: the Host contains the Client, uses an LLM, and connects to Servers; Claude Code/Codex are Hosts, not LLMs.
  6. MCP has three primitives: Tools (take actions) / Resources (read data) / Prompts (templates).
  7. MCP doesn't make models smarter and doesn't handle security -- and it isn't the right call for every scenario.

In the next post, we put all of this theory into practice: spin up a real WordPress in Docker, hand-write an MCP Server (all three primitives) and an MCP Client (with an agent loop against the official DeepSeek API), get "publish a post with a cover image from one sentence" actually working, and finally plug that same Server into Claude -- you'll watch all four roles cooperate line by line in your terminal.